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
@@ -45,110 +45,144 @@ Note that this tutorial provides step-by-step instructions for transferring `Sup
45
45
Cross-chain transfers cannot be reversed.
46
46
</Callout>
47
47
48
-
### What you'll build
49
-
50
-
* A TypeScript application to transfer `SuperchainERC20` tokens between chains
48
+
<details>
49
+
<summary>About this tutorial</summary>
51
50
52
-
### What you'll learn
51
+
**What you'll learn**
53
52
54
-
* How to send `SuperchainERC20` tokens on the blockchain and between blockchains
55
-
* How to relay messages between chains
53
+
* How to send `SuperchainERC20` tokens on the blockchain and between blockchains
54
+
* How to relay messages between chains
56
55
57
-
## Prerequisites
56
+
**Technical knowledge**
58
57
59
-
Before starting this tutorial, ensure your development environment meets the following requirements:
58
+
* Intermediate TypeScript knowledge
59
+
* Understanding of smart contract development
60
+
* Familiarity with blockchain concepts
60
61
61
-
### Technical knowledge
62
+
**Development environment**
62
63
63
-
*Intermediate TypeScript knowledge
64
-
*Understanding of smart contract development
65
-
*Familiarity with blockchain concepts
64
+
*Unix-like operating system (Linux, macOS, or WSL for Windows)
65
+
*Node.js version 16 or higher
66
+
*Git for version control
66
67
67
-
### Development environment
68
+
**Required tools**
68
69
69
-
* Unix-like operating system (Linux, macOS, or WSL for Windows)
70
-
* Node.js version 16 or higher
71
-
* Git for version control
70
+
The tutorial uses these primary tools:
72
71
73
-
### Required tools
72
+
* Node: For running TypeScript code from the command line
73
+
* Viem: For blockchain interaction
74
+
</details>
74
75
75
-
The tutorial uses these primary tools:
76
+
### What you'll build
76
77
77
-
* Foundry: For issuing transactions
78
-
* TypeScript: For implementation
79
-
* Node: For running TypeScript code from the command line
80
-
* Viem: For blockchain interaction
78
+
* Commands to transfer `SuperchainERC20` tokens between chains
79
+
* A TypeScript application to transfer `SuperchainERC20` tokens between chains
81
80
82
81
## Directions
83
82
84
83
<Steps>
85
84
### Preparation
86
85
87
-
You need onchain `SuperchainERC20` tokens.
88
-
You can [deploy your own token](./deploy-superchain-erc20), but in this tutorial we will use [`CustomSuperchainToken`](https://sid.testnet.routescan.io/address/0xF3Ce0794cB4Ef75A902e07e5D2b75E4D71495ee8), existing `SuperchainERC20` token on the [Interop devnet](/interop/tools/devnet).
86
+
1. If you are using Supersim, setup the [SuperchainERC20 starter kit](/app-developers/starter-kit#setup).
87
+
The `pnpm dev` step also starts Supersim.
89
88
90
-
1.Create environment variables for the RPC endpoints for the blockchains and the token address.
89
+
2.Store the configuration in environment variables.
When using `CustomSuperchainToken`, there are two ways to do this:
145
+
### Transfer tokens using the command line
127
146
128
-
* Use the [block explorer](https://sid.testnet.routescan.io/address/0xF3Ce0794cB4Ef75A902e07e5D2b75E4D71495ee8/contract/420120000/writeContract?chainid=420120000) and a browser wallet to run the [faucet](https://sid.testnet.routescan.io/address/0xF3Ce0794cB4Ef75A902e07e5D2b75E4D71495ee8/contract/420120000/writeContract?chainid=420120000#F6) function.
3. Call [`SuperchainTokenBridge`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainTokenBridge.sol)to transfer tokens.
We are going to use a [Node](https://nodejs.org/en) project, to be able to use [`@eth-optimism/viem`](https://www.npmjs.com/package/@eth-optimism/viem) to send the executing message.
149
177
We use [TypeScript](https://www.typescriptlang.org/) to have [type safety](https://en.wikipedia.org/wiki/Type_safety) combined with JavaScript functionality.
150
178
151
-
1. Initialize a new Node project.
179
+
1.Exportenvironmentvariables
180
+
181
+
```sh
182
+
export PRIVATE_KEY TOKEN_ADDRESS CHAIN_B_ID
183
+
```
184
+
185
+
2. Initialize a new Node project.
152
186
153
187
```sh
154
188
mkdir xfer-erc20
@@ -158,69 +192,25 @@ The tutorial uses these primary tools:
158
192
mkdir src
159
193
```
160
194
161
-
2. Edit `package.json` to add the `start` script.
162
-
163
-
```json
164
-
{
165
-
"name": "xfer-erc20",
166
-
"version": "1.0.0",
167
-
"main": "index.js",
168
-
"scripts": {
169
-
"test": "echo \"Error: no test specified\" && exit 1",
Use `@eth-optimism/viem`'s `walletActionsL2().sendSuperchainERC20` to send the `SuperchainERC20` tokens.
198
207
Internally, this function calls [`SuperchainTokenBridge.sendERC20`](https://github.com/ethereum-optimism/optimism/blob/develop/packages/contracts-bedrock/src/L2/SuperchainTokenBridge.sol#L52-L78) to send the tokens.
title: L1 Pectra user fees and chain profitability
3
+
description: L1 Pectra affect on user fees and chain profitability analysis
4
+
lang: en-US
5
+
content_type: notice
6
+
topic: pectra-fees
7
+
personas:
8
+
- chain-operator
9
+
- node-operator
10
+
categories:
11
+
- security
12
+
- protocol
13
+
- infrastructure
14
+
- l1-contracts
15
+
is_imported_content: 'false'
16
+
---
17
+
18
+
import { Callout } from'nextra/components'
19
+
20
+
# Pectra impact on user fees and chain profitability
21
+
22
+
The Ethereum L1 Pectra upgrade has introduced changes to calldata gas costs via [EIP-7623](https://eips.ethereum.org/EIPS/eip-7623) that may affect OP Stack chain profitability in specific configurations and market conditions. This notice outlines the potential impact on your chain and recommends specific actions.
23
+
24
+
[EIP-7623](https://eips.ethereum.org/EIPS/eip-7623) increases the amount of gas payable for calldata-heavy transactions. These include such transactions as those used by OPStack chains *before the [Ecotone upgrade](https://specs.optimism.io/protocol/ecotone/overview.html)* when blob data availability (blob DA) was introduced.
25
+
26
+
Blob DA has now been the default and recommended option for the OPStack for some time, so almost all chains make use of it. In order to continue to optimize for chains operating with blob DA, the Optimism protocol's current DA fee pricing formula has remained unchanged despite Pectra activating on Ethereum. This has allowed chains using blob DA to continue without updating their fee config.
27
+
28
+
Chains configured for blob data availability remain entirely unaffected by the Pectra upgrade. However, chains configured for calldata (i.e. operating in a legacy DA mode) may experience a reduction in profitability. It is possible for such chains to be making a loss on data availability costs under certain market conditions. Therefore all chains should check their fee scalar config.
29
+
30
+
## Actions required
31
+
32
+
Since the Ecotone upgrade, the Optimism protocol prices L2 transactions using a function that incorporates the L1 base fee as well as the L1 blob base fee. The other inputs are the so-called "Ecotone scalars": operator-controlled parameters stored in the SystemConfig contract which can be used to tune the chain's (approximate) target profit margin for DA.
33
+
34
+
Please review your [Ecotone scalar chain configuration](/operators/chain-operators/management/blobs).
35
+
36
+
<Callouttype="info">
37
+
If your chain uses a zero blob base fee scalar, meaning it's configured to price for calldata only, you may need to update the base fee scalar and/or the blob base fee scalar. Otherwise, no action is necessary and the rest of this section does not apply.
38
+
</Callout>
39
+
40
+
### Chains charging for calldata DA and spending on calldata DA
41
+
If your chain uses a zero blob base fee scalar and your batcher is configured to submit using calldata *only*, then you should take the opportunity to check your chain's profit margin according to [this guide](/operators/chain-operators/management/blobs) and make any adjustments to your Ecotone scalars as necessary. This will ensure that, since you are paying exclusively for calldata DA, you are charging users appropriately such that your target profit margin is as desired.
42
+
43
+
If your profit margin was perfectly tuned before Pectra, then you should scale your base fee scalar by 10/4.
44
+
45
+
### Chains charging for calldata DA and spending on blob DA
46
+
If your chain uses a zero blob base fee scalar and your batcher is configured to submit using blob DA, or configured to automatically choose the cheaper of the two DA modes, then you should adjust your Ecotone scalars for blob DA pricing (meaning a nonzero blob base fee scalar). You are referred back to [this guide](/operators/chain-operators/management/blobs). Doing so will ensure that you are charging accurately for using blob DA. Without such a change it is likely that you are overcharging users most of the time, and undercharging them in the rare occasions where blob DA is more expensive than calldata DA on Ethereum mainnet.
47
+
48
+
As ever, you may continue to tweak the Ecotone scalars as desired in order to adjust the profitability of your chain.
@@ -121,6 +121,10 @@ blobs back to using calldata.
121
121
to get a better estimate for scalar values on your chain. The following
122
122
information is tuned to a network like OP Mainnet.
123
123
124
+
<Callouttype="warning">
125
+
Since the Pectra upgrade on L1, chains which exclusively use calldata DA need to scale up their BaseFeeScalar by 10/4. See [this notice](/notices/pectra-fees).
126
+
</Callout>
127
+
124
128
Chains can update their fees to increase or decrease their margin. If using calldata, then `BaseFeeScalar` should be scaled to achieve the desired margin.
125
129
For example, to increase your L1 Fee margin by 10%:
126
130
@@ -145,6 +149,10 @@ blobs back to using calldata.
145
149
* Ensure your `OP_BATCHER_MAX_CHANNEL_DURATION` is properly set to maximize savings. **NOTE:** While setting a high value here will lower costs, it will be less meaningful than for low throughput chains using blobs. See [OP Batcher Max Channel Configuration](/operators/chain-operators/configuration/batcher#set-your--op_batcher_max_channel_duration) for more details.
146
150
</Steps>
147
151
152
+
## Use auto DA mode in your batcher
153
+
The batcher now supports automatically switching from blobs to calldata depending on which DA type is more affordable. This is an optimization which allows for a slightly better DA profit margin for your chain.
154
+
To enable this mode, set `OP_BATCHER_DATA_AVAILABILITY_TYPE=auto`.
155
+
148
156
## Other considerations
149
157
150
158
* For information on L1 Data Fee changes related to the Ecotone upgrade, visit the [Transaction Fees page](/stack/transactions/fees#ecotone).
0 commit comments