Skip to content

Module 1 - Preparing Configuration & Basic Setup

In this module, we’ll prepare the configuration for your L2 and set up the basic environment needed to get started.

Before setting up your L2, you need to decide on a few key parameters:

  1. Choose a Chain ID that uniquely identifies your chain (will be used for MetaMask setup later)

    • Example: 1002
  2. Select a Genesis Address that will receive the initial token supply

    • Example: 0xf0e0CA2704D047A7Af27AafAc6D70e995520C2B2
  3. Determine the Genesis Balance (initial token supply)

    • Example: 1000000000000000000000000

Clone the Rome setup repository:

Terminal window
git clone --branch v0.3.0 --single-branch https://github.com/rome-labs/rome-setup.git

If you’re using Ubuntu, you can directly pull the pre-built Docker images:

Terminal window
docker pull romelabs/rollup-op-geth:v0.3.0
docker pull romelabs/rome-apps:v0.3.0
docker pull romelabs/rome-evm:v0.3.0

If you’re not using Ubuntu, you’ll need to build the Docker images locally:

Terminal window
# Clone required repositories
git clone --branch v0.3.0 https://github.com/rome-labs/rome-apps.git
git clone --branch v0.3.0 https://github.com/rome-labs/rome-sdk.git
git clone --branch v0.3.0 https://github.com/rome-labs/rome-evm.git
# Build the rome-apps image
docker buildx build -t romelabs/rome-apps:v0.3.0 -f rome-apps/docker/Dockerfile .

For the OP Geth image:

Terminal window
# Clone required repositories
git clone --branch v0.3.0 https://github.com/rome-labs/rome-rollup-clients.git
git clone --branch v0.3.0 https://github.com/rome-labs/op-geth.git
# Build the OP Geth image
docker buildx build -t romelabs/rollup-op-geth:v0.3.0 -f ./rome-rollup-clients/op-geth/Dockerfile .

Step 4: Create Dockerfile for Non-Ubuntu Users

Section titled “Step 4: Create Dockerfile for Non-Ubuntu Users”

If you’re not using Ubuntu, you’ll need to create a Dockerfile in the rome-rollup-clients/op-geth directory:

FROM --platform=$BUILDPLATFORM golang:1.21.6-alpine AS builder
WORKDIR /app
# Install build dependencies
RUN apk add --no-cache git make gcc musl-dev linux-headers
# Set up cross-compilation
ENV GOOS=linux
ENV GOARCH=amd64
ENV CGO_ENABLED=0
COPY ../../op-geth /app/op-geth
RUN cd op-geth && make geth
FROM --platform=$TARGETPLATFORM nginx:alpine AS run
WORKDIR /app
ENV GETH_NAME="op-geth"
ENV HTTP_PORT="8545"
ENV ENGINE_PORT="8551"
ENV DISCOVERY_PORT="30303"
ENV GETH_BINARY="/usr/local/bin/geth"
ENV GETH_BASE_DATA_DIR="/app/.ethereum"
ENV PORT="3000"
# Install bash, OpenSSL, Node.js, and ts-node
RUN apk add --no-cache bash openssl nodejs npm
# Copy the Geth binary, Nginx configuration, SSL generation script, and other necessary files
COPY --from=builder /app/op-geth/build/bin/geth /usr/local/bin/geth
COPY rome-rollup-clients/op-geth/scripts scripts
COPY rome-rollup-clients/op-geth/nginx.conf /etc/nginx/nginx.conf
COPY rome-rollup-clients/op-geth/run.sh ./run.sh
# Expose ports for Nginx and Express server
EXPOSE 80
EXPOSE 443
# Start Geth, Nginx, and the Express server using ts-node
CMD ["bash", "./run.sh"]