blockchain – Is it doable to get bitcoin handle from Jan 2010 that also has stability and by no means ship out transactions?

0
3
blockchain – Is it doable to get bitcoin handle from Jan 2010 that also has stability and by no means ship out transactions?


You should utilize node RPCs: getblockhash, getblock and gettxout for this. See instance under.

First, name bitcoin-cli getblockhash 871951, which is able to return the block’s hash: 0000000000000000000233611afd0d00f1e874d8f962c94bdebf40975432b95e

Then, by utilizing bitcoin-cli getblock 0000000000000000000233611afd0d00f1e874d8f962c94bdebf40975432b95e 2 you’ll get the block’s content material in JSON format. You possibly can then use some JSON parser (e.g. jq command-line instrument) to filter simply the coinbase transaction (which would be the 1st transaction within the tx array):

{
  "txid": "9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812",
  "hash": "76e359604e2aab1aa5e47829014f78bcbd0b89bd1ad5065f284b7ea44a2c146b",
  "model": 2,
  "dimension": 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 just the txid and vout.n fields to generate a list of transaction outputs to check, e.g.:

9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812,0
9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812,1
9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812,2
9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812,3

Then, for each one you can call gettxout, e.g. bitcoin-cli gettxout 9f71b8f4724ead5fa8521e1511867f599064c55237e374c013a5a30ec99be812 0 and if the result prints anything then the TXO has not been spent yet. If nothing is printed then it has been spent already.

Result will look like this:

{
  "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 could be easily automated to process the block range you’re interested in.

LEAVE A REPLY

Please enter your comment!
Please enter your name here