Author

Topic: Is it possible to download a block manually? (Read 777 times)

legendary
Activity: 3906
Merit: 6249
Decentralization Maximalist
April 24, 2016, 10:35:50 PM
#6
Thanks knightdk and amaclin! Both answers are of great help to me.

I will dive a bit into the article about messages and look at the Bitcoin sniffer code too, so I get an idea about the process to download the blocks and if it's feasible for me to write such a simple "block-downloader-script".
legendary
Activity: 1260
Merit: 1019
I'm more interested in the process than in the result.
Have a look
https://github.com/sebicas/bitcoin-sniffer
staff
Activity: 3458
Merit: 6793
Just writing some code
I forgot to mention that in fact, I would like to download the block from the real Bitcoin network, that means to connect to another client and download it from there. I'm more interested in the process than in the result.
You would need to have a program that can send all of the Bitcoin network messages. You would first need to go through the handshake process and then request whatever block you want from another node. There is more info on the network messages here: https://bitcoin.org/en/developer-reference#p2p-network.

First, to start the handshake, you need to connect to another node and send them a version message. Then that node will respond with a verack message and a version. You must respond to the version with a verack. If you want to keep the connection alive, you need to be able to handle ping and pong messages as well. Then you can request blocks using the getblocks message and the getdata message to download the blocks.
legendary
Activity: 3906
Merit: 6249
Decentralization Maximalist
With "manually" I mean to download it with, for example, Linux shell commands, or a simple Python script.

curl https://webbtc.com/block/000000000000000003d687c4f4e88b7ab642991fc9c2174aa1401477c3b865f9.bin

Using a blockchain explorer is a possibility I didn't consider.

I forgot to mention that in fact, I would like to download the block from the real Bitcoin network, that means to connect to another client and download it from there. I'm more interested in the process than in the result.

Thanks anyway!
legendary
Activity: 1260
Merit: 1019
With "manually" I mean to download it with, for example, Linux shell commands, or a simple Python script.

curl https://webbtc.com/block/000000000000000003d687c4f4e88b7ab642991fc9c2174aa1401477c3b865f9.bin
legendary
Activity: 3906
Merit: 6249
Decentralization Maximalist
I am curious if there is a method to download a single block from the blockchain manually.

With "manually" I mean to download it with, for example, Linux shell commands, or a simple Python script.

I'm not expecting a tutorial obviously, as this surely is a bit "strange" question. I am no Bitcoin expert nor really a coder (so I cannot dive into the code and extract the needed information) , but I understand a bit of technical documentation, so if there is documentation for (at least some of) the needed steps probably a link to it will be all I need. It is mainly because I want to understand the system a bit better.

(I have already googled this topic and found only this, but it's a bit rudimentary).
Jump to: