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

DRAFT: docs-how-arbitrum-works #1866

Open
wants to merge 37 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
550131c
reorganized how-arbitrum-works section
pete-vielhaber Nov 21, 2024
6fc2384
consolidated more how arbitrum works content
pete-vielhaber Nov 21, 2024
2f5214d
adjusted sidebars.js
pete-vielhaber Nov 21, 2024
918832c
Restructured content further, added new sections
pete-vielhaber Nov 22, 2024
889117e
cleaned up sidebars.js, yarn format
pete-vielhaber Nov 22, 2024
093259e
Modified docusaurus.config.js
pete-vielhaber Nov 26, 2024
0b95e95
Renaming a few sections, removed dup content, little reorg
pete-vielhaber Dec 4, 2024
401be69
Updating filenames for section headings
pete-vielhaber Dec 4, 2024
76bb181
yarn format cleanup
pete-vielhaber Dec 4, 2024
1016468
fixing sidebars.js
pete-vielhaber Dec 4, 2024
d2fc3f1
vercel having issues with mermaid commented out diagrams
pete-vielhaber Dec 4, 2024
5425991
put arbitrum-sdk at proper pin
pete-vielhaber Dec 4, 2024
339bd1b
adjusted headings to ensure visibility in tree
pete-vielhaber Dec 4, 2024
607bcb1
yarn format cleanup
pete-vielhaber Dec 4, 2024
7f48fe5
fixing broken links due to reorg
pete-vielhaber Dec 4, 2024
3985251
adding frontmatter, cleaning up headings
pete-vielhaber Dec 4, 2024
c706d87
edited nitro v classic to make it more assertive
pete-vielhaber Dec 5, 2024
b5d2bdb
minor adjustments
pete-vielhaber Dec 5, 2024
0d49ca0
archiving nitro v classic/why nitro
pete-vielhaber Dec 10, 2024
5c84a74
resolved conflicts
pete-vielhaber Dec 10, 2024
d09cd63
yarn format
pete-vielhaber Dec 10, 2024
e2c86d3
modified sidebars
pete-vielhaber Dec 10, 2024
2b76466
fixing broken links
pete-vielhaber Dec 10, 2024
c82e3f5
addressing quick hit comments
pete-vielhaber Dec 12, 2024
0d4ccb8
content changes, frontmatter additions
pete-vielhaber Dec 12, 2024
01a7a43
gas & fees content, yarn format
pete-vielhaber Dec 12, 2024
101a7c2
resolving broken links
pete-vielhaber Dec 12, 2024
2ca62c7
Updated frontmatter to be more specific
pete-vielhaber Dec 12, 2024
1810eaa
fix: add imports for mermaid diagram and address aliases
anegg0 Dec 12, 2024
d27dac5
yarn format fixes
pete-vielhaber Dec 13, 2024
b3a7074
resolved vercel issues
pete-vielhaber Dec 13, 2024
ed263db
added mermaid w/html helper
pete-vielhaber Dec 13, 2024
91434eb
rolled back
pete-vielhaber Dec 13, 2024
a2a8197
Merge branch 'master' into docs-haw-reorg
pete-vielhaber Dec 13, 2024
0cec2eb
add'l vercel build issues
pete-vielhaber Dec 13, 2024
ef43d49
fixing vercel build issue within welcome for stylus link
pete-vielhaber Dec 13, 2024
c379532
build issues
pete-vielhaber Dec 13, 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
71 changes: 71 additions & 0 deletions arbitrum-docs/how-arbitrum-works/01-a-gentle-introduction.mdx
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.
Copy link
Contributor

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

Copy link
Contributor Author

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.


## 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:
Copy link
Contributor

Choose a reason for hiding this comment

The 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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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".

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.
Copy link
Contributor

Choose a reason for hiding this comment

The 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).

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
---

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably be a complete front matter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding front matter for all 👍

## Sequencing, Followed by Deterministic Execution

Copy link
Contributor

Choose a reason for hiding this comment

The 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.
This first part serves as a "In a nutshell" (a big nutshell though) section to the rest of the page, since it's summarizing the lifecycle of a transaction.

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.
We'll now 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.

This is no longer an introduction. We can change this a bit to follow that logic.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two more things about this section:

  • The introduction to the section might need some tweaks in the wording. There's a mention to "This overview..." further down.
  • The section is full of broken links. Each link should be tested.

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 👍

Expand Down
Loading
Loading