-
Notifications
You must be signed in to change notification settings - Fork 352
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
DRAFT: docs-how-arbitrum-works #1866
base: master
Are you sure you want to change the base?
Changes from 23 commits
550131c
6fc2384
2f5214d
918832c
889117e
093259e
0b95e95
401be69
76bb181
1016468
d2fc3f1
5425991
339bd1b
607bcb1
7f48fe5
3985251
c706d87
b5d2bdb
0d49ca0
5c84a74
d09cd63
e2c86d3
2b76466
c82e3f5
0d4ccb8
01a7a43
101a7c2
2ca62c7
1810eaa
d27dac5
b3a7074
ed263db
91434eb
a2a8197
0cec2eb
ef43d49
c379532
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
--- | ||
title: 'A gentle introduction' | ||
description: 'Learn the fundamentals of Nitro, Arbitrum stack.' | ||
author: dzgoldman | ||
sme: dzgoldman | ||
user_story: As a current or prospective Arbitrum user, I need learn more about Nitros design. | ||
content_type: get-started | ||
--- | ||
|
||
import ImageWithCaption from '@site/src/components/ImageCaptions/'; | ||
|
||
This document is a deep-dive explanation of Arbitrum Nitro’s design and the rationale for it. This isn’t API documentation, nor is it a guided tour of the code--look elsewhere for those. “Inside Arbitrum Nitro” is for people who want to understand Nitro's design. | ||
|
||
The body of this document will describe Arbitrum Rollup, the primary use case of the Nitro technology and the one used on the Arbitrum One chain. There is a variant use case, called AnyTrust, which is used by the Arbitrum Nova chain. AnyTrust is covered by a section at the end of this document. | ||
|
||
## Why use Arbitrum? Why use Nitro? | ||
|
||
Arbitrum is an L2 scaling solution for Ethereum, offering a unique combination of benefits: | ||
|
||
- Trustless security: security rooted in Ethereum, with any one party able to ensure correct Layer 2 results | ||
- Compatibility with Ethereum: able to run unmodified EVM contracts and unmodified Ethereum transactions | ||
- Scalability: moving contracts’ computation and storage off of the main Ethereum chain, allowing much higher throughput | ||
- Minimum cost: designed and engineered to minimize the L1 gas footprint of the system, minimizing per-transaction cost. | ||
|
||
Some other Layer 2 systems provide some of these features, but to our knowledge no other system offers the same combination of features at the same cost. | ||
|
||
Nitro is a major upgrade to Arbitrum, improving over "classic" Arbitrum in several ways: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We could rephrase this to remove the mention to "Classic". Something like "Some of the features included in Arbitrum Nitro are:" (probably changing "features" to something different, since it's used a lot in the previous paragraph. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will rephrase |
||
|
||
- **Advanced Calldata Compression,** which further drives down transaction costs on Arbitrum by reducing the amount of data posted to L1. | ||
- **Separate Contexts For Common Execution and Fault Proving,** increasing the performance of L1 nodes, and thus offering lower fees. | ||
- **Ethereum L1 Gas Compatibility,** bringing pricing and accounting for EVM operations perfectly in line with Ethereum. | ||
- **Additional L1 Interoperability,** including tighter synchronization with L1 Block numbers, and full support for all Ethereum L1 precompiles. | ||
- **Safe Retryables,** eliminating the failure mode where a retryable ticket fails to get created. | ||
- **Geth Tracing,** for even broader debugging support. | ||
- And many, many more changes. | ||
|
||
## The Big Picture | ||
|
||
At the most basic level, an Arbitrum chain works like this: | ||
|
||
<ImageWithCaption | ||
caption="Original napkin sketch drawn by Arbitrum co-founder Ed Felten" | ||
src="https://lh4.googleusercontent.com/qwf_aYyB1AfX9s-_PQysOmPNtWB164_qA6isj3NhkDnmcro6J75f6MC2_AjlN60lpSkSw6DtZwNfrt13F3E_G8jdvjeWHX8EophDA2oUM0mEpPVeTlMbsjUCMmztEM0WvDpyWZ6R" | ||
/> | ||
|
||
Users and contracts put messages into the inbox. The chain reads the messages one at a time, and processes each one. This updates the state of the chain and produces some outputs. | ||
|
||
If you want an Arbitrum chain to process a transaction for you, you need to put that transaction into the chain’s inbox. Then the chain will see your transaction, execute it, and produce some outputs: a transaction receipt, and any withdrawals that your transaction initiated. | ||
|
||
Execution is deterministic -- which means that the chain’s behavior is uniquely determined by the contents of its inbox. Because of this, the result of your transaction is knowable as soon as your transaction has been put in the inbox. Any Arbitrum node will be able to tell you the result. (And you can run an Arbitrum node yourself if you want.) | ||
|
||
All of the technical detail in this document is connected to this diagram. To get from this diagram to a full description of Arbitrum, we’ll need to answer questions like these: | ||
|
||
- Who keeps track of the inbox, chain state, and outputs? | ||
- How does Arbitrum make sure that the chain state and outputs are correct? | ||
- How can Ethereum users and contracts interact with Arbitrum? | ||
- How does Arbitrum support Ethereum-compatible contracts and transactions? | ||
- How are ETH and tokens transferred into and out of Arbitrum chains, and how are they managed while on the chain? | ||
- How can I run my own Arbitrum node or validator? | ||
|
||
## Nitro's Design: The Four Big Ideas | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if we want to do this in this PR, but this document (and the whole "How Arbitrum works" section) has always needed a revision based on the current Style conventions. For example, titles should be in "sentence-case", in this case "Nitro's design: the four big ideas". There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I agree, there are Style conventions that need addressed. As this effort is mainly to restructure, to stage for the major update coming close behind (where we will enforce Style conv) |
||
|
||
The essence of Nitro, and its key innovations, lie in four big ideas. We'll list them here with a very quick summary of each, then we'll unpack them in more detail in later sections. | ||
|
||
**Big Idea: Sequencing, Followed by Deterministic Execution**: Nitro processes transactions with a two-phase strategy. First, the transactions are organized into a single ordered sequence, and Nitro commits to that sequence. Then the transactions are processed, in that sequence, by a deterministic state transition function. | ||
|
||
**Big Idea: Geth at the Core**: Nitro supports Ethereum's data structures, formats, and virtual machine by compiling in the core code of the popular go-ethereum ("Geth") Ethereum node software. Using Geth as a library in this way ensures a very high degree of compatibility with Ethereum. | ||
|
||
**Big Idea: Separate Execution from Proving**: Nitro takes the same source code and compiles it twice, once to native code for execution in a Nitro node, optimized for speed, and again to WASM for use in proving, optimized for portability and security. | ||
|
||
**Big Idea: Optimistic Rollup with Interactive Fraud Proofs**: Nitro settles transactions to the Layer 1 Ethereum chain using an optimistic rollup protocol, including the interactive fraud proofs pioneered by Arbitrum. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The article's last part could be a transition to the next piece (transaction lifecycle). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will add a transitional paragraph after the four big ideas |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,4 +1,26 @@ | ||||||
# Overview: The Lifecycle of an Arbitrum Transaction | ||||||
--- | ||||||
title: Transaction Lifecycle | ||||||
--- | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably be a complete front matter. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Adding front matter for all 👍 |
||||||
## Sequencing, Followed by Deterministic Execution | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be the section of the page, to align with the 4 big ideas mentioned in the Introduction. The second part of the page goes into much more detail than this, so as a reader, I'd like to know that this bit is going to introduce me to what's going to be explained more in detail afterwards. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll rename the page to "Sequencing..." As to separate the first and second halves of the doc, currently the second section is "Overview: The lifecycle..." since this is a deeper technical breakdown, I'm going to rename this to: "Deep dive: The lifecycle" to delineate the "summary/top" from the "technical/bottom" |
||||||
This diagram summarizes how transactions are processed in Nitro. | ||||||
|
||||||
![seq-then-exec](../assets/seq-then-exec.png) | ||||||
|
||||||
Let's follow a user's transaction through this process. | ||||||
|
||||||
First, the user creates a transaction, uses their wallet to sign it, and sends it to the Nitro chain's Sequencer. The Sequencer's job, as its name implies, is to take the arriving transactions, put them into an ordered sequence, and publish that sequence. | ||||||
|
||||||
Once the transactions are sequenced, they are run through the _state transition function_, one by one, in order. The state transition function takes as input the current state of the chain (account balances, contract code, and so on), along with the next transaction. It updates the state and sometimes emits a new Layer 2 block on the Nitro chain. | ||||||
|
||||||
Because the protocol doesn't trust the Sequencer not to put garbage into its sequence, the state transition function will detect and discard any invalid (e.g., improperly formed) transactions in the sequence. A well-behaved Sequencer will filter out invalid transactions so the state transition function never sees them--and this reduces cost and therefore keeps transactions fees low--but Nitro will still work correctly no matter what the Sequencer puts into its feed. (Transactions in the feed are signed by their senders, so the Sequencer can't create forged transactions.) | ||||||
|
||||||
The state transition function is deterministic, which means that its behavior depends only on the current state and the contents of the next transaction--and nothing else. Because of this determinism, the result of a transaction T will depend only on the genesis state of the chain, the transactions before T in the sequence, and T itself. | ||||||
|
||||||
It follows that anyone who knows the transaction sequence can compute the state transition function for themselves--and all honest parties who do this are guaranteed to get identical results. This is the normal way that Nitro nodes operate: get the transaction sequence, and run the state transition function locally. No consensus mechanism is needed for this. | ||||||
|
||||||
## Overview: The Lifecycle of an Arbitrum Transaction | ||||||
|
||||||
pete-vielhaber marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
As an introduction to the various components that compose the Arbitrum protocol, we'll go step-by-step over the phases an Arbitrum transaction goes through, starting with a client creating a signed transaction, to it ultimately being confirmed back on layer 1. | ||||||
|
||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
This is no longer an introduction. We can change this a bit to follow that logic. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Two more things about this section:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressing phrasing. A few things are a little confusing like referring to phases but this will be resolved in the next iteration. Will test links 👍 |
||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last sentence about AnyTrust could be updated, and have a link to the AnyTrust specific page
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed last sentence since it's not in "this document." Added a link to AnyTrust in the previous sentence where AnyTrust is mentioned.