Peer Connection

Given an IP address of a Bitcoin node, a peer attempts to connect via a standard TCP connection on TCP port 8333. Once the TCP connection is established following the basic three-way TCP handshake, the connecting peers exchange version messages that contain (1) the client version number, (2) current block height, and (3) the current time. Both nodes acknowledge the version messages with a verack message in order to confirm that the session has been established.

Note that version messages advertise those addresses that are locally assigned with the highest scores.

Block Synchronisation

The genesis block (block 0) is the first block of the Bitcoin blockchain and is hardcoded in each Bitcoin node. Subsequent blocks are synchronized on the go; if a node has been off-line during a substantial amount of time (typically 24 hours), the block synchronization allows the node to catch up to the current tip of the longest blockchain. Recall that only peers that are tightly synchronised with the current blockchain can perform transaction and block validation.

The current Bitcoin implementation (version 0.10 upward) employs a block synchronization with headers-first. This process allows nodes to download the headers of all possible chains, determine the best chain based on the length and the difficulty of the block headers, and subsequently to download in parallel the actual block content once the main blockchain has been determined.

 
Source
< Prev   CONTENTS   Source   Next >