Node Handshake Content

Collected data from bitcoin.it, bitcoin.org, and bitcoinbook.git.
This commit is contained in:
Josh Green
2019-12-23 12:30:56 -05:00
committed by bitcoin
parent 48f022edfa
commit bd94f6118f
2 changed files with 39 additions and 3 deletions
+6 -2
View File
@@ -19,8 +19,12 @@ The node connection is not considered established until both nodes have sent and
| block height | 4 bytes | unsigned integer<sup>[(LE)](/protocol/misc/endian/little)</sup> | The height of the block with the highest height known to the sending node. |
| relay flag | 1 byte | boolean | Indicates whether the sending node would like all broadcasted transactions relayed to it. See [BIP-37](/protocol/forks/bip-0037). This flag is sometimes referred to as "fRelay". |
Note: appending extra data after the `relay flag` is ignored.
Historically, extra data after the `relay flag` would sometimes result in the connection being banned, although this is no longer standard behavior.
Note: Protocol version `70001` introduced the optional `relay flag`.
Transmitting the `relay flag` byte to Nodes with a version less than `70001` may result in incompatibility with versions that validate the Version message for a specific byte count.
Note: Historically, transmitting extra data after the `relay flag` would result in the connection being banned by some Nodes.
Modern Nodes ignore extra data after the `relay flag`.
## Version Number
+33 -1
View File
@@ -1 +1,33 @@
# Node Handshake
# Node Handshake
When nodes connect the issue a connection handshake in order to ensure compatibility between the two nodes.
The handshake informs the peer of its:
- Network Protocol Version
- Block Height
- Supported [Network Services](/protocol/network/messages/version#services-bitmask)
Either Node may then decide to disconnect from the peer.
Neither Node should send any data other than a [Version](/protocol/network/messages/version) message to the peer until it has also received a Version message.
Once a node has received (and sent) a Version message, it may send a [Verack](/protocol/network/messages/verack) message.
Once each Node has sent and received a Verack message, normal node operation may begin.
## Sequence Diagram
When a local Node initiates a connection to a remote Node, the remote Node will remain silent it receives a version message.
```
# SequenceDiagram
title Node Handshake
Local->>Remote: Sends Version Message
note right of Remote: Version Message contains Local's Version Number.
Remote->>Local: Sends Version Message
note left of Local: Version Message contains Remote's Version Number.
Remote->>Local: Sends Verack Message
note left of Local: Local uses the lower of the two Version Numbers, if compatible.
Local->>Remote: Sends Verack Message
note right of Remote: Remote uses the lower of the two Version Numbers, if compatible.
```