Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: MixMAx123 on March 23, 2019, 10:13:02 PM



Title: I do not understand a part of the GETDATA message correctly.
Post by: MixMAx123 on March 23, 2019, 10:13:02 PM
Hello

I do not understand a part of the GETDATA message correctly.

0x01010000405e6f372d50cde73484916321fcef5549b62d7b00317aa36c4fe3f40be2a78ad4

01 01000040 5e6f372d50cde73484916321fcef5549b62d7b00317aa36c4fe3f40be2a78ad4

01 = the number of line in the array. OK
01000040  = do not quite understand this part ???
5e6f372d50cde73484916321fcef5549b62d7b00317aa36c4fe3f40be2a78ad4 = The Tx hash code. OK


01000040 These 4 bytes should actually be (as in the "inv" the hash code type.)
But in the Protocoll documentation only hashcode type 01,02,03,04 is described. Where does the 04 come from?

Many Thanks


Title: Re: I do not understand a part of the GETDATA message correctly.
Post by: Coding Enthusiast on March 23, 2019, 10:53:06 PM
Bitcoin has one of the best documentations but unfortunately it is not updated regularly with new changes. I've been updating it as I go through things but haven't reached that part yet.

To answer your question you have to look at bitcoin-core's code: https://github.com/bitcoin/bitcoin/blob/3f125151998d9fead198fd44243dd64006b5a56b/src/protocol.h#L380
Which is addition of MSG_TX (=1) and MSG_WITNESS_FLAG (=1 << 30) which is basically giving you this:
0b01000000_00000000_00000000_00000001


Title: Re: I do not understand a part of the GETDATA message correctly.
Post by: MixMAx123 on March 23, 2019, 11:11:06 PM
many thanks :-)

Is there any other documentation with this information except in the code itself?


Title: Re: I do not understand a part of the GETDATA message correctly.
Post by: Coding Enthusiast on March 23, 2019, 11:17:18 PM
I know two which are pretty much equal but sometimes have little differences:
- The developer's documentation: https://bitcoin.org/en/developer-reference (you can edit this on GitHub if you find something wrong or missing)
- Bitcoin wiki: https://en.bitcoin.it/wiki/Protocol_documentation


Title: Re: I do not understand a part of the GETDATA message correctly.
Post by: MixMAx123 on March 23, 2019, 11:25:58 PM
Unfortunately, I could not find this "Wittnes flag" in both.

But now I know it. Thanks for the quick help.  :)

I am currently writing a JSON message parser. For that I needed the information.

Thanks  :)


Title: Re: I do not understand a part of the GETDATA message correctly.
Post by: darosior on March 24, 2019, 01:23:04 PM
Unfortunately, I could not find this "Wittnes flag" in both.

But now I know it. Thanks for the quick help.  :)

I am currently writing a JSON message parser. For that I needed the information.

Thanks  :)
Hi,

this flag is part of the services https://en.bitcoin.it/wiki/Protocol_documentation#version.