Build and Run Using Docker

Download L2geth

  1. Build the container using make mockccc_docker. This will produce the image scrolltech/l2geth:latest.

    Alternatively, you can download the l2geth Docker image using docker pull scrolltech/l2geth:scroll-v5.8.42(currently not supported arm64 architecture, if you runs on arm64 server, you can build it from source). In this case, substitute this image name in the commands below.

Run L2geth

  1. Hardware specs - CPU: AWS t3.2xlarge (or equivalent); Disk: 4TB gp3 SSD.

    Currently the archive snapshot contains all the historical data, it’s nearly 2TB, if you download and unarchive it on one disk, it needs at least 4TB volume, or you can download it to EFS and unarchive it to EBS, not supoorts to run the geth datadir on EFS or other network storage. Geth node needs at least 16GB memory, and 4 cores of CPU. We recommond you run the geth node on AWS t3.2xlarge type.

  2. prepare the snapshot first

    for mpt nodes:

    SNAPSHOT_URL = https://scroll-geth-snapshot.s3.us-west-2.amazonaws.com/mpt/latest.tar

    mkdir l2geth-mpt && pushd l2geth-mpt
    wget $SNAPSHOT_URL 
    # unarchive the tar file
    tar -xf latest.tar
    popd
    
  3. Run the l2geth container by docker-compose, following is the compose file, you can run docker compose up -d to start the node.

    Note: for MPT nodes simply add --scroll-mpt flag to the command field in your docker-compose.yaml

    $ cat docker-compose.yaml
    ---
    version: '3'
    services:
      l2geth:
        image: scrolltech/l2geth:scroll-v5.8.42
        container_name: l2geth-docker
        stop_signal: SIGINT
        stop_grace_period: 60s
        restart: "unless-stopped"
        environment:
          - CHAIN_ID=534352
          - RUST_LOG="info"
        volumes:
          - 'l2geth/data:/volume/l2geth/data'
        ports:
          - 8545:8545
          - 8546:8546
          - 6060:6060
          - 30303:30303
          - 30303:30303/udp
        # mpt type
        command: --scroll --scroll-mpt --cache.snapshot=0 --snapshot=false --metrics --pprof --pprof.addr "0.0.0.0" --pprof.port 6060 --datadir "/volume/l2geth/data" --gcmode archive --http --http.addr "0.0.0.0" --http.port 8545 --http.api "eth,net,web3,debug,scroll" --cache.noprefetch --l1.endpoint  "<https://rpc.ankr.com/eth>"
        logging:
          driver: "json-file"
          options:
            max-size: "100m"
            max-file: "1"
    
  4. In a separate shell, you can now attach to l2geth.

    $ docker exec -it l2geth-docker geth attach "/volume/l2geth-datadir/geth.ipc"
    
    > admin.peers.length
    5
    
    > eth.blockNumber
    10000
    

Interacting with the L2geth Container