Created
May 23, 2015 16:15
-
-
Save obale/cbb57a9bf71d323e9629 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0 1 2 3 | |
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
| MagicNo (blockchain identifier) | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
|C|Pay-|Chec| Payload of dynamic length, e.g. | | |
|M|load|ksum| block, transaction or primitive value | | |
|D|Size| | | | |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | |
MagicNo : 32 Byte length : Uniquely identifies the blockchain | |
to which this package belongs. | |
CMD : 1 Byte length : Command flag that indicates the | |
purpose of this message. | |
Payload Size: 4 Byte length : The size of the payload in bytes. | |
Checksum : 4 Byte length : The first 4 bytes of the payload | |
hash. (TODO: Specify hashing | |
algorithm) | |
Command Specification (CMD field) | |
VERSION 0x00 Initiates the handshake, first package | |
send to a new node | |
VERSION_ACK 0x01 Response to the VERSION package and | |
finalizes the handshake | |
REQUEST_BLOCK 0x02 Periodical message to request a new block | |
BLOCK 0x04 Response to REQUEST_BLOCK request | |
TRX 0x08 Propagation of transaction | |
CONFIRM_TRX 0x10 Confirmation of a received transaction | |
GET_PEERS 0x20 Request all known nodes, related to a | |
specific blockchain | |
PEERS 0x40 Response to the GET_PEERS request with | |
a list of known nodes. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment