At the core of a blockchain application lies the foundation: the blockchain itself. Any blockchain will include a peer-to-peer network, a token ledger with rules for transactions, and a consensus algorithm for determining how the ledger may be extended.
Any rudimentary blockchain foundation can be used to support the blockchain application services enabled by the BitGo Services Platform.
The P2P Network
The networking component of a blockchain implementation determines how peers in the network connect to one another and the format of the messages they use to communicate. Messages on the P2P network allow propagation of transactions and blocks and allow new peers joining the network to synchronize with the current state of the ledger.
Several access control possibilities are possible for restricting access to the network. Most private blockchains will elect to use VPN-level access controls and encryption. In addition, blockchains can also enable per machine or per account username/password or PKI-level authentication. In situations which require it, additional connection safeguards, such as IP-based locking or dedicated networks can also be used.
Each P2P network will have a peer-node discovery protocol to find other nodes within the network. Most blockchains elect to use a set of well-known “seed” nodes for the network which can be discovered either by fixed IP address or DNS. Smaller blockchains can use static lists as well.
At its simplest, the ledger consists of a chain of blocks (i.e. records) containing ordered lists of valid transactions. A transaction is simply some mutation to the state of the ledger — its form depends entirely on how the system is designed. The goal of the blockchain ledger is to serve as a single definitive record of the exact set of all transactions which happened. It is therefore also a global agreement about the current state.
The consensus system imposes strict constraints on what constitutes a valid transaction. Most importantly, since the blockchain is a shared database with multiple writers, cryptographic signatures are used to validate that the issuer of the transaction is allowed to make the requested change to the ledger. Other constraints may also apply, for instance: assets cannot be created out of thin air, assets cannot be destroyed, and non-fungible assets may not be combined.
Typical functionality of a human-readable ledger, such as computing net debits/credits and balances is typically done at a higher level than in the ledger itself. For example, despite the appearance that Bitcoin addresses have “balances,” there is no such notion at the blockchain ledger layer — there are only transactions.
Each application may have its own, unique requirements of the ledger in order to enforce cryptographic contracts required of that application. For instance, some blockchains, such as the Bitcoin blockchain, only support a single, fungible asset type, and the transaction structure reflects this. Other blockchains may transact multiple asset types which may or may not be fungible. Such a blockchain requires more sophisticated structure and rules to define inputs and outputs, and may impose additional validation rules for any transaction.
The Consensus Algorithm
The purpose of the consensus algorithm in a blockchain is to reach agreement about valid blocks of transactions among the set of network participants. Some of the consensus rules enforced by the blockchain include:
• Verification that each transaction is properly formed
• Verification that each “block” is created properly
• Verification of proper issuance of new assets
Each node in the network validates all of the consensus rules. If a node does not accept a block as valid, it ignores the block entirely
Some (or all) of the nodes can participate in the generation of new blocks. Each blockchain defines its own rules to define what is a “valid” block. Rules may include:
• block syntax
• block size
• time between block creation
• transactions per block
• computational complexity of a block
• creator of the block
Many algorithms exist for choosing how new blocks are created. A blockchain may elect a leader node to create a block, either randomly or in an orderly fashion (round robin). Or, a blockchain may enable multiple blocks to attempt block creation concurrently. Such systems, like the Bitcoin blockchain, may have nodes include a difficult “proof-of-work” to demonstrate that enough work has been done by the node to create the new block.
In all cases, the blockchain network must be prepared for the case that two nodes simultaneously create conflicting blocks. Blockchains deal with this problem by having nodes converge on the longest chain of blocks. If a node finds itself on a shorter chain of blocks, it will replace that chain with the longer chain using a process called reorganization.
As we build applications on top of blockchain technology, the foundational layer can be customized in many ways to suit the application requirements. Everything, from security, to ledger rules, to consensus algorithms can be tailored. However, all blockchains will benefit from the same core benefits: a highly distributed, semi-trustless ability for multiple computers to converge on a common, shared database of transactions.