Bitcoin Forum
July 17, 2025, 09:35:53 AM *
News: Latest Bitcoin Core release: 29.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / About exchange address on: June 08, 2021, 02:16:23 AM
I have seen many monitoring websites that can collect the address of the coinbase exchange. How do they do it?
2  Bitcoin / Development & Technical Discussion / P2PKH hex to address on: May 20, 2021, 04:00:17 AM
I encountered an address that could not be converted during the process of transcoding the p2pkh address,Below is the transaction tx hash

Quote
4f1433d6433d3ce8a877519ba9ddc310dbee96dba939aca0dbef0176a3563436

I get the content of scriptpubkey hex
Quote
b'0804678afd04678afd75a820894eeb82f9a851f5d1cb1be3249f58bc8d259963832c5e7474a76f7 a859ee95c87'

Get the byte array of this hex

Quote
b'\x08\x04g\x8a\xfd\x04g\x8a\xfdu\xa8 \x89N\xeb\x82\xf9\xa8Q\xf5\xd1\xcb\x1b\xe3$\x9fX\xbc\x8d%\x99c\x83,^tt\xa7oz\x85\x9e\xe9\\\x87'

Which part of this hex is the public key? Isn't the address flag of p2pkh 0x00?
3  Bitcoin / Development & Technical Discussion / p2pk scriptpubkey conversion address on: May 18, 2021, 03:21:41 PM
Why can’t this txid get the correct address? Is there any way I can get the address

Quote
{'txid': '4775e10df3521f1b9320b3ae9a7305b016078767000d9a7fff0c42f8dc0bdd9b', 'hash': '4775e10df3521f1b9320b3ae9a7305b016078767000d9a7fff0c42f8dc0bdd9b', 'version': 1, 'size': 234, 'vsize': 234, 'weight': 936, 'locktime': 0, 'vin': [{'txid': '130d9f30ec833b4f1917339c58a857063c8f9380599e453d9a29eabc5323f57a', 'vout': 0, 'scriptSig': {'asm': '30450220448f442347d3b47b6f72659c94407c01e2ce8c11db51a3c7095651ec202f2aeb022100b 65196d9a8f2923c5905f903e02643c25b14d983b0c0c88392d8e2b2d6011af1[ALL]', 'hex': '4830450220448f442347d3b47b6f72659c94407c01e2ce8c11db51a3c7095651ec202f2aeb02210 0b65196d9a8f2923c5905f903e02643c25b14d983b0c0c88392d8e2b2d6011af101'}, 'sequence': 4294967295}], 'vout': [{'value': 20.74189877, 'n': 0, 'scriptPubKey': {'asm': '04a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e970 586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5 OP_CHECKSIG', 'hex': '4104a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e9 70586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5ac', 'type': 'pubkey'}}, {'value': 0.05, 'n': 1, 'scriptPubKey': {'asm': 'OP_DUP OP_HASH160 06a83fbdd5df3ecd783f9506807511af3d866863 OP_EQUALVERIFY OP_CHECKSIG', 'hex': '76a91406a83fbdd5df3ecd783f9506807511af3d86686388ac', 'reqSigs': 1, 'type': 'pubkeyhash', 'addresses': ['1cCcJ9zs4aCysVH6hmDuSasazXnmmKYtM']}}], 'hex': '01000000017af52353bcea299a3d459e5980938f3c0657a8589c3317194f3b83ec309f0d1300000 000494830450220448f442347d3b47b6f72659c94407c01e2ce8c11db51a3c7095651ec202f2aeb 022100b65196d9a8f2923c5905f903e02643c25b14d983b0c0c88392d8e2b2d6011af101fffffff f0235a0a17b00000000434104a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d3 8637b83fbcdc115a5d6e970586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5ac404 b4c00000000001976a91406a83fbdd5df3ecd783f9506807511af3d86686388ac00000000', 'blockhash': '000000000000008c8471e40400e6ed162cf2efeb132735e043316f29c3e72f39', 'confirmations': 439642, 'time': 1372800859, 'blocktime': 1372800859}


I tried to write a lot of code, but still can’t get the correct address. I want to know if there is any way to get the correct address,I spent a lot of time on this issue, hoping to get a little hint, thank you very much.
Code:
# coding:utf-8
from bip32utils import Base58
import bech32
from hashlib import *
from base58 import *
import base58
import binascii


def hashStr(buffer):
    return binascii.hexlify(buffer)

def SHA256D(bstr):
    return sha256(sha256(bstr).digest()).digest()

def ConvertPKHToAddress(prefix, addr):
    data = prefix + addr
    return b58encode(data + SHA256D(data)[:4])

def PubkeyToAddress(pubkey_hex):
    pubkey = bytearray.fromhex(pubkey_hex)
    round1 = sha256(pubkey).digest()
    h = new('ripemd160')
    h.update(round1)
    pubkey_hash = h.digest()
    return ConvertPKHToAddress(b'\x00', pubkey_hash)


print(PubkeyToAddress('4104a39b9e4fbd213ef24bb9be69de4a118dd0644082e47c01fd9159d38637b83fbcdc115a5d6e970586a012d1cfe3e3a8b1a3d04e763bdc5a071c0e827c0bd834a5ac'))
b'16SvHaiZXXgoBxAvZPo36zsyuAxLK1qECy'


4  Bitcoin / Development & Technical Discussion / python scriptpubkey OP_CHECKMULTISIG to address on: May 17, 2021, 03:09:21 PM
Please forgive me, I posted a request for help in another section, maybe I posted it in the wrong place, no one responded, so I posted it here, I hope I can get some help,   Hello everyone, I am new to Bitcoin, I have a problem and need help, first of all, thank you, the following is my question:
I tried to use the following code to convert the scriptPubKey in the Bitcoin transaction to an address, but why p2sh cannot be converted?

Code:
def hashStr(buffer):
    return binascii.hexlify(buffer)


def SHA256D(bstr):
    return sha256(sha256(bstr).digest()).digest()

def ConvertPKHToAddress(prefix, addr):
    data = prefix + addr
    return b58encode(data + SHA256D(data)[:4])

def PubkeyToAddress(pubkey_hex):
    pubkey = pubkey_hex
    round1 = sha256(pubkey.encode("utf8")).digest()
    h = new('ripemd160')
    h.update(round1)
    pubkey_hash = h.digest()
    return ConvertPKHToAddress(b'\x00', pubkey_hash)


def cover_address(script_pub_key):
    script_pub_key_str=hashStr(script_pub_key)
    if script_pub_key_str[0:4]==b'76a9':
        #This is a pubkeyhash
        bytes=script_pub_key[2]  #number of bytes in the pub_key
        try:
            assert bytes==20
        except:
            return None
        public_key = script_pub_key[3:3+bytes] #20 bytes
        z=b'\00'+public_key
        #checksum=sha256(sha256(z))[:4]
        #address1=base58.b58encode(z + checksum)
        address2=base58.b58encode_check(z)   # adds checksum for you
        return format(address2.decode())
    elif script_pub_key_str[0:2]==b'a9':
        #this is a scripthash (pay-to-script address)
        bytes=script_pub_key[1]  #number of bytes in the pub_key
        try:
            assert bytes==20
        except:
            return None
        public_key = script_pub_key[2:2+bytes] #20 bytes
        z=b'\05'+public_key  #used for mainnet
        address2=base58.b58encode_check(z)
        return address2.decode()
    elif script_pub_key_str[0:2]==b'00':
        spk = binascii.unhexlify(script_pub_key_str.decode())
        version = spk[0] - 0x50 if spk[0] else 0
        program = spk[2:]
        return bech32.encode('bc', version, program)
    else:
        #print(script_pub_key_str)
        return None

I want to convert the following p2sh scriptpubkey to an address, but I don’t know how to do it, the following is the transaction I want to  convert
Quote
{'txid': 'ca0cae6cd13e9150757612b1a3ea2e0e2d990d31098252892d032ffa73fc4f83', 'hash': 'ca0cae6cd13e9150757612b1a3ea2e0e2d990d31098252892d032ffa73fc4f83', 'version': 1, 'size': 205, 'vsize': 205, 'weight': 820, 'locktime': 0, 'vin': [{'txid': '05a9f3f1ed8099af7f37f818ce92442a1dccf9b471375bcb7dd4771db8080361', 'vout': 0, 'scriptSig': {'asm': '0 3045022041a325a85809d9b0c14b7858d8a7169f6dd847d41dbf342bfb745d76d15699c1022100c d6e77a8c3ffb95372d5ea716e0522efe121f253cf2381fd1d004204a8feeee7[ALL]', 'hex': '00483045022041a325a85809d9b0c14b7858d8a7169f6dd847d41dbf342bfb745d76d15699c1022 100cd6e77a8c3ffb95372d5ea716e0522efe121f253cf2381fd1d004204a8feeee701'}, 'sequence': 4294967295}], 'vout': [{'value': 1.999, 'n': 0, 'scriptPubKey': {'asm': '1 037953dbf08030f67352134992643d033417eaa6fcfb770c038f364ff40d761588 0002d4a196263b56e24c40a87f4f5adc89b74a17712cc540c20135fc50a2403937 2 OP_CHECKMULTISIG', 'hex': '5121037953dbf08030f67352134992643d033417eaa6fcfb770c038f364ff40d761588210002d4a 196263b56e24c40a87f4f5adc89b74a17712cc540c20135fc50a240393752ae', 'type': 'nonstandard'}}], 'hex': '0100000001610308b81d77d47dcb5b3771b4f9cc1d2a4492ce18f8377faf9980edf1f3a90500000 0004a00483045022041a325a85809d9b0c14b7858d8a7169f6dd847d41dbf342bfb745d76d15699 c1022100cd6e77a8c3ffb95372d5ea716e0522efe121f253cf2381fd1d004204a8feeee701fffff fff01603bea0b00000000475121037953dbf08030f67352134992643d033417eaa6fcfb770c038f 364ff40d761588210002d4a196263b56e24c40a87f4f5adc89b74a17712cc540c20135fc50a2403 93752ae00000000', 'blockhash': '00000000000002b211876fa753c8bf5c3b4f43198c6a20d91b26cd1ed5b71918', 'confirmations': 471187, 'time': 1355895514, 'blocktime': 1355895514}



Thank you so much for taking the time to read.
5  Bitcoin / Bitcoin Technical Support / python scriptpubkey OP_CHECKMULTISIG to address on: May 17, 2021, 06:28:24 AM
Hello everyone, I am new to Bitcoin, I have a problem and need help, first of all, thank you, the following is my question:
I tried to use the following code to convert the scriptPubKey in the Bitcoin transaction to an address, but why p2sh cannot be converted? Is there a similar python package that can be converted to an address by drinking it directly

Code:
def cover_address(script_pub_key):
    script_pub_key_str=hashStr(script_pub_key)
    if script_pub_key_str[0:4]==b'76a9':
        #This is a pubkeyhash
        bytes=script_pub_key[2]  #number of bytes in the pub_key
        try:
            assert bytes==20
        except:
            return None
        public_key = script_pub_key[3:3+bytes] #20 bytes
        z=b'\00'+public_key
        #checksum=sha256(sha256(z))[:4]
        #address1=base58.b58encode(z + checksum)
        address2=base58.b58encode_check(z)   # adds checksum for you
        return format(address2.decode())
    elif script_pub_key_str[0:2]==b'a9':
        #this is a scripthash (pay-to-script address)
        bytes=script_pub_key[1]  #number of bytes in the pub_key
        try:
            assert bytes==20
        except:
            return None
        public_key = script_pub_key[2:2+bytes] #20 bytes
        z=b'\05'+public_key  #used for mainnet
        address2=base58.b58encode_check(z)
        return address2.decode()
    elif script_pub_key_str[0:2]==b'00':
        spk = binascii.unhexlify(script_pub_key_str.decode())
        version = spk[0] - 0x50 if spk[0] else 0
        program = spk[2:]
        return bech32.encode('bc', version, program)
    else:
        #print(script_pub_key_str)
        return None
I want to convert the following into an address, but the address cannot be resolved using the above method. What is wrong?

Code:
{'txid': 'ca0cae6cd13e9150757612b1a3ea2e0e2d990d31098252892d032ffa73fc4f83', 'hash': 'ca0cae6cd13e9150757612b1a3ea2e0e2d990d31098252892d032ffa73fc4f83', 'version': 1, 'size': 205, 'vsize': 205, 'weight': 820, 'locktime': 0, 'vin': [{'txid': '05a9f3f1ed8099af7f37f818ce92442a1dccf9b471375bcb7dd4771db8080361', 'vout': 0, 'scriptSig': {'asm': '0 3045022041a325a85809d9b0c14b7858d8a7169f6dd847d41dbf342bfb745d76d15699c1022100cd6e77a8c3ffb95372d5ea716e0522efe121f253cf2381fd1d004204a8feeee7[ALL]', 'hex': '00483045022041a325a85809d9b0c14b7858d8a7169f6dd847d41dbf342bfb745d76d15699c1022100cd6e77a8c3ffb95372d5ea716e0522efe121f253cf2381fd1d004204a8feeee701'}, 'sequence': 4294967295}], 'vout': [{'value': 1.999, 'n': 0, 'scriptPubKey': {'asm': '1 037953dbf08030f67352134992643d033417eaa6fcfb770c038f364ff40d761588 0002d4a196263b56e24c40a87f4f5adc89b74a17712cc540c20135fc50a2403937 2 OP_CHECKMULTISIG', 'hex': '5121037953dbf08030f67352134992643d033417eaa6fcfb770c038f364ff40d761588210002d4a196263b56e24c40a87f4f5adc89b74a17712cc540c20135fc50a240393752ae', 'type': 'nonstandard'}}], 'hex': '0100000001610308b81d77d47dcb5b3771b4f9cc1d2a4492ce18f8377faf9980edf1f3a905000000004a00483045022041a325a85809d9b0c14b7858d8a7169f6dd847d41dbf342bfb745d76d15699c1022100cd6e77a8c3ffb95372d5ea716e0522efe121f253cf2381fd1d004204a8feeee701ffffffff01603bea0b00000000475121037953dbf08030f67352134992643d033417eaa6fcfb770c038f364ff40d761588210002d4a196263b56e24c40a87f4f5adc89b74a17712cc540c20135fc50a240393752ae00000000', 'blockhash': '00000000000002b211876fa753c8bf5c3b4f43198c6a20d91b26cd1ed5b71918', 'confirmations': 471187, 'time': 1355895514, 'blocktime': 1355895514}
6  Bitcoin / Development & Technical Discussion / Bitcoin rpc gradually slows down on: April 17, 2021, 08:18:59 AM
I use python3 to call the getrawtransaction interface of bitcoin rpc. Why does the query return time take longer and longer? The system load and disk IO are not too high load。
7  Bitcoin / Development & Technical Discussion / How to get multiple addresses belonging to the same person on: December 24, 2020, 07:36:31 AM
Regarding the seed wallet, I would like to know how to obtain these addresses are related and belong to one person? I have seen many blockchain browsers automatically recognize that the wallet address belongs to the same person. How is this done?
8  Bitcoin / Development & Technical Discussion / How to delete unconfirmed transactions in Bitcoin mempool on: December 22, 2020, 01:29:47 AM
I executed bitcoin-cli getrawmempool and listed many records. I want to delete one of them. Is there a way to do this?
9  Bitcoin / Development & Technical Discussion / How to get unconfirmed transactions? on: December 14, 2020, 07:44:07 AM
I have built a bitcoind node service. I want to quickly obtain unconfirmed transactions from the block and perform analysis. I read the vin and vout in the block and cannot know which are unconfirmed transactions. I need to build a btc Mining pool to quickly get unconfirmed transactions?
10  Bitcoin / Development & Technical Discussion / btc rpc how to get the output address on: November 17, 2020, 11:48:38 AM
I am learning the transfer structure of Bitcoin's blockchain. I have encountered a problem and I hope to get help. First of all, thank you. I want to analyze the UTXO transfer in and out of a block, but the following json does not tell Which address did I transfer to, and how do I know which address the expense was transferred to? Why didn't I see vout['scriptPubKey']['addresses'],In the following message'value': Decimal('49.98000000'), how can I know where the 49 BTC went?


{'txid': 'a64be218809b61ac67ddc7f6c7f9fbebfe420cf75fe0318ebc727f060df48b37',
 'hash': 'a64be218809b61ac67ddc7f6c7f9fbebfe420cf75fe0318ebc727f060df48b37', 'version': 1, 'size': 276, 'vsize': 276,
 'weight': 1104, 'locktime': 0, 'vin': [
    {'txid': '131f68261e28a80c3300b048c4c51f3ca4745653ba7ad6b20cc9188322818f25', 'vout': 1, 'scriptSig': {
        'asm': '3045022100ef78daeb60d6332fa6f91ee93d95486d8601b5f2c1d1dc77633801dc6c0eb41902201 5b19e34de00ae729e20b97de8ac58ea8bb9227ba91a33bfaa26b7480e8a0005[ALL]',
        'hex': '483045022100ef78daeb60d6332fa6f91ee93d95486d8601b5f2c1d1dc77633801dc6c0eb419022 015b19e34de00ae729e20b97de8ac58ea8bb9227ba91a33bfaa26b7480e8a000501'},
     'sequence': 4294967295}], 'vout': [{'value': Decimal('0.01000000'), 'n': 0, 'scriptPubKey': {
    'asm': '041d1ffff1175ce4628ed11b4074956a3f0facc95ab388e47b95daa02891f6e0b9642d4ae2b68c0 787d2c95288ec42045a087c262d803b6fa14ecedb2a632f3df1 OP_CHECKSIG',
    'hex': '41041d1ffff1175ce4628ed11b4074956a3f0facc95ab388e47b95daa02891f6e0b9642d4ae2b68 c0787d2c95288ec42045a087c262d803b6fa14ecedb2a632f3df1ac',
    'type': 'pubkey'}}, {'value': Decimal('49.98000000'), 'n': 1, 'scriptPubKey': {
    'asm': '04f9804cfb86fb17441a6562b07c4ee8f012bdb2da5be022032e4b87100350ccc7c0f4d47078b06 c9d22b0ec10bdce4c590e0d01aed618987a6caa8c94d74ee6dc OP_CHECKSIG',
    'hex': '4104f9804cfb86fb17441a6562b07c4ee8f012bdb2da5be022032e4b87100350ccc7c0f4d47078b 06c9d22b0ec10bdce4c590e0d01aed618987a6caa8c94d74ee6dcac',
    'type': 'pubkey'}}],
 'hex': '0100000001258f81228318c90cb2d67aba535674a43c1fc5c448b000330ca8281e26681f1301000 00049483045022100ef78daeb60d6332fa6f91ee93d95486d8601b5f2c1d1dc77633801dc6c0eb4 19022015b19e34de00ae729e20b97de8ac58ea8bb9227ba91a33bfaa26b7480e8a000501fffffff f0240420f00000000004341041d1ffff1175ce4628ed11b4074956a3f0facc95ab388e47b95daa0 2891f6e0b9642d4ae2b68c0787d2c95288ec42045a087c262d803b6fa14ecedb2a632f3df1ac806 de72901000000434104f9804cfb86fb17441a6562b07c4ee8f012bdb2da5be022032e4b87100350 ccc7c0f4d47078b06c9d22b0ec10bdce4c590e0d01aed618987a6caa8c94d74ee6dcac00000000',
 'blockhash': '0000000049a63b4dda3a43450c19d085d6c28bfb4cbb2e0576815d7f31919c5d', 'confirmations': 654530,
 'time': 1233636459, 'blocktime': 1233636459}
11  Alternate cryptocurrencies / Altcoin Discussion / The problem with electrumx on: October 12, 2020, 03:16:32 AM
Electrumx monitors btc very well, but does eth have the same open source tools for electrumx?
12  Bitcoin / Development & Technical Discussion / scripthash to address on: July 09, 2020, 03:48:47 AM
Maybe I don’t have a special understanding of the principles of Bitcoin, but I’m working hard to learn. I currently read the electrumx rosksdb directly. It seems that electrumx stores scripthash, but I want to get all the wallet addresses, a lot of BTC explorer How did they get the wallet address? electrumx's database does not store scriptPubKey,I have used electrumx to synchronize all the data, but I can’t get all the addresses because the scripthash is stored
13  Bitcoin / Development & Technical Discussion / I want to use RPC to get all historical transactions of an address on: June 23, 2020, 03:07:38 PM
I want to use RPC to get all historical transactions of an address,I have synchronized the full node on my computer. Below is the configuration of my bitcoin.conf

Code:
blockfilterindex=1
datadir=/opt/bitcoin/bitcoin-data
dbcache=10240
txindex=1
reindex=1
rpcuser=xxx
rpcpassword=xxx
daemon=1
server=1
rest=1
rpcbind=0.0.0.0:8332
rpcallowip=0.0.0.0/0
deprecatedrpc=accounts

But the result I return using listtransactions is empty
Code:
root@ubuntu:/opt/bitcoin/bitcoin-data# bitcoin-cli listtransactions "1L671pxzdY9dzEayZ9yEfUVWAoGsq99PoC"
[]

I don’t know what I did wrong, I just want to synchronize a full node locally, can query all historical transaction records of any specified address, thank you for your help

14  Local / 跳蚤市场 / 买 tenx pay 跌安逸了 on: August 19, 2018, 03:45:08 PM
买 tenx pay 跌安逸了,8元入手 现在3块。。跌的我嗷嗷了。 tenxpay 太不靠谱了 真是空气

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~··

为了求生存 卖自己家里种的 新疆库尔勒香梨
/新疆阿克苏苹果 全国包邮

感兴趣加微信 1138284969
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!