#tezos

By Lin Oshitani

While the irony of preventing the fragmentation of cryptocurrencies by releasing a new one does not escape us, Tezos truly aims to be the last cryptocurrency.
  — L.M Goodman, Tezos: A Self-Amending Crypto-Ledger Position Paper

Why Self-Amending Blockchains?

Blockchains have a problem — It is hard to implement major upgrades. Fundamental changes are possible through socially coordinated hard forks, but this method has several issues:

  • There is a technical risk of a temporary network split due to incompatible nodes running in the network.
  • There is a social and economic risk of a permanent network split due to the lack of a formal process for resolving disagreements.
  • It is unclear who has the final say. The core devs? The stakeholders? Or people with the loudest voice?

This difficulty in updating blockchains hinders their ability to integrate innovations, leading to technical stagnation. What we need is a chain that can seamlessly evolve while minimizing technical and social risks.

And from this need, Tezos, the self-amending blockchain, emerged.

What are Blockchains?

What are “self-amending blockchains”? To understand what they are, we must first take a step back and revisit what blockchains are in abstract terms.

The Apply Function

At the core, blockchains consist of a state, blocks, and an apply function:

The state (the yellow table on the left) contains information such as “Alice has 9XTZ and Bob has 1XTZ”. There are also operations like Transfer (Alice, Bob, 1), which means “Alice sends 1XTZ to Bob”. Furthermore, we have blocks, a collection of such operations (the blue box in the middle).

Now, by applying the state to the block with apply (state, block), a new state state' is created (the yellow table on the right). In the new state, the operations in the block get executed, hence the balance of Alice is decreased by one and the balance of Bob is increased by one.

Chain of applies

Now where does the “chain” in “blockchain” come from? It comes from the fact that we apply apply(state, block) successively and form a “chain” of blocks and states, as displayed below:

The Score Function

Is the apply function sufficient to define a blockchain? The answer is no, as it doesn’t address how to handle branching. Because blockchains are distributed, two blocks can be created simultaneously at different parts of the network, leading to a branch in the chain:

In the diagram above, blocks block a and block m are generated around the same time. Some parts of the network extend blocks after block a (up to block b), while others extend blocks after block m (up to block n). To resolve the branching, the network needs to agree on which branch is the canonical branch to build upon.

To achieve this consensus, we introduce a score function:

The score function takes a state as input and returns a natural number. Using this function, the network agrees that the branch with the state with a higher score is the canonical one.

Using this function, the network can reach a consensus on which block to build upon, allowing the branching of the chain to eventually converge.

The Protocol

There is great significance in viewing the blockchain abstractly through the functions apply and score:

Actually, all blockchains can be instantiated by implementing appropriate apply and score functions. For example:

  • Bitcoin:
    • The state is UTXO, and the score is the total amount of work.
  • Ethereum:
    • The state is a ledger, and the score is the number of validator signatures.
  • Centralized blockchain:
    • The state can be anything, and the score is 1 if a specific secret key has signed the state and 0 otherwise.

Since the apply and score functions are sufficient to characterize any blockchain, we can define the blockchain's protocol by combining the two:

What are Self-Amendments?

So far, we have seen what “blockchain” means in “self-amending blockchain”. Now, what does “self-amending” mean?

We learned that we could represent all blockchains with an appropriate protocol = (apply, score). This means that by replacing protocol, we can achieve arbitrary updates to the blockchain. Hence if there is an on-chain mechanism to replace protocol, we can achieve all updates on-chain seamlessly. To do this, we embed the protocol into the state and replace it with apply.

What does “embed the protocol into the state and replace it with apply” mean? Below is an illustration of this process:

Look at the initial state (the yellow table on the left). In addition to balance information such as “Alice has 9XTZ and Bob has 1XTZ,” a protocol field has been added. This field stores the protocol used at that time, (applyA, scoreA). Therefore, applyA will be used when applying a block under this state.

Consider a new block (the blue box in the middle). In addition to the transactions like Transaction (Alice, Bob, 1), there is an operation Upgrade (applyB, scoreB) that means “replace the protocol field with (applyB, scoreB)”.

Now, we run applyA (state, block) and get the new state state' (the yellow table on the right). The upgrade operation is applied and the protocol is changed from (applyA, scoreA) to (applyB, scoreB).

From this point on, when applying new blocks under the newly created state state', applyB will be used instead of applyA:

Since the definition of how the blockchain execute blocks has changed, we can say that the blockchain has been upgraded.

One interesting property is that the self-amendment process itself is self-amendable. This is because the process of replacing the apply function exists within the apply function. In the example, the protocol was replaced from (applyA, scoreA) to (applyB, scoreB) within the applyA function. Hence by replacing applyA with applyB, we are also replacing the protocol replacement logic.

The above is a very simplified view of how Tezos self-amendment works. There is a longer amendment cycle instead of a single operation that replaces the protocol definition.‍

Amendment cycle

This section briefly looks into the current Tezos amendment cycle (“current” because, as we have seen above, we can amend the amendment cycle itself).

The cycle consists of five stages:

Proposal:

  • Anyone who is a baker can propose a new protocol or vote on an existing protocol proposal.
  • The proposal can optionally include inflation funding - a piece of code within the proposal that mints new XTZ and grants it as a reward for their work. For example, the Lima amendment included such a proposal.
  • The proposal with the most votes will advance to the next exploration stage.

Exploration:

  • The proposal is voted on to determine if it should be adopted in the testnet.
  • If it collects enough votes, it advances to the cooldown stage.

Cooldown:

  • A testnet with the proposed protocol is created for testing.

Promotion:

  • The proposal is voted on to determine if it should be adopted in the mainnet.
  • If it collects enough votes, the protocol proceeds to the adoption stage.

Adoption:

  • At the end of the adoption stage, the protocol self-amends by replacing the mainnet protocol.

Example: Proposal stage

To better understand what is going on in these stages, let’s take a deeper look into the first “proposal” stage as an example:

During the proposal stage, the state (yellow box on the left) includes fields such as protoB_hash. This means that protocol protoB has been proposed and has received three votes. Note that the protoB_hash is the result of hashing the code associated with protoB.

In the block (blue box in the middle), there is a new kind of proposal operation. The operation Proposal (protoB_ahash) represents a cast of a vote for an existing proposal protoB_hash. The operation Proposal (protoC_hash) represents a new proposal of a protocol with the hash protoC_hash.

As a result of apply (state, block), the apply function reflects the voting results in the state (yellow box on the right). By accumulating the votes like this, we can move forward to the next stage in the amendment cycle.

Other stages in the cycle are implemented in a similar fashion.

History of Tezos Self-Amendments

Tezos has been able to self-amend itself 3~4 times a year. For example:

  • The February 2021 Edo upgrade introduced protocol-level support for fungible/non-fungible tokens and Z-cache’s sapling.
  • The April 2022 Ithaca upgrade introduced deterministic finality by hot swapping the consensus algorithm from Nakamoto consensus to a Tendermint-like BFT consensus. (blog post).
  • The April 2023 Mumbai upgrade introduced Smart Optimistic Roll-Ups (also known as SORU), which are enshrined rollups (rollups directly supported by the L1 protocol), allowing anyone to deploy fully permissionless WASM rollups (blog post).

As you can see, Tezos has been able to make fundamental and drastic upgrades at a rapid pace.

Conclusion

Tezos is an abstract blockchain.

The key insight of Tezos is that we can implement all blockchains through an appropriate apply and score. This abstract nature enables Tezos to integrate any technological innovation.

https://i.imgur.com/nO7JDXx.png
From Introduction to the Tezos Blockchain

Tezos is a recursive blockchain.

The self-referential nature allows Tezos to embed the protocol upgrade logic within the protocol itself. By minimizing the need for off-protocol coordination during upgrades, Tezos can evolve continuously and seamlessly.

https://i.imgur.com/tVjk2ty.png
From Tezos – A self-amending crypto-ledger White paper

Tezos is an on-chain governed blockchain.

Tezos upgrades its protocol through on-chain proposal and voting. Therefore, the final decision-making power has shifted from the developers to the stakeholders.

Tezos’s true potential lies in putting the stakeholders in charge of deciding on a protocol that they feel best serves them.
  — L.M Goodman, Tezos – a self-amending crypto-ledger White paper

Tezos is an evolving blockchain.

Blockchains are in their early stages, with their usages and technological innovation vastly unknown. More than what can be done now, the most important thing is the potential for evolution.

No matter what innovations other protocols produce, it will be possible for Tezos stakeholders to adopt these innovations.
  — L.M Goodman, Tezos – a self-amending crypto-ledger White paper

Reference

If you want to know more about Marigold, please follow us on social media (Twitter, Reddit, Linkedin)!

Scroll to top