Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8) Co-authored-by: Adw8 <adwaitgharpure@gmail.com> Reviewed-on: #4 Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
4.3 KiB
fixturenet-optimism (L2-only)
Instructions to setup and deploy L2 fixturenet using Optimism
Prerequisite: An L1 Ethereum RPC endpoint (with unprotected txs enabled)
Setup
Clone the stack repo:
laconic-so fetch-stack git.vdb.to/cerc-io/fixturenet-optimism-stack
Clone required repositories:
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism setup-repositories
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove concerned repositories and re-run the command
Build the container images:
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism build-containers
This should create the required docker images in the local image registry:
cerc/optimism-contracts
cerc/optimism-l2geth
cerc/optimism-op-node
cerc/optimism-op-batcher
cerc/optimism-op-proposer
Create a deployment
First, create a spec file for the deployment, which will map the stack's ports and volumes to the host:
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy init --map-ports-to-host any-fixed-random --output fixturenet-optimism-spec.yml
Ports and Data volumes
The default port and volume mappings to host can be customized by editing the "spec" file generated by laconic-so deploy init
Once you've made any needed changes to the spec file, create a deployment from it:
laconic-so --stack ~/cerc/fixturenet-optimism-stack/stack/fixturenet-optimism deploy create --spec-file fixturenet-optimism-spec.yml --deployment-dir fixturenet-optimism-deployment
Set chain env variables
Inside the deployment directory, open the file config.env
and add the following variables to point the stack at your L1 rpc and provide account credentials (defaults):
# External L1 endpoint
CERC_L1_CHAIN_ID=
CERC_L1_RPC=
CERC_L1_HOST=
CERC_L1_PORT=
# External L1 Beacon node endpoint
CERC_L1_BEACON=
# URL to get CSV with credentials for accounts on L1
# that are used to send balance to Optimism Proxy contract
# (enables them to do transactions on L2)
CERC_L1_ACCOUNTS_CSV_URL=
# OR
# Specify the required account credentials for the Admin account
# Other generated accounts will be funded from this account, so it should contain ~20 Eth
CERC_L1_ADDRESS=
CERC_L1_PRIV_KEY=
# Optional
# Funding amounts for proposer and batcher accounts on L1
# (Accounts funded using the Admin account)
CERC_PROPOSER_AMOUNT=
CERC_BATCHER_AMOUNT=
- NOTE: If L1 is running on the host machine, use
host.docker.internal
as the hostname to access the host port, or use theip a
command to find the IP address of thedocker0
interface (this will usually be something like172.17.0.1
or172.18.0.1
)
Start the stack
Start the deployment:
laconic-so deployment --dir fixturenet-optimism-deployment start
- The stack will check for a response from the L1 endpoint specified in your env file
- The
fixturenet-optimism-contracts
service will configure and deploy the Optimism contracts to L1, exiting when complete. This may take several minutes; you can follow the progress by following the container's logs (see below) - The
op-node
andop-geth
services will initialize themselves (if not already initialized) and start - The remaining services,
op-batcher
andop-proposer
will start
Logs
To list and monitor the running containers:
laconic-so --stack fixturenet-optimism deploy ps
# With status
docker ps
# Check logs for a container
docker logs -f <CONTAINER_ID>
Example
Try out the example to bridge ETH from L1 to L2
Note: Use external L1 endpoint as L1_RPC
and add flag --add-host="host.docker.internal:host-gateway"
to docker run
commands if necessary
Clean up
To stop all L2 services running in the background, while preserving chain data:
laconic-so deployment --dir fixturenet-optimism-deployment stop
To stop all L2 services and also delete chain data:
laconic-so deployment --dir fixturenet-optimism-deployment stop --delete-volumes
Troubleshooting
See Troubleshooting