Any idea how to download a small part of the chain for testing purposes?

Any idea how to download a small part of the chain for testing purposes?



I am experimenting with Python and Rust libraries on my laptop. I don't actually want to get a node going on it and download the full chain; I just need some blocks to play with.



I want to keep my question general enough though; what is the easiest way for someone to download just a small portion of the blockchain, given specific beginning and end points in block numbers? Are there any libraries that would do that either in Python, JS, or Rust (or any other languages, so my question applies to all developers)?




2 Answers
2



If you know what hashes of the blocks you want, you can use the P2P protocol to connect to a node and request those specific blocks. However, you cannot just do that with block heights as the block's height is not a unique identifier for the block. There are many libraries available that can speak the P2P protocol. The python-bitcoinlib can be used to send the P2P messages necessary for doing this.



As far as I know, there is no way to download arbitrary blocks (although I suspect it's not too hard to do if you implement your own client).



If you just want blocks for testing, you won't have much trouble finding bootstrap.dats that contain a few hundred thousand blocks. Alternatively, you could just run bitcoin core for half an hour or so and get a few thousand blocks from the start of the chain - The early blocks are mostly empty and download pretty quick.


bootstrap.dat



Thanks for contributing an answer to Bitcoin Stack Exchange!



But avoid



To learn more, see our tips on writing great answers.



Required, but never shown



Required, but never shown




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

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)