Skip to content

Commit

Permalink
It's possible to run L1 and L2 private networks.
Browse files Browse the repository at this point in the history
  • Loading branch information
matjazv committed Nov 9, 2023
1 parent 75fe16e commit b6af260
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
# L1 RPC URL, e.g. Infura, Alchemy, or your own node
L1_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_KEY

# L1 fork RPC URL in case of private test network is used, e.g. Infura, Alchemy, or your own node
L1_FORK_RPC_URL=https://sepolia.infura.io/v3/YOUR_INFURA_KEY

# L2 RPC URL, e.g. Infura, Alchemy, or your own node
L2_RPC_URL=https://optimism-sepolia.infura.io/v3/YOUR_INFURA_KEY

# L2 fork RPC URL in case of private test network is used, e.g. Infura, Alchemy, or your own node
L2_FORK_RPC_URL=https://optimism-sepolia.infura.io/v3/YOUR_INFURA_KEY

# L1 Etherscan API key (needed for contract verification, if not provided, verification will be skipped)
L1_ETHERSCAN_API_KEY=

Expand Down
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ git submodule update --init --recursive

## Deployment on Private Test Network

**NOTE**: In a private test network, it's only possible to deploy smart contracts for the **Ethereum L1** network.
**NOTE**: On a private test network, the deployment of smart contracts is feasible on both L1 and L2 networks. However, the transfer of tokens between these networks is not possible as it requires the operation of the Sequencer.

A private test network is established using the `anvil` tool, and the smart contracts are deployed using the `forge script` tool. To run a private network and deploy the smart contracts, follow these steps:
1. Create `.env` file and set the vars `PRIVATE_KEY` and `TEST_NETWORK_MNEMONIC`. You can copy and rename the `.env.example` file if the default values provided in `.env.example` are satisfactory.
A private test L1 and L2 networks are established using the `anvil` tool, and the smart contracts are deployed using the `forge script` tool. To run a private networks and deploy the smart contracts, follow these steps:
1. Create `.env` file and set the vars `PRIVATE_KEY`, `L1_RPC_URL`, `L1_FORK_RPC_URL`, `L2_RPC_URL`, `L2_FORK_RPC_URL`, `L1_STANDARD_BRIDGE_ADDR` and `TEST_NETWORK_MNEMONIC`. You can copy and rename the `.env.example` file if the default values provided in `.env.example` are satisfactory.
2. Navigate to the `script` directory.
3. To create and launch a private test network, execute the script: `./runTestNetwork.sh`
4. Navigate back to the project root directory.
5. To deploy `L1LiskToken` smart contract, execute the script: `source .env && forge script --rpc-url=http://localhost:8545 --broadcast --verify -vvvv script/L1LiskToken.s.sol:L1LiskTokenScript`
3. To create and launch a private test L1 network, execute the script: `./runL1TestNetwork.sh`
4. To create and launch a private test L2 network, execute the script: `./runL2TestNetwork.sh`
5. To deploy all smart contracts, execute the script: `./deployContracts.sh`

## Deployment on Public Test Network

To deploy smart contracts on both L1 and L2 public networks, you will need to provide an URL for a public nodes from a RPC provider, such as Alchemy or Infura. Follow these steps to deploy the smart contracts:
1. Create `.env` file and set the vars `PRIVATE_KEY`, `L1_RPC_URL`, `L2_RPC_URL` and `L1_STANDARD_BRIDGE_ADDR`. You can copy and rename the `.env.example` file if the default values provided in `.env.example` are satisfactory.
To deploy smart contracts on both L1 and L2 public networks, you will need to provide an URL for a public nodes from a RPC provider, such as Alchemy or Infura. Additionally, in order to verify smart contracts during the deployment process, it is necessary to provide an Etherscan API key. Follow these steps to deploy the smart contracts:
1. Create `.env` file and set the vars `PRIVATE_KEY`, `L1_RPC_URL`, `L2_RPC_URL`, `L1_ETHERSCAN_API_KEY`, `L2_ETHERSCAN_API_KEY` and `L1_STANDARD_BRIDGE_ADDR`. You can copy and rename the `.env.example` file if the default values provided in `.env.example` are satisfactory. `L1_ETHERSCAN_API_KEY` and `L2_ETHERSCAN_API_KEY` may be empty to skip smart contracts verification process.
2. Navigate to the `script` directory.
3. To deploy all smart contracts, execute the script: `./deployContracts.sh`

Expand Down
4 changes: 4 additions & 0 deletions script/runL1TestNetwork.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

source ../.env
anvil --mnemonic "$TEST_NETWORK_MNEMONIC" --port 8545 --fork-url "$L1_FORK_RPC_URL"
4 changes: 4 additions & 0 deletions script/runL2TestNetwork.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash

source ../.env
anvil --mnemonic "$TEST_NETWORK_MNEMONIC" --port 8546 --fork-url "$L2_FORK_RPC_URL"
4 changes: 0 additions & 4 deletions script/runTestNetwork.sh

This file was deleted.

0 comments on commit b6af260

Please sign in to comment.