Bitcoin Forum
December 15, 2024, 02:56:06 PM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How do you download a specific block number ?  (Read 955 times)
kamir.tamaatiii (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
January 06, 2015, 11:52:06 PM
Last edit: January 07, 2015, 01:11:29 PM by kamir.tamaatiii
 #1

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.
hhanh00
Sr. Member
****
Offline Offline

Activity: 467
Merit: 267


View Profile
January 07, 2015, 04:50:34 AM
 #2

Yes, by their hashes using getdata in the raw protocol or getblock in the client.

Taras
Legendary
*
Offline Offline

Activity: 1386
Merit: 1053


Please do not PM me loan requests!


View Profile WWW
January 07, 2015, 06:35:19 AM
 #3

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.
kamir.tamaatiii (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
January 07, 2015, 12:07:17 PM
 #4

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.
hhanh00
Sr. Member
****
Offline Offline

Activity: 467
Merit: 267


View Profile
January 07, 2015, 05:10:23 PM
 #5

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.

kamir.tamaatiii (OP)
Newbie
*
Offline Offline

Activity: 3
Merit: 0


View Profile
January 07, 2015, 05:15:56 PM
 #6

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.
hhanh00
Sr. Member
****
Offline Offline

Activity: 467
Merit: 267


View Profile
January 07, 2015, 05:31:57 PM
 #7

I don't know any tool that does that out of the box - I think you will need to write it yourself. Sorry

jimmyscratchlab
Newbie
*
Offline Offline

Activity: 24
Merit: 0


View Profile
January 07, 2015, 06:02:32 PM
 #8

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);
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4298
Merit: 8822



View Profile WWW
January 07, 2015, 06: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).
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!