I am building my own bitcoin client, and I have most of the protocol working from https://en.bitcoin.it/wiki/Protocol_Specification.

I successfully make a connection with the version and verack commands. And when I send a ping, I get back a pong with the same nonce.

The problem I am having now is that I don't get the expected response to my getblocks message. I build the block locator using the hash of the genesis block header, and I serialize the message and send it.

But then I don't get the inv message with MSG_BLOCK like I expect.

These are the raw bytes that I send as my getblocks message:


This is built following the specification here https://en.bitcoin.it/wiki/Protocol_Specification#getblocks.

  • Your question got cut off!
    – kaoD
    Jan 14 '14 at 15:01
  • Should be fixed now.
    – yzernik
    Jan 14 '14 at 18:57
  • 1
    Just guessing: try reversing the order of char[32] of the hash. I'm doing offline blockchain analysis and it's stored as trailing zeroes, not leading.
    – kaoD
    Jan 14 '14 at 19:19

I actually do receive the inv message. The problem is in the way that I try to decode the inv message.

The getblocks message seems to work fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.