forked from cerc-io/stack-orchestrator
6b62247ef7
* Add an option to pass env file to deploy command * Use env variable mapping in fixturenet-optimism stack * Use default values from checked in env files * Use env variable mapping in mobymask-v2 stack * Update instructions * Add extra hosts in app compose files and update instructions * Add CERC prefix to env variables in fixturenet-optimism stack * Add CERC prefix to env variables in mobymask-v2 stack
103 lines
2.8 KiB
Markdown
103 lines
2.8 KiB
Markdown
# fixturenet-optimism
|
|
|
|
Instructions to setup and deploy L2 fixturenet using [Optimism](https://stack.optimism.io)
|
|
|
|
## Setup
|
|
|
|
Prerequisite: An L1 Ethereum RPC endpoint
|
|
|
|
Clone required repositories:
|
|
|
|
```bash
|
|
laconic-so --stack fixturenet-optimism setup-repositories --exclude cerc-io/go-ethereum
|
|
|
|
# If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories mentioned below and re-run the command
|
|
```
|
|
|
|
Checkout to the required versions and branches in repos:
|
|
|
|
```bash
|
|
# Optimism
|
|
cd ~/cerc/optimism
|
|
git checkout @eth-optimism/sdk@0.0.0-20230329025055
|
|
```
|
|
|
|
Build the container images:
|
|
|
|
```bash
|
|
laconic-so --stack fixturenet-optimism build-containers --include cerc/foundry,cerc/optimism-contracts,cerc/optimism-op-node,cerc/optimism-l2geth,cerc/optimism-op-batcher
|
|
```
|
|
|
|
This should create the required docker images in the local image registry:
|
|
* `cerc/foundry`
|
|
* `cerc/optimism-contracts`
|
|
* `cerc/optimism-l2geth`
|
|
* `cerc/optimism-op-batcher`
|
|
* `cerc/optimism-op-node`
|
|
|
|
## Deploy
|
|
|
|
Create and update an env file to be used in the next step ([defaults](../../config/fixturenet-optimism/l1-params.env)):
|
|
|
|
```bash
|
|
# External L1 endpoint
|
|
CERC_L1_CHAIN_ID=
|
|
CERC_L1_RPC=
|
|
CERC_L1_HOST=
|
|
CERC_L1_PORT=
|
|
|
|
# Credentials for accounts on L1 to send balance to Optimism Proxy contract from
|
|
# (enables them to do transactions on L2)
|
|
CERC_L1_ADDRESS=
|
|
CERC_L1_PRIV_KEY=
|
|
CERC_L1_ADDRESS_2=
|
|
CERC_L1_PRIV_KEY_2=
|
|
```
|
|
|
|
* NOTE: If L1 is running on the host machine, use `host.docker.internal` as the hostname to access the host port
|
|
|
|
Deploy the stack:
|
|
|
|
```bash
|
|
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism --env-file <PATH_TO_ENV_FILE> up
|
|
```
|
|
|
|
The `fixturenet-optimism-contracts` service may take a while (`~15 mins`) to complete running as it:
|
|
1. waits for the 'Merge' to happen on L1
|
|
2. waits for a finalized block to exist on L1 (so that it can be taken as a starting block for roll ups)
|
|
3. deploys the L1 contracts
|
|
|
|
To list down and monitor the running containers:
|
|
|
|
```bash
|
|
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism ps
|
|
|
|
# With status
|
|
docker ps
|
|
|
|
# Check logs for a container
|
|
docker logs -f <CONTAINER_ID>
|
|
```
|
|
|
|
## Clean up
|
|
|
|
Stop all services running in the background:
|
|
|
|
```bash
|
|
laconic-so --stack fixturenet-optimism deploy --include fixturenet-optimism down
|
|
```
|
|
|
|
Clear volumes created by this stack:
|
|
|
|
```bash
|
|
# List all relevant volumes
|
|
docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data"
|
|
|
|
# Remove all the listed volumes
|
|
docker volume rm $(docker volume ls -q --filter "name=.*fixturenet_geth_accounts|.*l1_deployment|.*l2_accounts|.*l2_config|.*l2_geth_data")
|
|
```
|
|
|
|
## Troubleshooting
|
|
|
|
See [Troubleshooting](./README.md#troubleshooting)
|