Export nitro contract addresses

This commit is contained in:
IshaVenikar 2024-07-19 15:36:21 +05:30
parent 4939be4368
commit 510e047ecd

View File

@ -537,43 +537,7 @@
```
- Deploy go-nitro contracts on L1 and L2 (run steps in go-nitro repo)
- Go to `packages/nitro-protocol`
```bash
# In go-nitro
cd packages/nitro-protocol
```
- Export variables for geth and optimism urls and the deployer private key (Private key used by bridge nodes as well)
```bash
export GETH_URL="http://127.0.0.1:8545"
export GETH_CHAIN_ID=1212
export OPTIMISM_URL="http://127.0.0.1:9545"
export GETH_DEPLOYER_PK=888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218
# Use same account on both Geth and Optimism
export OPTIMISM_DEPLOYER_PK=$GETH_DEPLOYER_PK
```
- Export variables for token name, token symbol and initial supply
```bash
export TOKEN_NAME="LaconicNetworkToken"
export TOKEN_SYMBOL="LNT"
# Note: Token supply denotes actual number of tokens and not the supply in Wei
export INITIAL_TOKEN_SUPPLY="10000000"
```
- Disable deterministic deployment to make sure bridge node and address associated to it is the owner of contracts
```bash
export DISABLE_DETERMINISTIC_DEPLOYMENT=true
```
- Reference: <https://github.com/wighawag/hardhat-deploy?tab=readme-ov-file#4-deterministicdeployment-ability-to-specify-a-deployment-factory>
- Deploy contracts on L1 and L2
```bash
@ -746,6 +710,28 @@
laconic-so deployment --dir bridge-nitro-deployment logs laconicd -f
```
- Get the deployed nitro contract addresses (Run in the directory where the deployments were created):
```bash
# Contract address of NitroAdjudicator
export NA_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"1212\"[0].contracts.NitroAdjudicator.address' /app/deployment/nitro-addresses.json")
```
```bash
# Contract address of VirtualPaymentApp
export CA_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"1212\"[0].contracts.ConsensusApp.address' /app/deployment/nitro-addresses.json")
```
```bash
# Contract address of ConsensusApp
export VPA_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"1212\"[0].contracts.VirtualPaymentApp.address' /app/deployment/nitro-addresses.json")
```
```bash
# Contract address of Bridge
export BRIDGE_ADDRESS=$(laconic-so deployment --dir bridge-deployment exec nitro-bridge "jq -r '.\"42069\"[0].contracts.Bridge.address' /app/deployment/nitro-addresses.json")
```
- Get Ethereum private keys for accounts Alice and Charlie from `laconic-wallet` (to be used as statechannel PKs)
- Prepare deployments for the nodes
@ -757,11 +743,11 @@
--config CERC_NITRO_CHAIN_URL=ws://host.docker.internal:8546, \
CERC_NITRO_SC_PK=<Private key of Alice>, \
CERC_NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597, \
CERC_NA_ADDRESS=0xb2592723B09F42937543f199A305ea6576dCb506, \
CERC_VPA_ADDRESS=0x198c6643f7750c2569C3468E16750a8E8504E2c7, \
CERC_CA_ADDRESS=0x198A8F1F14ACe1662fB2E5BE63A1de2308DE4CC7, \
CERC_BRIDGE_ADDRESS=, \
CERC_NITRO_BOOTPEERS=/ip4/127.0.0.1/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
CERC_NA_ADDRESS=$CERC_NA_ADDRESS, \
CERC_VPA_ADDRESS=$CERC_VPA_ADDRESS, \
CERC_CA_ADDRESS=$CERC_CA_ADDRESS, \
CERC_BRIDGE_ADDRESS=$CERC_BRIDGE_ADDRESS, \
CERC_NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
```
- Create a deployment from the spec file
@ -777,11 +763,11 @@
--config CERC_NITRO_CHAIN_URL=ws://host.docker.internal:8546, \
CERC_NITRO_SC_PK=<Private key of Charlie>, \
CERC_NITRO_CHAIN_PK=570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597, \
CERC_NA_ADDRESS=0xb2592723B09F42937543f199A305ea6576dCb506, \
CERC_VPA_ADDRESS=0x198c6643f7750c2569C3468E16750a8E8504E2c7, \
CERC_CA_ADDRESS=0x198A8F1F14ACe1662fB2E5BE63A1de2308DE4CC7, \
CERC_BRIDGE_ADDRESS=, \
CERC_NITRO_BOOTPEERS=/ip4/127.0.0.1/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
CERC_NA_ADDRESS=$CERC_NA_ADDRESS, \
CERC_VPA_ADDRESS=$CERC_VPA_ADDRESS, \
CERC_CA_ADDRESS=$CERC_CA_ADDRESS, \
CERC_BRIDGE_ADDRESS=$CERC_BRIDGE_ADDRESS, \
CERC_NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes
```
- Create a deployment `l1charlie-nitro-deployment` from the spec file
@ -799,11 +785,11 @@
CERC_NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f, \
CERC_NITRO_MSG_PORT=3008, \
CERC_NITRO_RPC_PORT=4008, \
CERC_NA_ADDRESS=0xb2592723B09F42937543f199A305ea6576dCb506, \
CERC_VPA_ADDRESS=0x198c6643f7750c2569C3468E16750a8E8504E2c7, \
CERC_CA_ADDRESS=0x198A8F1F14ACe1662fB2E5BE63A1de2308DE4CC7, \
CERC_BRIDGE_ADDRESS=, \
CERC_NITRO_BOOTPEERS=/ip4/127.0.0.1/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes, \
CERC_NA_ADDRESS=$CERC_NA_ADDRESS, \
CERC_VPA_ADDRESS=$CERC_VPA_ADDRESS, \
CERC_CA_ADDRESS=$CERC_CA_ADDRESS, \
CERC_BRIDGE_ADDRESS=$CERC_BRIDGE_ADDRESS, \
CERC_NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes, \
CERC_NITRO_L2=true
```
@ -822,11 +808,11 @@
CERC_NITRO_CHAIN_PK=111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f, \
CERC_NITRO_MSG_PORT=3010, \
CERC_NITRO_RPC_PORT=4010, \
CERC_NA_ADDRESS=0xb2592723B09F42937543f199A305ea6576dCb506, \
CERC_VPA_ADDRESS=0x198c6643f7750c2569C3468E16750a8E8504E2c7, \
CERC_CA_ADDRESS=0x198A8F1F14ACe1662fB2E5BE63A1de2308DE4CC7, \
CERC_BRIDGE_ADDRESS=, \
CERC_NITRO_BOOTPEERS=/ip4/127.0.0.1/tcp/3006/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes, \
CERC_NA_ADDRESS=$CERC_NA_ADDRESS, \
CERC_VPA_ADDRESS=$CERC_VPA_ADDRESS, \
CERC_CA_ADDRESS=$CERC_CA_ADDRESS, \
CERC_BRIDGE_ADDRESS=$CERC_BRIDGE_ADDRESS, \
CERC_NITRO_BOOTPEERS=/dns4/host.docker.internal/tcp/3005/p2p/16Uiu2HAmJDxLM8rSybX78FH51iZq9PdrwCoCyyHRBCndNzcAYMes, \
CERC_NITRO_L2=true
```