May 22, 2023
Bitcoin is structured as a peer-to-peer network architecture on top of the Internet. The network nodes interconnect in a mesh network with a “flat” topology. There is no server, no centralized service, and no hierarchy within the network.
Bitcoin Network Node | |
---|---|
(W)allet | (M)iner |
Full (B)lockchain | (N)etwork Routing Node |
Mining nodes compete to create new blocks by running specialized hardware to solve the Proof-Of-Work algorithm.
The main bitcoin network, running the bitcoin P2P protocol, consists of between 5,000 and 8,000 listening nodes running various versions of the bitcoin reference client (Bitcoin Core) and a few hundred nodes running other implementations of the bitcoin P2P protocol, such as Bitcoin Classic.
Large companies utilize Bitcoin Core client-based full-node clients to interface with the bitcoin network. These nodes serve as network edge routers, enabling the development of services like exchanges, wallets, and block explorers. They maintain full copies of the blockchain and facilitate interactions with the network, without engaging in mining or wallet functions.
A bitcoin relay network is a network that attempts to minimize the latency in the transmission of blockers between miners.
Why is it needed?Bitcoin miners are engaged in a time-sensitive competition to solve the Proof-Of-Work problem and extend the blockchain. While participating in this competition, they must minimize the time between the propagation of a winning block and the beginning of the next round of competition.
They are like freeways (shortcuts between two points with heavy traffic), not a replacement for bitcoin’s P2P network.
When a new node boots up, it must discover other bitcoin nodes on the network in order to participate. To connect to a known peer, nodes establish a TCP connection, usually to port 8333. Upon establishing a connection, the node will start a “handshake” by transmitting a version message, which contains basic identifying information, including:
If the remote peer is compatible, the local peer will acknowledge the version message and establish a connection by sending a verack.
How does a new node find peers? The first method is to query DNS using a number of “DNS seeds”, which are DNS servers that provide a list of IP addresses of bitcoin nodes.
The Bitcoin Core client contains the names of five different DNS seeds. Once one or more connections are established, the new node will send an addr message containing its own IP address to its neighbors, ensuring the newly connected node becomes well known and better connected.
Paths are not reliable–nodes come and go–and so the node must continue to discover new nodes as it loses old connections as well as assist other nodes when they bootstrap.
Not all nodes have the ability to store the full blockchain, (smartphones, tablets, or embedded systems). As bitcoin adoption surges, the SPV node is becoming the most common form of bitcoin node, especially for bitcoin wallets.
SPV nodes download only the block headers and do not download the transactions included in each block.
The resulting chain of blocks, without transactions, is 1,000 times smaller than the full blockchain. SPV nodes cannot construct a full picture of all the UTXOs that are available for spending because they do not know about all the transactions on the network.
SPV nodes verify transactions using a slightly different methodology that relies on peers to provide partial views of relevant parts of the blockchain on demand.
For e.g., When examining a transaction in block 300,000, a full node links all 300,000 blocks down to the genesis block and builds a full database of UTXO, establishing the validity of the transaction by confirming that the UTXO remains unspent. An SPV node cannot validate whether the UTXO is unspent. Instead, the SPV node will establish a link between the transaction and the block that contains it, using a merkle path.Then, the SPV node waits until it sees the six blocks 300,001 through 300,006 piled on top of the block containing the transaction and verified it by establishing its depth under blocks 300,006 to 300,000. The fact that other nodes on the network accepted block 300,000 and then did the necessary work to produce six more blocks on top of it is proof, by proxy, that the transaction was not a double spend.
(That is why Binance waits for some x amount of block confirmation from the network, since it doesn’t have the complete picture as it is an SPV node and not a full node).
A full blockchain node verifies a transaction by checking the entire chain of thousands of blocks below it in order to guarantee that the UTXO is not spent, whereas an SPV node checks how deep the block is buried by a handful of blocks above it.
Unlike full blockchain nodes, which collect all transactions within each block, the SPV node’s requests for specific data can inadvertently reveal the addresses in their wallet. To protect user’s privacy, bitcoin developers added a feature called bloom filters.
Subscribe to the newsletter to learn more about the decentralized web, AI and technology.
Please be respectful!