Skip to main content

Deploy Protocols on L2

This guide provides detailed steps for deploying and configuring the Bridge, Signal Service, and ERC20 Vault protocols on Layer 2.

Bridge Configuration

The bridge protocol enables asset transfers between Layer 1 and Layer 2. Follow the steps below to configure the bridge on L2.

Required Information

  • L1 Chain ID: 3151908
  • L1 Bridge Address: 0x63e6DDE6763C3466C7b45Be880f7eE5dC2ca3E25
  • L2 Shared Address Manager: 0x7633740000000000000000000000000000000006
  • L2 Prefunded Account Private Key: 0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
  • L2 RPC URL: Replace http://localhost:8547 with your actual L2 endpoint.

Set Environment Variables

Run the following commands to configure environment variables:

export FOUNDRY_PROFILE=layer1
export DOMAIN=3151908
export ADDRESS=0x63e6DDE6763C3466C7b45Be880f7eE5dC2ca3E25
export NAME=0x6272696467650000000000000000000000000000000000000000000000000000
export PROXY_ADDRESS=0x7633740000000000000000000000000000000006
export PRIVATE_KEY=0xbcdf20249abf0ed6d944c0288fad489e33f66b3960d9e6229c1cd214ed3bbe31
export L2_RPC_URL=http://localhost:8547

Execute Bridge Setup Script

The following Docker command deploys the bridge configuration to L2:

docker run \
-e FOUNDRY_PROFILE=${FOUNDRY_PROFILE} \
-e DOMAIN=${DOMAIN} \
-e ADDRESS=${ADDRESS} \
-e NAME=${NAME} \
-e PROXY_ADDRESS=${PROXY_ADDRESS} \
-e PRIVATE_KEY=${PRIVATE_KEY} \
nethsurge/protocol:surge-devnet \
forge script ./script/shared/SetAddress.s.sol \
--private-key ${PRIVATE_KEY} \
--fork-url ${L2_RPC_URL} \
--broadcast -vvv

Verification

During the deployment of each of the three components above, your terminal should display output similar to the following if the deployment is successful:

Compiling 36 files with Solc 0.8.27
Solc 0.8.27 finished in 18.14s
Compiler run successful!
Script ran successfully.

## Setting up 1 EVM.

==========================

Chain 763374

Estimated gas price: 0.199839459 gwei

Estimated total gas used for script: 79059

Estimated amount required: 0.000015799107789081 ETH

==========================


==========================

ONCHAIN EXECUTION COMPLETE & SUCCESSFUL.

Transactions saved to: /app/broadcast/SetAddress.s.sol/763374/run-latest.json

Sensitive values saved to: /app/cache/SetAddress.s.sol/763374/run-latest.json
tip

Complete verification of the Surge devnet occurs after deploying additional services in subsequent steps.