The example configuration file path is etc/example.json
{
"network": {
"name": "devnet",
"url": "http://127.0.0.1",
"accounts": {
"deployer": {
"address": "",
"privateKey": "",
"cairoVersion": ""
},
"governor": {
"address": "",
"privateKey": "",
"cairoVersion": ""
}
}
},
"macro": {
"BLOCK_PERIOD": "1 seconds",
"UPGRADE_NOTICE_PERIOD": 0,
"PRIORITY_EXPIRATION": 0,
"CHAIN_ID": 1,
"MAX_CHAIN_ID": 4,
"ALL_CHAINS": 15,
"MASTER_CHAIN_ID": 2
}
}
macro
is an object and define some macro variables which will replace in zkLink starknet contract.
CHAIN_ID
is the id defined in zkLink network(not the blockchain id). You need to set theCHAIN_ID
according to the actual deployment situation.BLOCK_PERIOD
is average the block generation time, for example, in ethereum mainnet its value is12 seconds
.UPGRADE_NOTICE_PERIOD
is the contract upgrade lock time, when deploy in local development you could set this value to zero, and then we can upgrade contract immediately.PRIORITY_EXPIRATION
is how long we wait for priority operation to handle by zklink.
macro
also has three variables about constraints on CHAIN_ID
:
- MAX_CHAIN_ID, the max chain id of zkLink network.
- MASTER_CHAIN_ID, the chain id of master chain.
You should set MAX_CHAIN_ID
and MASTER_CHAIN_ID
according to the actual deployment situation. For example, the initial deployment we support two chains: 1 and 2, so MAX_CHAIN_ID
should be 2 and ALL_CHAINS
should be 3(1 << 0 | 1 << 2
). The second deployment we support another chain: 3, and MAX_CHAIN_ID
should be updated to 3 and ALL_CHAINS
should be updated to 7(1 << 0 | 1 << 1 | 1 << 2
).
network
contains Starknet network configurations:
name
: Starknet networknet, includesdevnet/testnet/mainnet
;url
: Starknet rpc url that scripts connected to. You can find the url hereaccounts
: infomations aboutdeployer
andgovernor
, which is needed by deployment. Thus Starknet account is AA, so you should putprivateKey
andaddress
at the same time. You may need to setdeployer
different withgovernor
when deploying to testnet to do some authority tests.cairoVersion
is the contract Cairo version of account, option is0
or1
.deployer
: who deploying contracts, can same withgovernor
.governor
: who has the management authority of the contract.
The NET
env variable determines the chain configuration used for deploy commands. Before deploy you should create a config file with the example config file:
cd etc
cp -f example.json devnet.json
And run the following command will compiling zklink starknet contracts:
NET=devnet npm run build
NET=<network name> npm run deployZklink -- --help
NET=<network name> npm run upgradeZklink -- --help
NET=<network name> npm run deployL2Gateway -- --help
NET=<network name> npm run upgradeL2Gateway -- --help
NET=<network name> npm run deployLZBridge -- --help
NET=<network name> npm run deployMulticall -- --help
NET=<network name> npm run deployFaucetToken -- --help
- Add Token
NET=<network name> npm run addToken -- --help
- Add Bridge
NET=<network name> npm run addBridge -- --help
- Set L1 gateway to zkLink
NET=<network name> npm run setL1RemoteGateway -- --help
- Set L2 gateway to zkLink
NET=<network name> npm run setL2RemoteGateway -- --help
- Set zkLink to L2 gateway
NET=<network name> npm run setL2GatewayToZkLink -- --help
- Set destinations
NET=<network name> npm run setDestinations -- --help
- Set chain id map
NET=<network name> npm run setChainIdMap -- --help
- Mint faucet token(testnet only)
NET=<network name> npm run mintFaucetToken -- --help
- Transfer ownership of UpgradeGatekeeper
NET=<network name> npm run transferMastershipOfUpgradeGatekeeper -- --help
- Change zkLink governor
NET=<network name> npm run changeGovernorOfZkLink -- --help