/
Prelude: Blockchain From Core Principles
Search
Duplicate
Try Notion
Page icon

Prelude: Blockchain From Core Principles

A Tale of Distributed Consensus

ledger : a book or collection of accounts in which accounting transactions are recorded.”
A blockchain is essentially a database, storing information in key-value pairs, much like a typical Excel spreadsheet. This database, often containing user account balances, is commonly referred to as a 'ledger'. Blockchain's uniqueness lies in its robust management system that makes altering, hiding, or falsifying stored data nearly impossible. This is achieved by distributing copies of the ledger across a network of computers, known as consensus nodes or 'Validators'. This distribution ensures redundancy, enhancing the security and permanence of the data. A key feature of blockchain is its ability to maintain a consistent ledger version across the majority of these nodes, which is fundamental to the trust and reliability of the system. Users can send transactions to these nodes to transfer balances or make other data changes. These transactions are then grouped into 'blocks', which are essentially packages of updates. All nodes sequentially agree on each block by following a consensus protocol, after which they apply the modifications to their respective ledgers. Every new block that is agreed upon prompts each node to update its ledger and record the transaction history. The decentralized nature of this technology means that the privilege to produce a block and thus decide on database modifications is not vested in a single entity but is distributed among all consensus nodes, following predefined protocol rules.

Forks: The Interplay of Consensus Layer and Social layer in Blockchains

It’s crucial to understand that the consensus protocol of a blockchain, while coded and automated, does not solely dictate the global ledger's correct version. This reality somewhat challenges the popular blockchain notion that "code is law," which implies that the written code is the absolute arbitrator of transactions and rules. In practice, the determination of the ledger's version also involves the node operators and the surrounding community — the social layer of the blockchain. If some operators disagree with a ledger version for various reasons, ranging from hacks to political disagreements over a specific update, they can coordinate to adopt a new version. This interplay between the code (consensus layer) and the community (social layer) can lead to conflicts, resulting in 'forks' where different nodes may have differing versions of the blockchain. Forks which happens at the consensus layer like in Bitcoin are typically temporary and resolve as the network realigns on a single version, driven algorithmically by the Longest Chain rule. In contrast, systems like Tendermint, designed to prevent forks at the consensus layer, can experience permanent forks when the social layer splits, leading to two distinct blockchain versions, each backed by a segment of the network’s nodes and users.
In summary, the 'fork choice rule,' which is the set of criteria used to determine which ledger version to follow, stands as a vital concept in blockchain technology. However, while this rule can be algorithmically defined, the ultimate decision always lies with the social consensus among node operators and the community. This overarching social influence is what ultimately shapes the direction of the blockchain, regardless of the rule's algorithmic nature, underscoring that the idea of "code is law" is somewhat misleading in capturing the full dynamics of blockchain governance.

Resistance to Sybil Attacks

As you may have understood by now, the core principle of decentralized systems is that to tamper with the global ledger, an attacker has to tamper with the majority of the individual ledgers maintained by the existing nodes. Hence one of the fundamental challenges in any anonymous and permissionless decentralized system such as blockchains is the threat of Sybil attacks, where a single entity could create multiple fake identities to gain disproportionate share of the global network of node and by extension control the version of the ledger. This is difficult to detect for a regular users, as any blockchain that has many consensus nodes and which seem secure at any given time, can in reality have it’s majority controlled by one entity.
Satoshi has notoriously solved this issue by implementing an economic mechanisms that require nodes to commit energy resources, making it costly and difficult for any malicious actor to control a significant portion of the network. More generally, the general underlying idea behind sybil resistance mechanisms typically require nodes to consume some type of resource in order to participate in the consensus process. This resource consumption creates a "resource sink" that makes it ‘expensive’ for malicious actors to gain substantial share of the network. In addition, to incentivize network security, blockchain systems often use a reward scheme that compensates the nodes that participate in the consensus process. This reward is typically paid out in the form of the native token of the blockchain to whoever creates a block, and it is designed to offset the cost of the resource sink. By creating an "honest-rewarding" scheme that rewards consensus nodes for acting honestly, the consensus mechanism creates a Nash equilibrium, where it is in the best interest of nodes to act honestly and contribute to the security of the network.

Sybil Resistance Mechanisms: Proof of Work vs. Proof of Stake

Blockchain technology primarily employs two mechanisms for Sybil attack resistance: Proof of Work (PoW) and Proof of Stake (PoS). PoW, pioneered by Bitcoin, requires miners to solve complex mathematical puzzles to add new blocks to the blockchain. The first miner to solve the puzzle earns the right to add a block. This process demands significant computational resources and energy, making it costly for any single entity to control the network by operating multiple nodes. While effective in deterring Sybil attacks, PoW is often criticized for its high energy consumption and only offering probabilistic finality, as integrating it with fast finality consensus protocols is challenging because it fundamentally allows the creation of forks at the consensus layer. We will explore finality in more detail later.
Conversely, in PoS systems, nodes stake a certain amount of capital as collateral to participate in consensus processes, with the option to use either their own capital or capital delegated from other users. In these systems the likelihood of creating a block and receiving rewards correlates with the staked amount. This means the influence in the network is proportional to the stake, making the majority in terms of staked capital rather than the majority of nodes. Unlike PoW, where resources are continuously expended, in PoS, the staked collateral is only lost if the node acts against the network's interests, such as through double spending or prolonged offline periods. PoS systems offer a more energy-efficient alternative to PoW and are easily compatible with consensus protocols that provide fast finality, making them increasingly popular. However, PoS has its drawbacks. It is much more vulnerable to Sybil attacks because the network's resilience against such attacks is directly dependent to the distribution of the staked capital; a concentration of stake in a few nodes could lead to a centralised influence over the network's decisions and pose risks to its security. Additionally, as the cost of participation is deferred, PoS fundamentally relies on the assumption that node operators are rational actors.
Callout icon
It's a common misconception to describe a blockchain's consensus protocol solely in terms of PoW or PoS. PoW itself does not define the method for achieving consensus on the blockchain's state; it merely establishes a mechanism to make additions to the blockchain costly, thereby deterring dishonest behavior. Numerous consensus protocols can be coupled with different Sybil resistant mechanisms. For example, Bitcoin employs Nakamoto consensus, a specific blend of PoW and the Longest Chain rule. However, a blockchain utilizing PoW could also reach consensus through different protocols like Byzantine Fault Tolerance mechanisms (Bitcoin-NG).

Probabilistic Finality vs. Instant Finality

Understanding finality is key for any blockchain user, as it represents the irreversible confirmation of a transaction, providing certainty to all parties involved. Integral to maintaining the integrity and trust of a blockchain system, finality's nature is closely linked to the approach each blockchain takes in handling forks within its consensus layer.
Systems with probabilistic finality, like Bitcoin's Nakamoto consensus, secure transactions more as they are buried under more blocks. This is because there's always a small but non-zero chance of a fork at the consensus layer (e.g., when two nodes simultaneously solve the puzzle and produce a different block), which could potentially reverse transactions when a final version emerges through the longer chain algorithm. As a result, centralized exchanges like Binance typically wait a few blocks before confirming withdrawals and deposits. Conversely, systems like Tendermint BFT, which prevent forks at the consensus layer, offer instant finality, ensuring transactions are quickly and irrevocably confirmed. This feature of instant finality makes Tendermint and similar protocols highly suitable for applications that need quick and irrevocable transaction confirmation.
However a key takeaway here is that while the algorithmic aspect of finality can be clearly defined, the concept of 'social finality' remains subjective, as it depends on the broader community's acceptance of a chain’s ledger, the same way the social layer can influence the fork choice rule as explained before. For an in-depth understanding of this concept and its broader implications, we warmly recommend reading Scott Sunarto's insightful post on finality.
Thus concludes this introduction. With these fundamentals in hand, you're ready to delve into the distinctive choices and innovations of Kira Network.