def get_addrs_from_paymentrequest(pr): ret_list = [] pr_obj = PaymentRequest() pr_obj.ParseFromString(pr) pd = PaymentDetails() pd.ParseFromString(pr_obj.serialized_payment_details) for output in pd.outputs: script = deserialize_script(output.script) if script[0] == OP_DUP and script[1] == OP_HASH160 and script[3] == OP_EQUALVERIFY and script[4] == OP_CHECKSIG: ret_list.append(hex_to_b58check(script[2].encode('hex'))) return ret_list
if ls in skiplist: print 'SKIPLIST', ls continue #u = ls[0] # first element is public-key #t = ls[1] # type, x,compr, uncompr #algo = ls[2] # algo #seed = ls[3] # seed, passphrase for private-key #kp=BitcoinKeypair.from_passphrase(seed) #priv=kp.private_key() #pub=kp.public_key() #print('PUB', u,t,seed,priv,pub) #addr = hash160.public_key_to_bc_address(pub.decode('hex_codec')) addr = pybitcointools.hex_to_b58check(ls) print('h160 ...', l) h = bci.history(addr) u = bci.unspent(addr) if h and any(h): with open("found-used.csv", "a") as myfile: myfile.write("%s %s H%d U%d\n" % (addr, ls, len(h), len(u))) if u and any(u): print('u-LS ************************', u, ls) #u = unspent(addr) if (len(u) > 0):
def create_stealth_address(spend_pubkey, magic_byte=42): # magic_byte = 42 for mainnet, 43 for testnet. hex_spendkey = btc.encode_pubkey(spend_pubkey, 'hex_compressed') hex_data = '00{0:066x}'.format(int(hex_spendkey, 16)) addr = btc.hex_to_b58check(hex_data, magic_byte) return addr