Author

Topic: How do you download a specific block number ? (Read 963 times)

staff
Activity: 4326
Merit: 8951
January 07, 2015, 01:24:44 PM
#9
There is no facility to directly do this in the Bitcoin protocol, nor is there ever likely to be. The Bitcoin network is not a free file server, nodes provide data to other nodes for facilitating the operation of the Bitcoin system-- and normal operation has no need for a lookup by height.

You should run your own node and then you can trivially query it over the json rpc (or rest in Bitcoin v0.10).
newbie
Activity: 24
Merit: 0
Without a local copy your only option is to use getdata since I doubt that an online block explorer would let you download 10000 blocks.


How do you access the raw protocol? I'm not familiar with this.

Bitcore, A pure JavaScript Bitcoin library.

Code:
var bitcore = require('bitcore');
var Messages = bitcore.transport.Messages;
var Peer = bitcore.transport.Peer;
var Block = bitcore.Block;
var peer = new Peer('xxx.xxx.xxx.xxx');

peer.on('block',function(message){
console.log(message.block.toObject());
);

var v = [];
v.push({
type: 2,
hash: new Buffer(...)
});

var message = new Messages.GetData(v);
peer.sendMessage(message);
sr. member
Activity: 467
Merit: 267
I don't know any tool that does that out of the box - I think you will need to write it yourself. Sorry
newbie
Activity: 3
Merit: 0
Without a local copy your only option is to use getdata since I doubt that an online block explorer would let you download 10000 blocks.


How do you access the raw protocol? I'm not familiar with this.
sr. member
Activity: 467
Merit: 267
I tried getblock "hash", but it seems like I can only get block that I already have in my disk, I want to get this function working without downloading the whole blockchain. Is there any way to connect to some kind of server and use this method on this server ?

TL;DR, I want to compile my own bootstrap.dat file that contain only blocks from a specific block number for example only blocks between 130000 and 140000, all this without having the blockchain in my hard drive.
Without a local copy your only option is to use getdata since I doubt that an online block explorer would let you download 10000 blocks.
newbie
Activity: 3
Merit: 0
Yes, by their hashes using getdata in the raw protocol or getblock in the client.


I tried getblock "hash", but it seems like I can only get block that I already have in my disk, I want to get this function working without downloading the whole blockchain. Is there any way to connect to some kind of server and use this method on this server ?

TL;DR, I want to compile my own bootstrap.dat file that contain only blocks from a specific block number for example only blocks between 130000 and 140000, all this without having the blockchain in my hard drive.
legendary
Activity: 1386
Merit: 1053
Please do not PM me loan requests!
You can download the details of a specific block in human-readable form from a block explorer, such as blockchain.info or blockr.io etc.
sr. member
Activity: 467
Merit: 267
Yes, by their hashes using getdata in the raw protocol or getblock in the client.
newbie
Activity: 3
Merit: 0
I want to know if there is a way to download specific block numbers without download the whole blockchain.

Edit: I know that I can use bitcoin client with getblock "hash" function, but this require that the block with that "hash" to be in the hard drive, which I don't. So I'm looking for a similar function of getblock "hash" which doesn't require block to be in the hard drive, but instead it download it from some server or other peers.
Jump to: