$ git config url."git@github.com:Ethernal-Tech/cardano-infrastructure.git".insteadOf "https://github.com/Ethernal-Tech/cardano-infrastructure"
$ GOPRIVATE=github.com/Ethernal-Tech/cardano-infrastructure go get github.com/Ethernal-Tech/cardano-infrastructure- Let's say we will place smart contract repositories in the directory
/home/igor/development/ethernal/apex-bridge/ - Clone them:
git clone https://github.com/Ethernal-Tech/apex-bridge-smartcontracts/ git clone https://github.com/Ethernal-Tech/apex-evm-gateway- Build them:
cd apex-bridge-smartcontracts && npm i && npx hardhat compile && cd ..cd apex-evm-gateway && npm i && npx hardhat compile && cd ..- Generate bridge bindings with the command:
BASEPATH=/home/igor/development/ethernal/apex-bridge/apex-bridge-smartcontracts
(cd "$BASEPATH" && npx hardhat compile)
rm -rf ./contractbinding/contractbuild && mkdir ./contractbinding/contractbuild
cat "${BASEPATH}/artifacts/contracts/Bridge.sol/Bridge.json" | jq .abi >> ./contractbinding/contractbuild/Bridge.sol.abi
abigen --abi ./contractbinding/contractbuild/Bridge.sol.abi --pkg main --type BridgeContract --out ./contractbinding/BridgeContract.go --pkg contractbinding
cat "${BASEPATH}/artifacts/contracts/Admin.sol/Admin.json" | jq .abi >> ./contractbinding/contractbuild/Admin.sol.abi
abigen --abi ./contractbinding/contractbuild/Admin.sol.abi --pkg main --type AdminContract --out ./contractbinding/AdminContract.go --pkg contractbinding
rm -rf ./contractbinding/contractbuild- Generate nexus bindings with the command:
BASEPATH=/home/igor/development/ethernal/apex-bridge/apex-evm-gateway
(cd "$BASEPATH" && npx hardhat compile)
rm -rf ./contractbinding/contractbuild && mkdir ./contractbinding/contractbuild
cat "${BASEPATH}/artifacts/contracts/Gateway.sol/Gateway.json" | jq .abi >> ./contractbinding/contractbuild/GatewayContract.sol.abi
abigen --abi ./contractbinding/contractbuild/GatewayContract.sol.abi --pkg main --type Gateway --out ./contractbinding/GatewayContract.go --pkg contractbinding
rm -rf ./contractbinding/contractbuild$ blade secrets init --insecure --data-dir ./blade-secrets$ go run ./main.go wallet-create --chain prime --validator-data-dir /home/bbs/cardano --show-pk- instead of using
--validator-data-dir, it is possible to set the blade configuration file with--validator-config /path_to_config/config.json - It's possible to use the
--type stakeflag if we want a wallet that includes the stake signing key as well
$ go run ./main.go wallet-create --chain nexus --validator-data-dir /home/bbs/cardano --type evm --show-pk- instead of using
--validator-data-dir, it is possible to set the blade configuration file with--validator-config path_to_config/config.json
$ go run ./main.go wallet-create --chain nexus --validator-data-dir /home/bbs/cardano --type relayer-evm --show-pk- instead of using
--validator-data-dir, it is possible to set the blade configuration file with--validator-config path_to_config/config.json
$ go run ./main.go wallet-create blade --type admin --key KEY --config CONFIG_PATTH$ go run ./main.go wallet-create blade --type proxy --key KEY --config CONFIG_PATTH$ go run ./main.go register-chain \
--chain prime \
--type 0 \
--validator-data-dir /home/bbs/blade \
--token-supply 20000000 \
--bridge-url https://polygon-mumbai.blockpi.network/v1/rpc/public \
--bridge-addr 0x8F371EeFe210ad18a2Ce45d51B48E56aBa1a58A9 - instead of
--validator-data-dirit is possible to set blade configuration file with--validator-config /path/config.json.
$ go run ./main.go create-address \
--network-id network_ID \
--testnet-magic 3311 \
--bridge-url http://127.0.0.1:12013 \
--bridge-addr 0xABEF000000000000000000000000000000000000 \
--bridge-key BRIDGE_ADMIN_PRIVATE_KEY \
--chain prime- optional
--show-policy-scriptflag - instead of
--bridge-keyit is possible to set key secret manager configuration file with--key-config /path/config.json.
All options
$ go run ./main.go generate-configs \
--validator-data-dir <path to bridge chain data directory when using local secrets manager> \
--validator-config <path to bridge chain secrets manager config file> \
--output-dir <path to config jsons output directory> \
--output-validator-components-file-name <validator components config json output file name>.json \
--output-relayer-file-name <relayer config json output file name>.json \
--bridge-node-url <node URL of bridge chain> \
--bridge-sc-address <bridging smart contract address on bridge chain> \
--admin-sc-address <admin smart contract address on bridge chain> \
--relayer-data-dir <relayer data dir for secrets> \
--relayer-config <relayer secrets config file path> \
--dbs-path <path to where databases will be stored> \
--logs-path <path to where logs will be stored> \
--api-port <port at which API should run> \
--api-keys <api key 1> \
--api-keys <api key 2> \
--empty-blocks-threshold <maximum number of empty blocks for blocks submitter to skip>optionally, the --telemetry prometheusip:port,datadogip:port flag can be used if telemetry is desired
Minimal example
$ go run ./main.go generate-configs \
--validator-data-dir ./blade-dir \
--relayer-data-dir ./blade-dir \
--bridge-node-url https://polygon-mumbai-pokt.nodies.app \
--bridge-sc-address 0x816402271eE6D9078Fc8Cb537aDBDD58219485BB \
--api-keys test_api_key_1Cardano chain all options
$ apex-bridge generate-configs cardano-chain \
--network-address <address of the chain network> \
--network-magic <network magic of the chain network> \
--network-id <network id of the chain network> \
--ogmios-url <ogmios URL for the chain network> \
--blockfrost-url <blockfrost URL for the chain network> \
--blockfrost-api-key <blockfrost API key> \
--socket-path <socket path for the chain network> \
--ttl-slot-inc <ttl slot increment> \
--slot-rounding-threshold <slot rounding threshold> \
--starting-block <slot:hash> \
--utxo-min-amount <minimal UTXO value for the chain> \
--min-fee-for-bridging <minimal bridging fee> \
--block-confirmation-count <block confirmation count> \
--chain-id <chain id> \
--allowed-directions <allowed bridging directions> \
--output-validator-components-file-name <validator components config json output file name> \
--output-relayer-file-name <relayer config json output file name>Add cardano chain config minimal example
$ apex-bridge generate-configs cardano-chain \
--network-address localhost:13001 \
--network-magic 142 \
--network-id 3 \
--ogmios-url https://prime.ogmios.com \
--ttl-slot-inc 6 \
--min-fee-for-bridging 10000000 \
--block-confirmation-count 10 \
--chain-id "prime" \
--allowed-directions "vector" \
--output-validator-components-file-name "vc_config.json"Evm chain config all options
$ apex-bridge generate-configs evm-chain \
--evm-node-url <node URL> \
--evm-ttl-block-inc <ttl block increment> \
--evm-block-rounding-threshold <block rounding threshold> \
--evm-starting-block <block number> \
--evm-min-fee-for-bridging <minimal bridging fee> \
--evm-relayer-gas-fee-multiplier <gas fee multiplier for evm relayer> \
--chain-id <evm chain id> \
--allowed-directions <allowed bridging directions> \
--allowed-directions <allowed bridging directions> \
--output-validator-components-file-name <validator components config json output file name> \
--output-relayer-file-name <relayer config json output file name>Add evm chain config minimal example
$ apex-bridge generate-configs evm-chain \
--evm-node-url localhost:5500 \
--evm-ttl-block-inc 10 \
--evm-block-rounding-threshold 5 \
--evm-starting-block 3 \
--evm-min-fee-for-bridging 10000000 \
--evm-relayer-gas-fee-multiplier 4 \
--chain-id "nexus" \
--allowed-directions "prime" \
--allowed-directions "vector" \
--output-validator-components-file-name "vc_config.json"apex-bridge sendtx \
--key PRIME_WALLET_PRIVATE_KEY \
--testnet-src 3311 \
--addr-multisig-src addr_test1wrz24vv4tvfqsywkxn36rv5zagys2d7euafcgt50gmpgqpq4ju9uv \
--ogmios-src http://ogmios.prime.testnet.apexfusion.org:1337 \
--ogmios-dst http://ogmios.vector.testnet.apexfusion.org:1337 \
--chain-dst vector \
--receiver addr_test1v25acu09yv4z2jc026ss5hhgfu5nunfp9z7gkamae43t6fc8gx3pf:1_000_000 \
--fee 1_100_000- there is an optional
--stake-keyflag
apex-bridge sendtx \
--key VECTOR_WALLET_PRIVATE_KEY \
--testnet-src 1127 \
--addr-multisig-src vector_test1w2h482rf4gf44ek0rekamxksulazkr64yf2fhmm7f5gxjpsdm4zsg \
--ogmios-src http://ogmios.vector.testnet.apexfusion.org:1337 \
--ogmios-dst http://ogmios.prime.testnet.apexfusion.org:1337 \
--chain-dst prime \
--receiver addr_test1vrlt3wnp3hxermfyhfp2x9lu5u32275lf0yh3nvxkpjv7qgxl9f8y:1_234_567 \
--fee 1_100_000 \
--network-id-src 2- there is an optional
--stake-keyflag
apex-bridge sendtx \
--key PRIME_WALLET_PRIVATE_KEY \
--ogmios-src http://ogmios.prime.testnet.apexfusion.org:1337 \
--addr-multisig-src addr_test1wrz24vv4tvfqsywkxn36rv5zagys2d7euafcgt50gmpgqpq4ju9uv \
--testnet-src 3311 \
--chain-dst nexus \
--receiver 0x4BC4892F8B01B9aFc99BCB827c39646EE78bCF06:1_000_000 \
--fee 1_100_000 \
--nexus-url https://testnet.af.route3.dev/json-rpc/p2-c- there is an optional
--stake-keyflag
apex-bridge sendtx \
--tx-type evm \
--key NEXUS_WALLET_PRIVATE_KEY \
--nexus-url https://testnet.af.route3.dev/json-rpc/p2-c \
--gateway-addr GATEWAY_PROXY_ADDRESS \
--chain-dst prime \
--receiver addr_test1vrlt3wnp3hxermfyhfp2x9lu5u32275lf0yh3nvxkpjv7qgxl9f8y:1000000000000000000 \
--fee 1000010000000000000 \
--ogmios-dst http://ogmios.prime.testnet.apexfusion.org:1337- there is an optional
--stake-keyflag
Default example (bls keys are retrieved from bridge and gateway address is updated on the bridge):
$ apex-bridge deploy-evm \
--url http://127.0.0.1:12001 \
--key NEXUS_OR_EVM_PRIVATE_KEY \
--dir /tmp \
--clone \
--bridge-url http://127.0.0.1:12013 \
--bridge-addr 0xABEF000000000000000000000000000000000000 \
--bridge-key BRIDGE_ADMIN_WALLET_PRIVATE_KEY \- instead of
--keyand--bridge-keyit is possible to set key secret manager configuration file with--key-config /path/config.json. --keyfor bridge SC is the key ofProxyContractsAdmin, and for nexus is the key of owner/initial deployer --BRIDGE_ADMIN_WALLET_PRIVATE_KEYis the wallet used with--blade-adminwhen starting blade
Example with explicit bls keys:
$ apex-bridge deploy-evm \
--url http://127.0.0.1:12001 \
--key 1841ffaeb5015fa5547e42a2524214e9b55deda3cc26676ff9823bca98b25c94 \
--dir /tmp \
--clone \
--bls-key 0x.... \
--bls-key 0x.... \
--bls-key 0x.... \
--bls-key 0x.... \ - optional
--min-fee, min-fee value can be specified for the Gateway contract - optional
--min-bridging-amount- for the Gateway contract, new min-bridging-amount can be defined - instead of
--keyit is possible to set key secret manager configuration file with--key-config /path/config.json.
$ apex-bridge deploy-evm upgrade \
--url http://127.0.0.1:12001 \
--key NEXUS_OR_EVM_PRIVATE_KEY \
--dir /tmp \
--clone \
--branch main \
--repo https://github.com/Ethernal-Tech/apex-bridge-smartcontracts \
--contract Admin:0xABEF000000000000000000000000000000000006- optional
--dynamic-tx --keyfor bridge SC is the key ofProxyContractsAdmin, and for nexus is the key of owner/initial deployer- instead of
--keyit is possible to set key secret manager configuration file with--key-config /path/config.json.
Default example (bls keys are retrieved from bridge):
$ apex-bridge deploy-evm set-validators-chain-data \
--url http://127.0.0.1:12001 \
--key NEXUS_OR_EVM_PRIVATE_KEY \
--dir /tmp \
--clone \
--bridge-url http://127.0.0.1:12013 \
--bridge-addr 0xABEF000000000000000000000000000000000000 \
--validators-proxy-addr 0x157E8D7DA7A2282aDe8678390A4ad6ba83B0FD9E \--keyfor bridge SC is the key ofProxyContractsAdmin, and for nexus is the key of owner/initial deployer- instead of
--keyit is possible to set key secret manager configuration file with--key-config /path/config.json.
Example with explicit bls keys:
$ apex-bridge deploy-evm set-validators-chain-data \
--url http://127.0.0.1:12001 \
--key 1841ffaeb5015fa5547e42a2524214e9b55deda3cc26676ff9823bca98b25c94 \
--dir /tmp \
--clone \
--bls-key 0x.... \
--bls-key 0x.... \
--bls-key 0x.... \
--bls-key 0x.... \
--validators-proxy-addr 0x157E8D7DA7A2282aDe8678390A4ad6ba83B0FD9E \--keyfor bridge SC is the key ofProxyContractsAdmin, and for nexus is the key of owner/initial deployer- instead of
--keyit is possible to set key secret manager configuration file with--key-config /path/config.json.
$ apex-bridge bridge-admin get-chain-token-quantity \
--bridge-url http://localhost:12013 \
--chain prime --chain nexus --chain vector$ apex-bridge bridge-admin update-chain-token-quantity \
--bridge-url http://localhost:12013 \
--chain nexus --amount 300 \
--key 922769e22b70614d4172fc899126785841f4de7d7c009fc338923ce50683023d- instead of
--keyit is possible to set key secret manager configuration file with--key-config /path/config.json.
$ apex-bridge bridge-admin set-min-amounts \
--url http://127.0.0.1:12001 \
--key 922769e22b70614d4172fc899126785841f4de7d7c009fc338923ce50683023d \
--contract-addr 0xeefcd00000000000000000000000000000000013 \
--min-fee 200 \
--min-bridging-amount 100 - instead of
--keyit is possible to set key secret manager configuration file with--key-config /path/config.json.
$ apex-bridge bridge-admin defund \
--bridge-url http://localhost:12013 \
--chain nexus \
--key 922769e22b70614d4172fc899126785841f4de7d7c009fc338923ce50683023d \
--amount 100 \
--addr 0xeefcd00000000000000000000000000000000000- there is optional
--native-token-amountflag - instead of
--keyit is possible to set key secret manager configuration file with--key-config /path/config.json.
$ apex-bridge bridge-admin set-additional-data \
--bridge-url http://localhost:12013 \
--bridge-key 922769e22b70614d4172fc899126785841f4de7d7c009fc338923ce50683023d \
--chain nexus \
--bridging-addr 0xeefcd00000000000000000000000000000000022 \
--fee-addr 0xeefcd00000000000000000000000000000000021- instead of
--bridge-keyit is possible to set key secret manager configuration file with--key-config /path/config.json.
$ apex-bridge bridge-admin get-validators-data \
--bridge-url http://localhost:12013 \
--bridge-addr 0xeefcd00000000000000000000000000000000022 \
--config ./config.json$ apex-bridge bridge-admin get-bridging-addresses-balances \
--config ./config.json \
--indexer-dbs-path /e2e-bridge-data-tmp-Test_OnlyRunApexBridge_WithNexusAndVector/validator_1/bridging-dbs/validatorcomponents \
--prime-wallet-addr addr_test1wrapsqy073nhdx7tz4j54q4aanhzqqgfpydftysvqyqw50cgz9hpl \
--vector-wallet-addr addr_test1wffkxzsjpdnkn4vzk7v8wgygcqvztn8ndmte8294rp2l2uqgnp993 \
--nexus-wallet-addr 0x2ac7dEB534901E63FBd5CEC49929B8830F3FaFF4 \apex-bridge sc-version \
--node-url http://127.0.0.1:12013 \
--addr 0xaBef000000000000000000000000000000000000:Bridge \
--addr 0xaBef000000000000000000000000000000000001:ClaimsHelper \
--addr 0xaBef000000000000000000000000000000000002:Claims \
--addr 0xaBef000000000000000000000000000000000003:SignedBatches \
--addr 0xaBef000000000000000000000000000000000004:Slots \
--addr 0xaBef000000000000000000000000000000000005:Validators \
--addr 0xaBef000000000000000000000000000000000006:Admin \$ apex-bridge bridge-admin set-validator-change \
--url http://127.0.0.1:12013 \
--key 922769e22b70614d4172fc899126785841f4de7d7c009fc338923ce50683023d \
--key-config /path/config.json \
--validator-change (true/false) \
--contract-addr <admin contract address>Following a validator set update, you must follow a specific startup sequence:
- Start Blade Node: Initialize the
blade-nodefirst. - Wait for Sync: Allow the
blade-nodeto fully complete its synchronization process. - Start Validator Components: Only after the node is fully synced should you start the
validator-components.