3

My dev environment is quite limited in terms of bandwidth and storage. I need to make a database out of transactions containing opcode 0x6a since a given epoch.

[Scan blocks, going backwards from the latest, until a given blockheight]
[If the transaction outputs contain OP_RETURN, save it with associated metadata]

Is there a way I can do this with bitcoind without having to store the entire chain?

1

You could use the pruning mode to only store blocks after the height you are interested in. I think you'll still have to download it to verify the past history, but you won't have to store it all on disk.

See this RPC call for more information.

1

Currently-released version of Bitcoin Core will only process blocks sequentially starting from the beginning of the chain. If that happens to be the beginning of your epoch, you can start recent versions of bitcoind with the -stopatheight parameter to specify the end of your epoch and bitcoind will stop downloading blocks at that point.

Alternatively, a pending Bitcoin Core pull request (PR) provides the behavior you want where you can tell Bitcoin Core not to download any blocks automatically and then manually specify which blocks you want. See PR#10794 for details.

Note that if you operate in this mode connected directly to the peer-to-peer network, your node will only have SPV-level security, meaning someone could theoretically give your node an invalid block with a valid amount of proof of work. If you require a high degree of security, it would be recommend that you exclusively connect your bitcoind running PR#10794 to one of your own fully-validating (regular) bitcoind nodes so that will ensure you only receive valid blocks. To do that, see the -connect option to bitcoind.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.