def __init__(self, item_index, address, adress_salt, item_amount, order_price): database = app.db.Database() from bitmerchant.wallet import Wallet if configuration.Configuration.btc_net == "Test": from bitmerchant.network import BitcoinTestNet wallet = Wallet.from_master_secret( configuration.Configuration.btc_master_key, network=BitcoinTestNet) else: from bitmerchant.network import BitcoinMainNet wallet = Wallet.from_master_secret( configuration.Configuration.btc_master_key, network=BitcoinMainNet) self.order_index = database.make_order(item_index, address, adress_salt, item_amount, order_price) child_wallet = wallet.get_child(self.order_index, is_prime=False) self.wif_key = child_wallet.export_to_wif() self.btc_address = child_wallet.to_address() self.private_key = child_wallet.get_private_key_hex() database.update_order(self.order_index, self.wif_key, self.btc_address, self.private_key)
def from_seed(cls, seed): return cls(Wallet.from_master_secret(seed))
def setUpClass(cls): cls.master_key = Wallet.from_master_secret(binascii.unhexlify( 'fffcf9f6f3f0edeae7e4e1dedbd8d5d2cfccc9c6c3c0bdbab7b4b1aeaba8a5a2' '9f9c999693908d8a8784817e7b7875726f6c696663605d5a5754514e4b484542' ))
def setUpClass(cls): cls.master_key = Wallet.from_master_secret( binascii.unhexlify('000102030405060708090a0b0c0d0e0f'))
def test_from_master_secret(self): secret = binascii.unhexlify(b'000102030405060708090a0b0c0d0e0f') self.assertEqual(Wallet.from_master_secret(secret), self.master_key)
def sign(tosign, priv_key): proc = subprocess.run("~/go/bin/signer " + str(tosign) + " " + str(priv_key), shell=True, stdout=PIPE, stderr=PIPE, text=True) signature = proc.stdout return signature """ config """ fee = int(os.environ.get('FEE')) output_address = os.environ.get('OUTPUT_ADDRESS') token = os.environ.get('BC_TOKEN') master = Wallet.from_master_secret(seed=os.environ.get('SEED')) crypto_url = os.environ.get('CRYPTO_URL') """ ======= """ print(fee) print(output_address) print(token) print(master.get_child(1, is_prime=False)) baseurl = 'https://api.blockcypher.com/v1/btc/main/' childs = requests.get(crypto_url).json() wallet_base = master.get_child(0, is_prime=True) total_amount = 0 request_json = {
from bitmerchant.wallet import Wallet from mnemonic import Mnemonic # put in whatever Trezor generates for you here (or backup from this empty/insecure one as a test) mnemonic = 'clean health food open blood network differ female lion eagle rough upon update zone antique defense venture uncover mobile charge actress film vocal enough' passphrase = '' # empty string or whatever you actually choose path = "m/44'/0'/0'/0/0" # whatever shows up on the UI for that account (everything will start with m/44'/0' since it's bip44) child = Wallet.from_master_secret( Mnemonic('english').to_seed(mnemonic, passphrase)).get_child_for_path(path) child.to_address( ) # '18K9axbPpwqZgngB58nuwsYevL2z6ey4YG' (confirm this matches what Trezor is showing you) child.export_to_wif( ) # 'L4orhKxb9YSGRHZvv8th3KeUqRz6x3PPmdqLThajUgSesTovfKPG' (what you can use to spend the funds for the previous address)