Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction Finality Explainer #987

Open
wants to merge 58 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
a6ac1ab
Initial commit
krofax Oct 14, 2024
0b36071
updated docs
krofax Oct 14, 2024
10bac65
updated the docs and added image
krofax Oct 14, 2024
2063c26
updated the docs
krofax Oct 14, 2024
880a3eb
fix lint issues
krofax Oct 14, 2024
7cbd715
updated finality docs
krofax Oct 23, 2024
f35ba6c
fix linting errors
krofax Oct 23, 2024
0b66134
fix conflict
krofax Oct 23, 2024
e87c41b
updated few grammar errors
krofax Oct 23, 2024
d1003e6
updated the tones
krofax Oct 23, 2024
5d50382
updated some concepts
krofax Oct 23, 2024
96d6722
removed duplications
krofax Oct 23, 2024
565bc82
Updated structure
krofax Oct 23, 2024
1a136d6
resolved suggestions
krofax Oct 23, 2024
16f6052
fix lint errors
krofax Oct 23, 2024
0139df2
Update pages/stack/transactions/_meta.json
krofax Oct 24, 2024
186d941
Update pages/stack/transactions/_meta.json
krofax Oct 24, 2024
4eced45
Update pages/stack/transactions/_meta.json
krofax Oct 24, 2024
062aa1a
Update pages/stack/transactions/_meta.json
krofax Oct 24, 2024
fc42888
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
c1ebce7
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
2b3e7ed
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
965f8b9
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
8cf8f59
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
60e3688
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
a19a677
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
6340edd
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
ce345b5
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
1d70689
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
b9acf97
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
f6f4a38
resolved comments
krofax Oct 24, 2024
376a990
fix conflict
krofax Oct 24, 2024
867fb4c
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
8a9ecd0
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
b2cac6a
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
f5929b5
updated content
krofax Oct 24, 2024
d27bae6
updated the docs
krofax Oct 24, 2024
b71df34
removed wrong word
krofax Oct 24, 2024
aacd64f
resolved comments
krofax Oct 24, 2024
71ea8fc
Used sentence case in meta json file
krofax Oct 24, 2024
d7bec26
Update pages/stack/transactions/transaction-finality.mdx
sbvegan Oct 24, 2024
04bb7e9
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 24, 2024
e755619
Update pages/stack/transactions/transaction-finality.mdx
krofax Oct 30, 2024
f9a4bb0
updated text
krofax Oct 30, 2024
4513c5c
fix merge conflict
krofax Oct 30, 2024
99abedd
fix merge conflcits
krofax Oct 30, 2024
8c54927
feat: miscellanous improvements to finality doc
smartcontracts Nov 1, 2024
eda6ab7
Removed passive tones, and rephrased contents
krofax Nov 6, 2024
4c88d3a
replaced image with a mermaid diagram
krofax Nov 6, 2024
241c587
update meta.json
krofax Nov 6, 2024
1a13d97
Fix merge conflict
krofax Nov 6, 2024
c8c3d52
updated meta.json
krofax Nov 6, 2024
76396df
Update pages/stack/transactions/transaction-finality.mdx
krofax Nov 7, 2024
47ad29d
Update pages/stack/transactions/transaction-finality.mdx
krofax Nov 7, 2024
71774a7
Update pages/stack/transactions/transaction-finality.mdx
krofax Nov 7, 2024
816ac38
Update pages/stack/transactions/transaction-finality.mdx
krofax Nov 7, 2024
45a3248
Update pages/stack/transactions/transaction-finality.mdx
krofax Nov 7, 2024
1186141
remove todo
krofax Nov 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
87 changes: 87 additions & 0 deletions pages/stack/protocol/rollup/finality.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
---
title: Transaction Finality
lang: en-US
description: Learn the concept of finality in blockchain systems and the steps involved in achieving transaction settlement.
---

import { Callout } from 'nextra/components'

# Transaction Finality

Transaction finality refers to the point at which a transaction is considered irreversible and is permanently recorded on the blockchain.

## Finality on Ethereum

Ethereum is designed to provide strong transaction finality guarantees. Here's how it works:

* Time Frame: Under typical network conditions, transactions on Ethereum achieves finality in about 15 minutes.
* Consensus Cycles: This finality period is reached after 2 [epochs](https://info.etherscan.com/epoch-in-ethereum/)
* Block Confirmations: During this time, multiple blocks are added to the chain, each providing additional confirmation of the transactions in previous blocks.

This timeframe ensures enough block confirmations to safeguard against reorgs and guarantees secure settlement of transactions.

<Callout type="info">
Reorg refers to a situation where part of the blockchain is replaced, discarding previously confirmed blocks.
</Callout>
krofax marked this conversation as resolved.
Show resolved Hide resolved

## OP Stack Finality

OP Stack derive security from Ethereum. Finality occurs when transaction data is posted to Ethereum's data availability (DA) layer, i.e., **Layer 1 (L1)**.
At this point, the state of the rollup becomes finalized, similar to L1 transaction finality, preventing reorgs at the L2 level.

In OP Stack, transaction finality involves three main stages:

* Unsafe: The L2 sequencer creates a block containing the transaction, but the transaction data hasn't been posted to L1 yet. It's circulated to the L2 network for speed.

* Safe: The sequencer's batcher posts transaction data to L1. Any L2 node can now derive this transaction.

* Finalized: Same as safe, but enough L1 blocks (>65) have passed to ensure the L1 data won't be reorged. This prevents L1 reorgs from affecting the rollup's state and transaction history.

<Callout type="info">
The OP Stack ensures that even if an L2 sequencer produces invalid transactions, the network nodes will reject them, maintaining consensus and security.
</Callout>

## The Settlement Layer

This mechanism allows Ethereum to establish a view of the state on an OP Stack chain:

* Rollup nodes post data to and monitor Ethereum.
* Ethereum processes transactions based on its consensus rules, without knowledge of the L2.
* For L2 to L1 messages (usually withdrawals), the L2 must prove its state's validity.

To ensure the finality of an OP Stack chain's state, wait for transaction finalization on L1.

## Sequencer Reliability

Sequencers are centralized, raising concerns about potential equivocation (lying about block state). However:

* Sequencers and all L2 nodes must follow consensus rules.
* Invalid transactions are rejected by all network nodes.
* This process is similar to how Ethereum and Bitcoin handle transactions.

The L2 state is considered final once a batch is posted to L1 and enough blocks have passed to prevent reorgs.

## Challenge Period

OP Stack rollups use a 7-day withdrawal challenge period for a specific reason:

* L1 has no inherent knowledge of L2.
* For L2 to L1 withdrawals, L1 needs to verify the withdrawal's validity.
* The 7-day period allows time to dispute withdrawal claims.
* The challenge process uses L2 transaction history to verify claim validity.

A successful challenge (a failed withdrawal claim):

* Doesn't impact the L2 state.
* Doesn't cause an L2 reorg.
* Only determines the validity of the specific withdrawal claim.

<Callout type="info">
It's important to understand transaction finality and the challenge period as distinct concepts:

* The 7-day challenge period verifies the validity of L2 transactions during withdrawals to L1. It does not apply to general L2 transaction finality.
* Users can dispute a withdrawal claim by submitting a fraud proof. This ensures invalid withdrawals are identified before the state is finalized on L1.
* A successful challenge impacts only the withdrawal claim and does not delay L2 transaction finality.
* L2 transaction finality is achieved within minutes after data is posted on L1 and confirmed by approximately 65 blocks (\~10 minutes).
* Even if a challenge is successful, it does not cause a reorg or affect transaction finality on the L2.
</Callout>
Binary file added public/img/op-stack/protocol/tx-finality.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ therealbytes
Thirdweb
threadcreate
tility
timeframe
timeseries
Tranfer
trustlessly
Expand Down
Loading