I just need to parse a private node and lookup one bitcoin address and get all transactions going in or out of the address preferably using nodeJS within the last 200 or so blocks. Any recommendations?
1 Answer
This question is pretty broad as parsing a node involves decoding every transaction within a block(which would require txindex
to be enabled), and recording each output and input until you end up with a list of all outputs that have not been used as an input aka an unspent output.
With a fully synced node and txindex=1
you can begin iterating through each block of the last 200 blocks with loops using the rpc calls getblockhash
getblock
getrawtransaction
and decoderawtransaction
, storing the outputs in a database. On each new block you should check every input to see if there is a transaction id matching an output in your existing output database, if there is that output has been spent. The node-bitcoin JSON-RPC wrapper should work fine for implementing these calls to your node. As you can imagine this would take some time.
-
1Can you explain what "parsing a node" means here? Sounds like you mean something like parsing every block in the blockchain? Apr 23, 2019 at 23:22