Example #1
0
    def __init__(self, config_file, password):
        '''
           constructs needed objects
        Parameters
        ----------
        password  : takes the password of the wallet

        Returns
        -------

        '''

        self.config = NotaryConfiguration(config_file)
        self.logger = log_handlers.get_logger(self.config)
        self.ssl_verify_mode = self.config.get_ssl_verify_mode()
        self.wallet = wallet.create_wallet(self.config.get_wallet_type(), password, self.logger)
        self.secure_message = SecureMessage(self.wallet)
        self.notary_server = NotaryServer(self.config)
        self.address = str(self.wallet.get_bitcoin_address())
import wallet
from bitcoinlib.wallet import P2PKHBitcoinAddress
from message import SecureMessage
import configuration
import log_handlers
import test_data

config = configuration.NotaryConfiguration('./notaryconfig.ini')
if config.is_remote_testing():
    notary_url = config.get_remote_server_url()
else:
    notary_url = config.get_local_server_url()

requests.packages.urllib3.disable_warnings()

logger = log_handlers.get_logger(config)
logger.debug("-------------------------ENVIRONMENT--------------------------")
logger.debug("Am I Local: %s " % config.is_local_host())

wallet = wallet.create_wallet(config.get_wallet_type(), config.get_key_id(),
                              logger)
secure_message = SecureMessage(wallet)

## Test GET pubkey
req_pubkey = requests.get(notary_url + '/api/v1/pubkey',
                          verify=config.get_ssl_verify_mode())
data = req_pubkey.json()
other_party_public_key = data['public_key']
print data['public_key']
address = str(wallet.get_bitcoin_address())
from bitcoinlib.wallet import P2PKHBitcoinAddress
from message import SecureMessage
import hashfile
import configuration
import log_handlers
import test_data

config = configuration.NotaryConfiguration('./notaryconfig.ini')
if config.is_remote_testing():
    notary_url = config.get_remote_server_url()
else:
    notary_url = config.get_local_server_url()

requests.packages.urllib3.disable_warnings()

logger = log_handlers.get_logger(config)
logger.debug("-------------------------ENVIRONMENT--------------------------")
logger.debug("Am I Local: %s " % config.is_local_host())

wallet = wallet.create_wallet(config.get_wallet_type(), config.get_key_id(),logger)
secure_message = SecureMessage(wallet)

## Test GET pubkey
pubkey_response = requests.get(notary_url+'/api/v1/pubkey', verify=False)
data = pubkey_response.json()
other_party_public_key_hex = data['public_key']
print data['public_key']
other_party_public_key_decoded = other_party_public_key_hex.decode("hex")
other_party_public_key = CPubKey(other_party_public_key_decoded)
other_party_address = P2PKHBitcoinAddress.from_pubkey(other_party_public_key)
address = str(wallet.get_bitcoin_address())