Using bitcore-p2p to query specific block information


I’ve started using bitcore-p2p which works great. I’m working on a project that needs to validate remote full nodes, for that project I was wondering if I could use bitcore-p2p to query a certain full node for a specific block height/hash and get the details for that block.

Is that possible? I looked through the tests and could not find anything similar.


Hey Or,
Yes you can. There’s no example yet, but I’m working on it. I’ll link you to it when it’s ready.

For your information, you need to send a getdata message to the node, with the block hash.

Thanks for replying so quickly @maraoz. I’ll try and play around with it, looking forward for the example.

@orweinberger: look at this work in progress:

I couldn’t make it work with very old blocks (bitcoind doesn’t respond the getdata message for those). Maybe the block has to be in the mempool to be returned.
If you find any clues, please report!