Bitcoin Forum

Bitcoin => Bitcoin Technical Support => Topic started by: stav5 on May 12, 2019, 12:45:58 AM



Title: Version message not getting a response
Post by: stav5 on May 12, 2019, 12:45:58 AM
Hi
I'm in the beginning stages of learning the bitcoin protocol.
Ive been reading about the specification from here (https://en.bitcoin.it/wiki/Protocol_documentation).

So far i've made a small c program that generates a "version" message (of protocol version < 106) and sends it to another node via a socket.
But for whatever reason i'm not getting any response (i'm expecting a "verack" message).

I'm setting the following fields:


Header:
------------
[uint32_t] Magic value: 0xD9B4BEF9
[char[12]] Command: "version" (followed by 5 zero bytes of padding)
[uint32_t] Length: 46
[uint32_t] Checksum: 0xCDA4C5D9

Payload:
------------
[int32_t]   Version: 1
[uint64_t] Services: 0
[int64_t]   Timestamp: 1557620555
[uint64_t] Addr_recv->Services: 0
[char[16]] Addr_recv->IP (str): ::ffff:93.175.204.121 (i'm converting this to big endian before i send)
[uint16_t] Addr_recv->Port: 8333 (i'm converting this to big endian before i send)



Here (https://www.dropbox.com/s/3rk8elawc1wpcjm/version-dump.dat?dl=1) is a dump of the exact message im sending (24 byte header, 46 byte payload - 70 bytes total).

I was hoping maybe someone with experience in this area could look at it and tell me if there is something wrong with it?

I know this is kind of a wired thing to ask but i really dont know what else to do, i've been reading the protocol specification so many times now and i cant tell whats wrong.
Thanks for reading.


Title: Re: Version message not getting a response
Post by: achow101 on May 12, 2019, 12:59:11 AM
Protocol version 106 is incredibly old. Bitcoin Core (the most commonly used node software) will not respond to anything older than version 31800.

Why aren't you using the modern version message (which is largely the same format) with a higher version number?


Title: Re: Version message not getting a response
Post by: stav5 on May 12, 2019, 01:02:52 AM
Protocol version 106 is incredibly old. Bitcoin Core (the most commonly used node software) will not respond to anything older than version 31800.

Oh i didn't know that. On further inspection the node i was trying to contact (93.175.204.121) is indeed using bitcoin core, so that is probably the reason.
I will update my code to work with protocol version > 31800 and see if it works.

Thank you for the quick response :)


Title: Re: Version message not getting a response
Post by: Coding Enthusiast on May 12, 2019, 03:13:20 AM
Take a look at protocol versions and what they do here: https://bitcoin.org/en/developer-reference#protocol-versions