Bitcoin Forum
May 30, 2024, 10:24:10 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Is it possible to download a block manually?  (Read 754 times)
d5000 (OP)
Legendary
*
Offline Offline

Activity: 3934
Merit: 6396


Decentralization Maximalist


View Profile
April 24, 2016, 09:53:18 AM
 #1

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

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
April 24, 2016, 11:11:22 AM
 #2

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
d5000 (OP)
Legendary
*
Offline Offline

Activity: 3934
Merit: 6396


Decentralization Maximalist


View Profile
April 24, 2016, 01:14:12 PM
 #3

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!

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
achow101
Moderator
Legendary
*
Offline Offline

Activity: 3402
Merit: 6659


Just writing some code


View Profile WWW
April 24, 2016, 02:46:46 PM
 #4

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.

amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
April 24, 2016, 04:15:00 PM
 #5

I'm more interested in the process than in the result.
Have a look
https://github.com/sebicas/bitcoin-sniffer
d5000 (OP)
Legendary
*
Offline Offline

Activity: 3934
Merit: 6396


Decentralization Maximalist


View Profile
April 25, 2016, 03:35:50 AM
 #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".

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!