1

Obviously for the Bitcoin system to work, we need an information network on a global scale such as the Internet.

I am sorry if this is a stupid question.

What exact information protocol is being used? Obviously something that sits on top of TCP/IP, but what exactly?

It is these first levels of software that on top of TCP/IP that I am interested...

2

Bitcoin uses its own wire protocol, which is based on TCP. It's quite simple, with each packet type having strict rules for conformity and a checksum. New objects (transactions and blocks) are flooded through the network to all peers with a flag indicating they want that information, along with auxiliary messages like peer addresses and pings. No encryption is used for any connection.

https://bitcoin.org/en/developer-reference#p2p-network

2

It's a fairly simple custom protocol. You can find details at https://en.bitcoin.it/wiki/Protocol_documentation, but the messages use this general form:

  • magic, 4 bytes, uint32_t: Magic value indicating message origin network, and used to seek to next message when stream state is unknown
  • command, 12 bytes, char[12]: ASCII string identifying the packet content, NULL padded (non-NULL padding results in packet rejected)
  • length, 4 bytes, uint32_t: Length of payload in number of bytes
  • checksum, 4 bytes, uint32_t: First 4 bytes of sha256(sha256(payload))
  • payload, variable length, uchar[]: The actual data

The "inv" command is used to send notifications of new transactions and blocks around the network, and the "getdata" command is used to retrieve information about those transactions and blocks.

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.