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())
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()) ## Test POST account print("\nWallet Public Key Hex %s" % wallet.get_public_key_hex()) print("\nWallet Public Key %s" % wallet.get_public_key()) addrfromhex = P2PKHBitcoinAddress.from_pubkey( wallet.get_public_key_hex().decode("hex"))