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: packages/gas-estimation/README.md
+15-11Lines changed: 15 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,27 +2,31 @@
2
2
3
3
`gas-estimation` is a simple demo of how a developer can estimate transaction fees on Arbitrum.
4
4
5
-
It uses the formula described in this Medium article to estimate the fees to be paid on a transaction, also estimating each component of the formula sepparately: [Understanding Arbitrum: 2-Dimensional Fees](https://medium.com/offchainlabs/understanding-arbitrum-2-dimensional-fees-fd1d582596c9).
5
+
It uses the formula described in this Medium article to estimate the fees to be paid on a transaction, also estimating each component of the formula sepparately: [Understanding Arbitrum: 2-Dimensional Fees](https://medium.com/offchainlabs/understanding-arbitrum-2-dimensional-fees-fd1d582596c9). For more information, you can also see [How to estimate gas](https://docs.arbitrum.io/build-decentralized-apps/how-to-estimate-gas) in the Arbitrum documentation portal.
6
6
7
7
See [./exec.ts](./scripts/exec.ts) for inline explanations.
8
8
9
-
Inside the script, you can edit `txData` constant to suit your needs.
10
-
11
-
To run:
12
-
13
-
```
14
-
yarn run exec
15
-
```
16
-
17
-
## Config Environment Variables
9
+
## Set environment variables
18
10
19
11
Set the values shown in `.env-sample` as environmental variables. To copy it into a `.env` file:
20
12
21
13
```bash
22
14
cp .env-sample .env
23
15
```
24
16
25
-
(you'll still need to edit some variables, i.e., `L2RPC`)
17
+
You'll still need to edit some variables, i.e., `CHAIN_RPC`.
18
+
19
+
Note that you can also set the environment variables in an `.env` file in the root of the monorepo, which will be available in all tutorials.
20
+
21
+
## Run
22
+
23
+
Inside the script, you can edit the `txData` constant to suit your needs.
// NodeInterface.GasEstimateComponents() and get the third element => result[2]
46
48
// L2G (L2 Gas used) => Will depend on the transaction itself
47
49
// L1P (L1 estimated calldata price per byte) =>
48
-
// (this is the L2's estimated view of the current L1's price per byte of data, which the L2 dynamically adjusts over time)
50
+
// (this is the child-chain's estimated view of the current parent-chain's price per byte of data, which the child-chain dynamically adjusts over time)
49
51
// ArbGasInfo.getL1BaseFeeEstimate() and multiply by 16
50
52
// ArbGasInfo.getL1GasPriceEstimate() and multiply by 16
51
53
// ArbGasInfo.getPricesInWei() and get the second element => result[1]
52
54
// NodeInterface.GasEstimateL1Component() and get the third element and multiply by 16 => result[2]*16
53
55
// NodeInterface.GasEstimateComponents() and get the fourth element and multiply by 16 => result[3]*16
54
-
// L1S (Size in bytes of the calldata to post on L1) =>
56
+
// L1S (Size in bytes of the calldata to post on the parent chain) =>
55
57
// Will depend on the size (in bytes) of the calldata of the transaction
56
58
// We add a fixed amount of 140 bytes to that amount for the transaction metadata (recipient, nonce, gas price, ...)
57
59
// Final size will be less after compression, but this calculation gives a good estimation
Copy file name to clipboardExpand all lines: packages/greeter/README.md
+17-13Lines changed: 17 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,30 +1,34 @@
1
-
# Greeter Tutorial
1
+
# Greeter tutorial
2
2
3
-
`greeter` is a simple demo of Arbitrum's L1-to-L2 message passing system (aka "retryable tickets").
3
+
`greeter` is a simple demo of Arbitrum's Parent-to-child message passing system (aka "L1-to-L2" or "retryable tickets").
4
4
5
-
It deploys 2 contracts - one to L1, and another to L2, and has the L1 contract send a message to the L2 contract to be executed automatically.
5
+
It deploys 2 contracts - one to the parent chain, and another to the child chain, and has the parent chain contract send a message to the child chain contract to be executed automatically.
6
6
7
-
The script and contracts demonstrate how to interact with Arbitrum's core bridge contracts to create these retryable messages, how to calculate and forward appropriate fees from L1 to L2, and how to use Arbitrum's L1-to-L2 message [address aliasing](https://developer.offchainlabs.com/docs/l1_l2_messages#address-aliasing).
7
+
The script and contracts demonstrate how to interact with Arbitrum's core bridge contracts to create these retryable messages, how to calculate and forward appropriate fees from parent to child, and how to use Arbitrum's Parent-to-child message [address aliasing](https://docs.arbitrum.io/how-arbitrum-works/arbos/l1-l2-messaging#address-aliasing).
8
8
9
9
See [./exec.js](./scripts/exec.js) for inline explanation.
10
10
11
-
[Click here](https://developer.offchainlabs.com/docs/l1_l2_messages) for more info on retryable tickets.
11
+
[Click here](https://docs.arbitrum.io/how-arbitrum-works/arbos/l1-l2-messaging) for more info on retryable tickets.
12
12
13
-
### Run Demo:
14
-
15
-
```
16
-
yarn run greeter
17
-
```
18
-
19
-
## Config Environment Variables
13
+
## Set environment variables
20
14
21
15
Set the values shown in `.env-sample` as environmental variables. To copy it into a `.env` file:
22
16
23
17
```bash
24
18
cp .env-sample .env
25
19
```
26
20
27
-
(you'll still need to edit some variables, i.e., `DEVNET_PRIVKEY`)
21
+
You'll still need to edit some variables, i.e., `PRIVATE_KEY`, `CHAIN_RPC` and `PARENT_CHAIN_RPC`.
22
+
23
+
Note that you can also set the environment variables in an `.env` file in the root of the monorepo, which will be available in all tutorials.
0 commit comments