You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: pages/builders/app-developers/bridging/basics.mdx
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,26 +4,26 @@ lang: en-US
4
4
description: Learn about the fundamentals of sending data and tokens between Ethereum and OP Mainnet.
5
5
---
6
6
7
-
# Bridging Basics
7
+
# Bridging basics
8
8
9
9
OP Mainnet is a "Layer 2" system and is fundamentally connected to Ethereum.
10
10
However, OP Mainnet is also a distinct blockchain with its own blocks and transactions.
11
11
App developers commonly need to move data and tokens between OP Mainnet and Ethereum.
12
12
This process of moving data and tokens between the two networks is called "bridging".
13
13
14
-
## Sending Tokens
14
+
## Sending tokens
15
15
16
16
One of the most common use cases for bridging is the need to send ETH or ERC-20 tokens between OP Mainnet and Ethereum.
17
17
OP Mainnet has a system called the [Standard Bridge](./standard-bridge) that makes it easy to move tokens in both directions.
18
18
If you mostly need to bridge tokens, make sure to check out the [Standard Bridge](./standard-bridge) guide.
19
19
20
-
## Sending Data
20
+
## Sending ata
21
21
22
22
Under the hood, the Standard Bridge is just an application that uses the OP Mainnet [message passing system to send arbitrary data between Ethereum and OP Mainnet](./messaging).
23
23
Applications can use this system to have a contract on Ethereum interact with a contract on OP Mainnet, and vice versa.
24
24
All of this is easily accessible with a simple, clean API.
25
25
26
-
## Next Steps
26
+
## Next steps
27
27
28
28
Ready to start bridging?
29
29
Check out these tutorials to get up to speed fast.
Copy file name to clipboardExpand all lines: pages/builders/app-developers/bridging/custom-bridge.mdx
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ description: Important considerations when building custom bridges for OP Mainne
6
6
7
7
import { Callout } from'nextra/components'
8
8
9
-
# Custom Bridges
9
+
# Custom bridges
10
10
11
11
Custom token bridges are any bridges other than the [Standard Bridge](./standard-bridge).
12
12
You may find yourself in a position where you need to build a custom token bridge because the Standard Bridge doesn't completely support your use case.
@@ -35,7 +35,7 @@ The [Superchain Token List](/chain/tokenlist) exists to help users and developer
35
35
Once you've built and tested your custom bridge, make sure to register any tokens meant to flow through this bridge by [making a pull request against the Superchain Token List repository](https://github.com/ethereum-optimism/ethereum-optimism.github.io#adding-a-token-to-the-list).
36
36
You **must** deploy your bridge to OP Sepolia before it can be added to the Superchain Token List.
37
37
38
-
## Next Steps
38
+
## Next steps
39
39
40
40
You can explore several examples of custom bridges for OP Mainnet:
Copy file name to clipboardExpand all lines: pages/builders/app-developers/bridging/messaging.mdx
+10-10Lines changed: 10 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,7 @@ description: Learn how bridging works between L1 and L2, how to use it, and what
6
6
7
7
import { Callout } from'nextra/components'
8
8
9
-
# Sending Data Between L1 and L2
9
+
# Sending data between L1 and L2
10
10
11
11
Smart contracts on L1 (Ethereum) can interact with smart contracts on L2 (OP Mainnet) through a process called "bridging".
12
12
This page explains how bridging works, how to use it, and what to watch out for.
@@ -16,7 +16,7 @@ This page explains how bridging works, how to use it, and what to watch out for.
16
16
For a step-by-step tutorial on how to send data between L1 and L2, check out the [Solidity tutorial](/builders/app-developers/tutorials/cross-dom-solidity).
17
17
</Callout>
18
18
19
-
## Understanding Contract Calls
19
+
## Understanding contract calls
20
20
21
21
It can be easier to understand bridging if you first have a basic understanding of how contracts on EVM-based blockchains like OP Mainnet and Ethereum communicate within the *same* network.
22
22
The interface for sending messages *between* Ethereum and OP Mainnet is designed to mimic the standard contract communication interface as much as possible.
@@ -57,7 +57,7 @@ Here you're using the [low-level "call" function](https://docs.soliditylang.org/
57
57
Although these two code snippets look a bit different, they're doing the exact same thing.
58
58
Because of limitations of Solidity, **the OP Stack's bridging interface is designed to look like the second code snippet**.
59
59
60
-
## Basics of Communication Between Layers
60
+
## Basics of communication between layers
61
61
62
62
At a high level, the process for sending data between L1 and L2 is pretty similar to the process for sending data between two contracts on Ethereum (with a few caveats).
63
63
Communication between L1 and L2 is made possible by a pair of special smart contracts called the "messenger" contracts.
@@ -121,17 +121,17 @@ contract MyContract {
121
121
You can find the addresses of the `L1CrossDomainMessenger` and the `L2CrossDomainMessenger` contracts on OP Mainnet and OP Sepolia on the [Contract Addresses](/chain/addresses) page.
122
122
</Callout>
123
123
124
-
## Communication Speed
124
+
## Communication speed
125
125
126
126
Unlike calls between contracts on the same blockchain, calls between Ethereum and OP Mainnet are *not* instantaneous.
127
127
The speed of a cross-chain transaction depends on the direction in which the transaction is sent.
128
128
129
-
### For L1 to L2 Transactions
129
+
### For L1 to L2 transactions
130
130
131
131
Transactions sent from L1 to L2 take **approximately 1-3 minutes** to get from Ethereum to OP Mainnet, or from Sepolia to OP Sepolia.
132
132
This is because the Sequencer waits for a certain number of L1 blocks to be created before including L1 to L2 transactions to avoid potentially annoying [reorgs](https://www.alchemy.com/overviews/what-is-a-reorg).
133
133
134
-
### For L2 to L1 Transactions
134
+
### For L2 to L1 transactions
135
135
136
136
Transactions sent from L2 to L1 take **approximately 7 days** to get from OP Mainnet to Ethereum, or from OP Sepolia to Sepolia.
137
137
This is because the bridge contract on L1 must wait for the L2 state to be *proven* to the L1 chain before it can relay the message.
@@ -177,9 +177,9 @@ modifier onlyOwner() {
177
177
}
178
178
```
179
179
180
-
## Fees For Sending Data Between L1 and L2
180
+
## Fees for sending data between L1 and L2
181
181
182
-
### For L1 to L2 Transactions
182
+
### For L1 to L2 transactions
183
183
184
184
The majority of the cost of an L1 to L2 transaction comes from the smart contract execution on L1.
185
185
When sending an L1 to L2 transaction, you send to the [`L1CrossDomainMessenger`](https://github.com/ethereum-optimism/optimism/blob/111f3f3a3a2881899662e53e0f1b2f845b188a38/packages/contracts-bedrock/src/L1/L1CrossDomainMessenger.sol) contract, which then sends a call to the [`OptimismPortal`](https://github.com/ethereum-optimism/optimism/blob/111f3f3a3a2881899662e53e0f1b2f845b188a38/packages/contracts-bedrock/src/L1/OptimismPortal.sol) contract.
@@ -195,7 +195,7 @@ The amount of L1 gas charged increases when more people are sending L1 to L2 tra
195
195
You should always add a buffer of at least 20% to the gas limit for your L1 to L2 transaction to avoid running out of gas.
196
196
</Callout>
197
197
198
-
### For L2 to L1 Transactions
198
+
### For L2 to L1 transactions
199
199
200
200
Each message from L2 to L1 requires three transactions:
201
201
@@ -211,7 +211,7 @@ Each message from L2 to L1 requires three transactions:
211
211
The total cost of an L2 to L1 transaction is therefore the combined cost of the L2 initialization transaction and the two L1 transactions.
212
212
The L1 proof and finalization transactions are typically significantly more expensive than the L2 initialization transaction.
213
213
214
-
## Understanding the Challenge Period
214
+
## Understanding the challenge period
215
215
216
216
One of the most important things to understand about L1 ⇔ L2 interaction is that **mainnet messages sent from Layer 2 to Layer 1 cannot be relayed for at least 7 days**.
217
217
This means that any messages you send from Layer 2 will only be received on Layer 1 after this one week period has elapsed.
0 commit comments