From Concept to Implementation: A Comprehensive Guide to Blockchain Finality

Advanced10/15/2024, 10:47:28 AM
This article discusses the concept of finality in blockchain, analyzing how different blockchain systems achieve finality, along with the underlying principles and challenges involved.

IRL ANALOGY

As is tradition with my “WTF is…” articles, I like to start off with a real-life analogy to allow people to get the gist and bounce if they don’t care about the underlying details.

For this topic, we’ll use concrete drying over time:

That’s the high-level of what “finality” means in the context of blockchains. Much like concrete, as time passes from the point of being poured (initial confirmation) through setting (multiple confirmations) the ease with which the initial block can no longer be considered “true” becomes increasingly difficult until it’s fully hardened (finalized). Once at that point it’s nigh impossible.

TLDR just remember the order of the steps:

Submitted -> Confirmed -> Finalized

If that’s good enough for you to consider this case closed I invite you to hit the article with a like and go about your day. If you want to nerd out on the how, what and why’s of finality (in the Ethereum context); continue on mon frere.

FINALITY NERD-OUT

Alright - let’s try and build some structure around this concept and understanding it. Thankfully it gives us something to build from as all components come in to play as a byproduct of time passed, so we’ll use that.

First though, lets round out our knowledge base with definitions.

GLOSSARY

Slot (Block Time): You’ll likely understand the alternate name for this: Block Time. A slot, or block time, is the amount of time given to the system to produce a new block of transactions to append to the current canonical chain.

Example slots/block times:

Ethereum - 12 seconds

Base - 2 seconds

  • Solana - 0.4 seconds
  • Confirmation: This is the what takes place when your transaction has officially made it in to a block which has been appended to the current chain. It’s now “confirmed” as a part of the ledger and as blocks are appended to yours, it accumulates additional confirmations.
  • Epoch: A string of 32 Slots. This is created as a secondary structure within the blockchain used to delegate roles and responsibilities. Slots are used for constructing blocks while Epochs are used for data propagation, reward distribution, validator selection, etc, etc.
  • Checkpoint Block: This is the first block created within a given Epoch and is used as a reference point for solidifying chain history.

Finality: The point at which a transaction is deemed irreversibly added to a given chain’s ledger. This term isn’t uniformly used across chains when it comes to technical properties though, so be it’s best to not assume like-for-like in all contexts. In the Ethereum ecosystem, this is used when the below conditions are met:

Ethereum - When 2 Epochs have passed (~13min)

Optimistic L2 - When the fraud window has passed (~7d)

  • ZK L2 - Due to the guarantees provided by validity proofs there are 2 debatable finality moments: local (when the proof is generated on the L2 [~few minutes]) and global finality (when the proof is posted to Ethereum and finilized there [~13min])
  • Block Reorganization (“Reorg”): This is when block(s) that were once confirmed as part of the ledger, for one reason or another, are no longer considered valid and new chain has been formed. This comes typically with penalties

and here is an attempt to visualize all of those terms in a single image to make them a little easier to digest:

HOW FINALITY?

So, now that we have the pieces used to determine finality, how are they pieced together? What are the rules?

For Ethereum

  1. Validator Voting - Each epoch (32-block window) validators will vote on the checkpoint block of the current and previous epoch until specific checkpoint blocks reach 2/3rd majority of staked $ETH
  2. Justified Checkpoints - Once a checkpoint block reaches that 2/3rd threshold it becomes considered “justified”
  3. Supermajority Link - Once two subsequent checkpoint blocks are a) justified and b) linked to one another the blocks included in epoch before the now-linked, justified epochs become final. They can no longer be impacted by a simple re-org.

Visualized

For L2s

Well, L2s are build on Ethereum so they’re basically the same, right?

Yes and no, dear reader. Recall posting structure from my prior post on Based Rollups. L2s are their own blockchains, yes, but they depend on Ethereum for ultimate settlement. That means the answer is just as layered as the chains themselves.

These layers breakdown in to two types of finality:

  1. Local Finality - This is the finality within the L2 itself and only possible with for L2s that leverage validity proofs (aka ZK Rollups). That’s because validity proofs are backed by math and the production of the proof itself means its correct. Due to this, once a ZK L2 produces its proof the L2 state can be considered finalized without having to wait for the proof to be posted to, and settled on, Ethereum. Note that this still comes with risks and trust assumptions, but can be done with some confidence depending on your risk tolerance.
  2. Global Finality - The state achieved once and L2 has confirmed its local state, produced a proof (fraud or validity), posted that proof to Ethereum and Ethereum, too, has finalized the block where the proof was posted. Even then, for the optimistic subset of L2s the chance to revert persists until the challenge period has passed. This is a tradeoff made to reduce computation required for proof creation.

So, L2s can have a level of localized finality if they’re a certain type but otherwise must wait until either Ethereum finalizes their posted validity proof (ZK) or the challenge window has passed for fraud proofs (Optimistic rollups).

For Bitcoin / Proof of Work

This one is actually pretty easy - there is no finality in Bitcoin’s specific implementation of PoW. For it, whomever produces the heaviest chain head (read: produces enough blocks to be the “longest” chain) becomes the canonical ledger. This means, although impractical for many reasons, someone could produce enough hash to re-write the last day, week, year of Bitcoin’s history.

Again though; impractical for the sheer amount of resources and time it’d take, but a worthwhile distinction of the systems and actually leads to a few unique types of MEV, like “Long-Ranged Attacks” and “Block Witholding” where miners can either produce (and hide) a block to then append a subsequent block or mine several blocks in a row to create and capture unique profit opportunities.

Visualized:

WHY FINALITY?

So, we know how we come to finality in the largest Proof of Stake chain in crypto, but that seems like a lot of work - why are we even doing it?

Well, it comes with some benefits:

  1. Economic Security - Having a point which the system (and we) can look back on and say with high confidence that it will not change gives ecosystem participants confidence to act on “what is true.” Think large transfers and loans. Once you know for certain that the system cannot be changed without extreme, out-of-protocol intervention it gives you the confidence to act on that truth. This is why bridges typically wait for X amount of confirmations or full finality before releasing funds on secondary chains. Which brings me to…
  2. Faster Settlement - Because there is a point where things become formalized as permanent it means that parties operating within the ecosystem have a maximum settlement time they ultimately have to wait for whereas in a PoW system that point never comes and is purely a personal comfort call.
  3. Reduced Attack Vectors - We mentioned the handful of MEV opportunities enabled in PoW chains, but ultimately it just addresses the “Nothing at stake” problem where anyone who acts maliciously against the system also has something to lose. If you’re a validator and attempting to change things which are finalized you would have to break protocol rules and therefor would be subject to slashing of your stake.

CONCLUSION

Why did I cover finality? No real idea - I just had heard it thrown around by some recently and realized it was an oft-used, but not deeply understood mechanic of blockchains.

Hope you enjoyed it and remember; it’s just your blocks hardening like concrete in the system and at some point they’re rock-solid.

Disclaimer:

  1. This article is reprinted from [BREAD], Original title is [WTF is Finality?], All copyrights belong to the original author [@0xBreadguy]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.

From Concept to Implementation: A Comprehensive Guide to Blockchain Finality

Advanced10/15/2024, 10:47:28 AM
This article discusses the concept of finality in blockchain, analyzing how different blockchain systems achieve finality, along with the underlying principles and challenges involved.

IRL ANALOGY

As is tradition with my “WTF is…” articles, I like to start off with a real-life analogy to allow people to get the gist and bounce if they don’t care about the underlying details.

For this topic, we’ll use concrete drying over time:

That’s the high-level of what “finality” means in the context of blockchains. Much like concrete, as time passes from the point of being poured (initial confirmation) through setting (multiple confirmations) the ease with which the initial block can no longer be considered “true” becomes increasingly difficult until it’s fully hardened (finalized). Once at that point it’s nigh impossible.

TLDR just remember the order of the steps:

Submitted -> Confirmed -> Finalized

If that’s good enough for you to consider this case closed I invite you to hit the article with a like and go about your day. If you want to nerd out on the how, what and why’s of finality (in the Ethereum context); continue on mon frere.

FINALITY NERD-OUT

Alright - let’s try and build some structure around this concept and understanding it. Thankfully it gives us something to build from as all components come in to play as a byproduct of time passed, so we’ll use that.

First though, lets round out our knowledge base with definitions.

GLOSSARY

Slot (Block Time): You’ll likely understand the alternate name for this: Block Time. A slot, or block time, is the amount of time given to the system to produce a new block of transactions to append to the current canonical chain.

Example slots/block times:

Ethereum - 12 seconds

Base - 2 seconds

  • Solana - 0.4 seconds
  • Confirmation: This is the what takes place when your transaction has officially made it in to a block which has been appended to the current chain. It’s now “confirmed” as a part of the ledger and as blocks are appended to yours, it accumulates additional confirmations.
  • Epoch: A string of 32 Slots. This is created as a secondary structure within the blockchain used to delegate roles and responsibilities. Slots are used for constructing blocks while Epochs are used for data propagation, reward distribution, validator selection, etc, etc.
  • Checkpoint Block: This is the first block created within a given Epoch and is used as a reference point for solidifying chain history.

Finality: The point at which a transaction is deemed irreversibly added to a given chain’s ledger. This term isn’t uniformly used across chains when it comes to technical properties though, so be it’s best to not assume like-for-like in all contexts. In the Ethereum ecosystem, this is used when the below conditions are met:

Ethereum - When 2 Epochs have passed (~13min)

Optimistic L2 - When the fraud window has passed (~7d)

  • ZK L2 - Due to the guarantees provided by validity proofs there are 2 debatable finality moments: local (when the proof is generated on the L2 [~few minutes]) and global finality (when the proof is posted to Ethereum and finilized there [~13min])
  • Block Reorganization (“Reorg”): This is when block(s) that were once confirmed as part of the ledger, for one reason or another, are no longer considered valid and new chain has been formed. This comes typically with penalties

and here is an attempt to visualize all of those terms in a single image to make them a little easier to digest:

HOW FINALITY?

So, now that we have the pieces used to determine finality, how are they pieced together? What are the rules?

For Ethereum

  1. Validator Voting - Each epoch (32-block window) validators will vote on the checkpoint block of the current and previous epoch until specific checkpoint blocks reach 2/3rd majority of staked $ETH
  2. Justified Checkpoints - Once a checkpoint block reaches that 2/3rd threshold it becomes considered “justified”
  3. Supermajority Link - Once two subsequent checkpoint blocks are a) justified and b) linked to one another the blocks included in epoch before the now-linked, justified epochs become final. They can no longer be impacted by a simple re-org.

Visualized

For L2s

Well, L2s are build on Ethereum so they’re basically the same, right?

Yes and no, dear reader. Recall posting structure from my prior post on Based Rollups. L2s are their own blockchains, yes, but they depend on Ethereum for ultimate settlement. That means the answer is just as layered as the chains themselves.

These layers breakdown in to two types of finality:

  1. Local Finality - This is the finality within the L2 itself and only possible with for L2s that leverage validity proofs (aka ZK Rollups). That’s because validity proofs are backed by math and the production of the proof itself means its correct. Due to this, once a ZK L2 produces its proof the L2 state can be considered finalized without having to wait for the proof to be posted to, and settled on, Ethereum. Note that this still comes with risks and trust assumptions, but can be done with some confidence depending on your risk tolerance.
  2. Global Finality - The state achieved once and L2 has confirmed its local state, produced a proof (fraud or validity), posted that proof to Ethereum and Ethereum, too, has finalized the block where the proof was posted. Even then, for the optimistic subset of L2s the chance to revert persists until the challenge period has passed. This is a tradeoff made to reduce computation required for proof creation.

So, L2s can have a level of localized finality if they’re a certain type but otherwise must wait until either Ethereum finalizes their posted validity proof (ZK) or the challenge window has passed for fraud proofs (Optimistic rollups).

For Bitcoin / Proof of Work

This one is actually pretty easy - there is no finality in Bitcoin’s specific implementation of PoW. For it, whomever produces the heaviest chain head (read: produces enough blocks to be the “longest” chain) becomes the canonical ledger. This means, although impractical for many reasons, someone could produce enough hash to re-write the last day, week, year of Bitcoin’s history.

Again though; impractical for the sheer amount of resources and time it’d take, but a worthwhile distinction of the systems and actually leads to a few unique types of MEV, like “Long-Ranged Attacks” and “Block Witholding” where miners can either produce (and hide) a block to then append a subsequent block or mine several blocks in a row to create and capture unique profit opportunities.

Visualized:

WHY FINALITY?

So, we know how we come to finality in the largest Proof of Stake chain in crypto, but that seems like a lot of work - why are we even doing it?

Well, it comes with some benefits:

  1. Economic Security - Having a point which the system (and we) can look back on and say with high confidence that it will not change gives ecosystem participants confidence to act on “what is true.” Think large transfers and loans. Once you know for certain that the system cannot be changed without extreme, out-of-protocol intervention it gives you the confidence to act on that truth. This is why bridges typically wait for X amount of confirmations or full finality before releasing funds on secondary chains. Which brings me to…
  2. Faster Settlement - Because there is a point where things become formalized as permanent it means that parties operating within the ecosystem have a maximum settlement time they ultimately have to wait for whereas in a PoW system that point never comes and is purely a personal comfort call.
  3. Reduced Attack Vectors - We mentioned the handful of MEV opportunities enabled in PoW chains, but ultimately it just addresses the “Nothing at stake” problem where anyone who acts maliciously against the system also has something to lose. If you’re a validator and attempting to change things which are finalized you would have to break protocol rules and therefor would be subject to slashing of your stake.

CONCLUSION

Why did I cover finality? No real idea - I just had heard it thrown around by some recently and realized it was an oft-used, but not deeply understood mechanic of blockchains.

Hope you enjoyed it and remember; it’s just your blocks hardening like concrete in the system and at some point they’re rock-solid.

Disclaimer:

  1. This article is reprinted from [BREAD], Original title is [WTF is Finality?], All copyrights belong to the original author [@0xBreadguy]. If there are objections to this reprint, please contact the Gate Learn team, and they will handle it promptly.
  2. Liability Disclaimer: The views and opinions expressed in this article are solely those of the author and do not constitute any investment advice.
  3. Translations of the article into other languages are done by the Gate Learn team. Unless mentioned, copying, distributing, or plagiarizing the translated articles is prohibited.
Start Now
Sign up and get a
$100
Voucher!