delayedInbox-l2msg
shows how to send a signed transaction to your chain (also referred to as an L2Message) only using an RPC of the parent chain. This demo has 2 parts:
- how to send a normal signed transaction using the delayed inbox (./scripts/normalTx.js)
- how to withdraw your funds back without sending a transaction directly to the sequencer (./scripts/withdrawFunds.js)
This tutorial also shows the initial step to take if the sequencer is misbehaving. In that case, after 24 hours have passed from the moment the message was sent from the parent chain, you can use the SequencerInbox's forceInclusion
method to move it from the delayed inbox into the core inbox, at which point it's considered finalized.
You can also use the Arbitrum SDK to force include your transaction. See an example here.
Set the values shown in .env-sample
as environmental variables. To copy it into a .env
file:
cp .env-sample .env
You'll still need to edit some variables, i.e., PRIVATE_KEY
, CHAIN_RPC
and PARENT_CHAIN_RPC
.
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.
Normal transaction:
yarn normalTx
Withdraw funds:
yarn withdrawFunds