Anatomy of a Blockchain

Peeling Back the Layers

Csilla Zsigri
BTP Works
Published in
8 min readMay 16, 2022

--

https://www.humanbodies.eu/

Although distributed ledger technology (DLT) — e.g. blockchain — is already being used in production across industries and a range of use cases, its architecture and modus operandi are still a mystery for many.

Technologists love to think in layers, and blockchain/DLT couldn’t escape from being ‘layered’ either. Some of the existing propositions I’ve seen fail to provide a clear and organized categorization and/or description of the layers and their components, others put actual blockchain implementations in a pigeonhole.

Here is my high-level view of the technology layers and components of blockchain/DLT and what those entail. Note that layered architectures have their limitations, as they may draw boundaries where arguably there are no actual boundaries. However, if done properly, they do shed light on the key components of a technology, and how those fit together and into the entire technology stack.

Blockchain/DLT Layers (Source: BTP)

Layer 0

A blockchain or DLT stack starts with the computing infrastructure where the nodes sit. Nodes are fundamental to a blockchain network — they can be any kind of machine such as a computer or a server, or be deployed in the cloud. Nodes essentially store, spread, and preserve blockchain data, and are connected via a peer-to-peer (P2P) protocol, which allows them to talk to each other and transfer information, within a particular network. P2P protocols allow the creation of decentralized structures, and are a foundational component of a distributed ledger.

Layer 1

Layer 1 embodies the essence of a blockchain or distributed ledger, and includes data structure, cryptography, consensus, and incentives.

Data Structure

Data structures used by distributed ledgers may vary. Bitcoin and other cryptocurrencies, for example, leverage merkle trees — aka hash trees — a structure that has been widely used in distributed, peer-to-peer systems for data verification. In a blockchain, transactions are organized in a linear chain of blocks, where each block includes a transaction and the reference to the previous block. This linear chain of blocks is replicated across all participating nodes.

A directed acyclic graph (DAG) is a graphical structure that is often used for data processing and scheduling. Distributed ledgers using DAGs — e.g. the IOTA ledger — don’t require every node in the network to validate all transactions. In a hashgraph, which is a type of DAG and also known as ‘gossip about gossip’ protocol, there is no linear chain of blocks, instead, there are multiple paths in the flow.

While a blockchain resembles a growing tree that continuously gets all but one of its branches cut off, a hashgraph keeps all its branches and weaves them together into a single whole. The use of DAGs is motivated by a potentially higher scalability and throughput, compared to blockchains.

Cryptography

Cryptography is a fundamental L1 component. The use of cryptography is key to the security of the ledger. Cryptography helps ensure privacy on the blockchain or distributed ledger network, as well as prevent fraud and unauthorized access to transaction details.

In a blockchain, the cryptographic hash function takes the information in each block and creates a unique string of characters — this is called hash or hash value. The hash of a block is added to the data in the next block, where the hash function creates a new hash, and this goes on in all subsequent blocks. If someone tries to alter a previously created block, the hashes in the subsequent blocks will not match up, which will raise the alarm and reject the block.

Zero-knowledge proofs (ZKP) — an encryption technique whereby one party can prove to another that a given statement is true, without revealing additional information, in particular, the content of the statement itself — also live on Layer 1. With ever-growing concerns over privacy and misuse of data, blockchains leveraging ZKP have an edge. The use of ZKP can also help improve scalability issues by reducing the size of on-chain data.

Consensus

A decentralized approach means that there is no single central authority calling the shots when it comes to processing transactions. In a decentralized set-up, decisions are made collectively — more specifically, by nodes that participate in the network. This mechanism is called consensus — when the participants in a network come to a common agreement on the state of the ledger. The choice of a particular consensus protocol may have substantial effect on the speed and scalability of the network, as well as transaction costs.

The permissionless Bitcoin blockchain uses the proof-of-work (PoW) consensus algorithm, while Ethereum plans to fully shift from PoW to a proof-of-stake (PoS) model. In blockchains using a delegated proof-of-stake (DPoS) system, validating nodes running the network are voted on and agreed to by users on a rolling basis, vote power is determined by stake, and underperforming or malicious nodes can be voted out.

Permissioned distributed ledgers — e.g. Hyperledger projects — may use variants of byzantine fault tolerant consensus algorithms such as the practical Byzantine fault tolerant (pBFT) or Istanbul Byzantine fault tolerant (IBFT) protocols, among others.

Incentives

Although incentive mechanisms — in other words, native tokens — are inextricably tied to particular consensus protocols, they have been separated from consensus in the diagram to accentuate that not all distributed ledgers have incentive systems nor need them to run.

PoW-based blockchains, in particular, can’t run without an incentive scheme for validating transactions and creating blocks. Cryptocurrencies like Bitcoin and their mining activity are inextricably linked to the PoW consensus mechanism. PoS blockchains also operate via native or intrinsic tokens.

However, as previously noted, not all blockchain systems need a cryptocurrency to run. Consensus mechanisms — e.g. variations of byzantine fault-tolerant algorithms — used by permissioned blockchains don’t require a currency and don’t involve transaction fees either. Proof of authority (PoA) algorithms, for example, utilize a system where nodes are allocated the privilege of producing new blocks using an arbitrary system. There are different flavors of PoA, one of them being the IBFT consensus protocol, used by Hyperledger Besu.

IOTA is a permissionless distributed ledger protocol that has a token, but it does not require fees to process transactions. It was designed to enable transactions between connected devices. There are no miners nor stakers in this system. However, ‘feeless’ does not equal ‘free to use’ or ‘incentiveless.’ As a simple analogy, sending emails is not really for free, is it? At least you need a computer or device, and internet connection.

Layer 2

Layer 2 includes smart contract environments and sidechain protocols. Simply put, L2 is meant to improve the functionality of the core blockchain or distributed ledger.

Smart Contracts

Smart contracts — a term coined by computer scientist, cryptographer and legal scholar Nick Szabo — are transaction protocols sitting on a blockchain or distributed ledger, embodying the self-enforcing business logic of a multiparty application. Smart contracts are used to formalize and automate the relationship between individuals, organizations, as well as things that participate in a network. Smart contracts can be devised to do many interesting things. Beyond being the engines behind the tokenization of assets, applying them to code and automate a wide variety of business processes to increase trust and efficiency, has great potential.

Today, there are a variety of programming languages that are used to create smart contracts — e.g. Daml, Solidity, and WebAssembly, among others. The ledger-agnostic Daml smart contracts cannot only be deployed on various permissionless and permissioned distributed ledgers, but also on centralized ledgers like Amazon QLDB, as well as more traditional databases such as PostgreSQL.

Smart contracts runtime environments or systems make sure that smart contract code gets translated into low-level machine code, processed, and executed on the network. They also provide support for engineers developing, deploying, and integrating decentralized applications. Although smart contracts are primarily programmed by developers, the availability of templates, web interfaces, and other tools increasingly simplify the creation of smart contracts.

Sidechains

A sidechain is a secondary blockchain or distributed ledger that connects to a parent blockchain or distributed ledger — aka mainnet — via a two-way bridge. The value proposition of a sidechain can be both an interoperability and a scalability play. The sidechain approach may introduce a vulnerability in terms of security (see Blockchain Trilemma section below).

The Lightning Network was introduced to help improve the transaction speed on the Bitcoin blockchain by introducing off-ledger transactions. The Raiden Network is an Ethereum-compatible off-chain scaling solution. Also, there are ‘network of ledgers’ projects — e.g. Cosmos and Polkadot — that consist of decentralized networks of independent, scalable, and interoperable blockchains.

Layer 3

Layer 3 represents the DLT-based applications. Decentralized applications are built on L0-L2 for a wide variety of purposes, including the trading and traceability of any physical and digital assets — from money and financial instruments through commodities and diamonds to artworks and in-game collectibles.

Decentralized Autonomous Organizations (DAOs) are member-owned, internet-native communities and businesses — built on blockchain and associated technologies — that have no centralized leadership, and where smart contracts define the rules of engagement, hold the organization’s treasury, etc.

Blockchain Trilemma

Blockchains and other types of distributed ledgers continue to navigate a trilemma of decentralization, scalability, and security, where often tradeoffs are being made when deciding how to optimize their underlying architecture. This is called the blockchain trilemma, a concept first described by Vitalik Buterin — co-founder of Ethereum — quite some time ago.

  • Decentralized — it goes from ‘no centralized point of control’ to ‘anyone with a computer and internet connection can join’
  • Scalable it is able to handle a growing amount of transactions
  • Secure — it can resist a large percentage of participating nodes trying to attack it

The Bitcoin blockchain, in particular, is considered by many to be decentralized, secure, but slow. Permissionless blockchains using DPoS consensus and permissioned blockchains typically rely on a smaller number of nodes maintaining consensus among themselves, which means higher transaction throughput. Permissioned blockchains are generally seen as secure — using the definition above — but they are less decentralized in the sense that not everybody with a computer can form part of the network. Multi-chains or network of ledgers projects are stronger in terms of decentralization and scalability, than security.

For blockchains — and distributed ledgers more broadly — to operate at their best, they must be decentralized, secure, and scalable. The goal remains to score high on all three properties.

--

--

Csilla Zsigri
BTP Works

Chief Strategy Officer at BTP and former technology industry analyst