Blockchain – Can I get a Bitcoin address that still has a balance and hasn’t sent any transactions since January 2010?
You can use Node RPC. getblockhash
, getblock
and gettxout
For this. See example below.
Please call first. bitcoin-cli getblockhash 871951
Returns the hash of the block. 0000000000000000000233611afd0d00f1e874d8f962c94bdebf40975432b95e
Then bitcoin-cli getblock 0000000000000000000233611afd0d00f1e874d8f962c94bdebf40975432b95e 2
Get the content of the block in JSON format. You can then use some JSON parser, e.g. jq
Use a command line tool to filter only Coinbase transactions (which will be your first transaction). tx
array):
{
"txid": "9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812",
"hash": "76e359604e2aab1aa5e47829014f78bcbd0b89bd1ad5065f284b7ea44a2c146b",
"version": 2,
"size": 325,
"vsize": 298,
"weight": 1192,
"locktime": 0,
"vin": (
"coinbase": "030f4e0d04eeca44672f466f756e6472792055534120506f6f6c202364726f70676f6c642f40398451da2c000000000000",
"txinwitness": (
"0000000000000000000000000000000000000000000000000000000000000000"
),
"sequence": 4294967295
),
"vout": (
"value": 5.46e-06,
"n": 0,
"scriptPubKey":
"asm": "1 3daaca9b82a51aca960c1491588246029d7e0fc49e0abdbcc8fd17574be5c74b",
"desc": "rawtr(3daaca9b82a51aca960c1491588246029d7e0fc49e0abdbcc8fd17574be5c74b)#p35tdfgk",
"hex": "51203daaca9b82a51aca960c1491588246029d7e0fc49e0abdbcc8fd17574be5c74b",
"address": "bc1p8k4v4xuz55dv49svzjg43qjxq2whur7ync9tm0xgl5t4wjl9ca9snxgmlt",
"type": "witness_v1_taproot"
,
"value": 3.20244687,
"n": 1,
"scriptPubKey":
"asm": "0 7086320071974eef5e72eaa01dd9096e10c0383483855ea6b344259c244f73c2",
"desc": "addr(bc1qwzrryqr3ja8w7hnja2spmkgfdcgvqwp5swz4af4ngsjecfz0w0pqud7k38)#y9upg3rz",
"hex": "00207086320071974eef5e72eaa01dd9096e10c0383483855ea6b344259c244f73c2",
"address": "bc1qwzrryqr3ja8w7hnja2spmkgfdcgvqwp5swz4af4ngsjecfz0w0pqud7k38",
"type": "witness_v0_scripthash"
,
...
Then you can extract only the following: txid
and vout.n
This field generates a list of transaction outputs to check. yes:
9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812,0
9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812,1
9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812,2
9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812,3
You can then call about each one. gettxout
for example bitcoin-cli gettxout 9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812 0
If the result prints nothing, the TXO has not yet been used. If nothing is printed, it has already been spent.
The results are as follows:
"bestblock": "00000000000000000000349653eb5d146e6336ea9a95a7a8bcd3fac852f8c908",
"confirmations": 4,
"value": 3.20244687,
"scriptPubKey":
"asm": "0 7086320071974eef5e72eaa01dd9096e10c0383483855ea6b344259c244f73c2",
"desc": "addr(bc1qwzrryqr3ja8w7hnja2spmkgfdcgvqwp5swz4af4ngsjecfz0w0pqud7k38)#y9upg3rz",
"hex": "00207086320071974eef5e72eaa01dd9096e10c0383483855ea6b344259c244f73c2",
"address": "bc1qwzrryqr3ja8w7hnja2spmkgfdcgvqwp5swz4af4ngsjecfz0w0pqud7k38",
"type": "witness_v0_scripthash"
,
"coinbase": true
All of this can be easily automated to process the range of blocks of interest.