<p>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).</p>

<p>If you just want blocks for testing, you won't have much trouble finding <code>bootstrap.dat</code>s 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.</p>

CC BY-SA 4.0
2018-09-16T22:04:15.477Z
2018-09-16T22:04:15.477Z
Raghav Sood
<p>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 <a href="https://github.com/petertodd/python-bitcoinlib" rel="nofollow noreferrer">python-bitcoinlib</a> can be used to send the P2P messages necessary for doing this.</p>

CC BY-SA 4.0
2018-09-16T22:24:40.643Z
2018-09-16T22:24:40.643Z
Ava Chow
<p>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. </p>

<p>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)?</p>

<blockchain><testing>
Any idea how to download a small part of the chain for testing purposes?
thunderbiscuit
# Any idea how to download a small part of the chain for testing purposes?

(Asked by: username_0 on 2018-09-16)

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)?

**Tags:** blockchain, testing


---

## 2 answers

### Answer by username_2 on 2018-09-16. Score: 4 | Accepted answer

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](https://github.com/petertodd/python-bitcoinlib) can be used to send the P2P messages necessary for doing this.


---

### Answer by username_1 on 2018-09-16. Score: 2

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.dat`s 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.


---

