Chainbridge-core is the project that was born from the existing version of Chainbridge. It was built to improve the maintainability and modularity of the current solution. The fundamental distinction is that chainbridge-core is more of a framework rather than a stand-alone application.
Project still in deep beta
- Chat with us on discord.
Refer to installation guide for assistance in installing.
The chainbridge-core-example currently supports two modules:
Since chainbridge-core is the modular framework it will require writing some code to get it running. Here you can find some examples Example
This module provides instruction for communicating with EVM-compatible chains.
Usage:
evm-cli [command]
Available Commands:
accounts Account instructions
admin Admin-related instructions
bridge Bridge-related instructions
deploy Deploy smart contracts
erc20 ERC20-related instructions
erc721 ERC721-related instructions
utils Utils-related instructions
Flags:
-h, --help help for evm-cli
Account instructions, allowing us to generate keypairs or import existing keypairs for use.
Usage:
evm-cli accounts [command]
Available Commands:
generate Generate bridge keystore (Secp256k1)
import Import bridge keystore
Flags:
-h, --help help for accounts
The generate subcommand is used to generate the bridge keystore. If no options are specified, a Secp256k1 key will be made.
Usage:
evm-cli accounts generate [flags]
Flags:
-h, --help help for generate
The import subcommand is used to import a keystore for the bridge.
Usage:
evm-cli accounts import [flags]
Flags:
-h, --help help for import
--password string password to encrypt with
Admin-related instructions.
Usage:
evm-cli admin [command]
Available Commands:
add-admin Add a new admin
add-relayer Add a new relayer
is-relayer Check if an address is registered as a relayer
pause Pause deposits and proposals
remove-admin Remove an existing admin
remove-relayer Remove a relayer
set-fee Set a new fee for deposits
set-threshold Set a new relayer vote threshold
unpause Unpause deposits and proposals
withdraw Withdraw tokens from the handler contract
Flags:
-h, --help help for admin
Add a new admin.
Usage:
evm-cli admin add-admin [flags]
Flags:
--admin string address to add
--bridge string bridge contract address
-h, --help help for add-admin
Add a new relayer.
Usage:
evm-cli admin add-relayer [flags]
Flags:
--bridge string bridge contract address
-h, --help help for add-relayer
--relayer string address to add
Check if an address is registered as a relayer.
Usage:
evm-cli admin is-relayer [flags]
Flags:
--bridge string bridge contract address
-h, --help help for is-relayer
--relayer string address to check
Pause deposits and proposals,
Usage:
evm-cli admin pause [flags]
Flags:
--bridge string bridge contract address
-h, --help help for pause
Remove an existing admin.
Usage:
evm-cli admin remove-admin [flags]
Flags:
--admin string address to remove
--bridge string bridge contract address
-h, --help help for remove-admin
Remove a relayer.
Usage:
evm-cli admin remove-relayer [flags]
Flags:
--bridge string bridge contract address
-h, --help help for remove-relayer
--relayer string address to remove
Set a new fee for deposits.
Usage:
evm-cli admin set-fee [flags]
Flags:
--bridge string bridge contract address
--fee string New fee (in ether)
-h, --help help for set-fee
Set a new relayer vote threshold.
Usage:
evm-cli admin set-threshold [flags]
Flags:
--bridge string bridge contract address
-h, --help help for set-threshold
--threshold uint new relayer threshold
Unpause deposits and proposals.
Usage:
evm-cli admin unpause [flags]
Flags:
--bridge string bridge contract address
-h, --help help for unpause
Withdraw tokens from the handler contract.
Usage:
evm-cli admin withdraw [flags]
Flags:
--amount string token amount to withdraw. Should be set or ID or amount if both set error will occur
--bridge string bridge contract address
--decimals uint ERC20 token decimals
--handler string handler contract address
-h, --help help for withdraw
--id string token ID to withdraw. Should be set or ID or amount if both set error will occur
--recipient string address to withdraw to
--token string ERC20 or ERC721 token contract address
Bridge-related instructions.
Usage:
evm-cli bridge [command]
Available Commands:
cancel-proposal Cancel an expired proposal
query-proposal Query an inbound proposal
query-resource Query the contract address
register-generic-resource Register a generic resource ID
register-resource Register a resource ID
set-burn Set a token contract as mintable/burnable
Flags:
-h, --help help for bridge
Cancel an expired proposal.
Usage:
evm-cli bridge cancel-proposal [flags]
Flags:
--bridge string bridge contract address
--chainId uint chain ID of proposal to cancel
--dataHash string hash of proposal metadata
--depositNonce uint deposit nonce of proposal to cancel
-h, --help help for cancel-proposal
Query an inbound proposal.
Usage:
evm-cli bridge query-proposal [flags]
Flags:
--bridge string bridge contract address
--chainId uint source chain ID of proposal
--dataHash string hash of proposal metadata
--depositNonce uint deposit nonce of proposal
-h, --help help for query-proposal
Query the contract address with the provided resource ID for a specific handler contract.
Usage:
evm-cli bridge query-resource [flags]
Flags:
--handler string handler contract address
-h, --help help for query-resource
--resourceId string resource ID to query
Register a resource ID with a contract address for a generic handler.
Usage:
evm-cli bridge register-generic-resource [flags]
Flags:
--bridge string bridge contract address
--deposit string deposit function signature (default "0x00000000")
--execute string execute proposal function signature (default "0x00000000")
--handler string handler contract address
--hash treat signature inputs as function prototype strings, hash and take the first 4 bytes
-h, --help help for register-generic-resource
--resourceId string resource ID to query
--target string contract address to be registered
Register a resource ID
Usage:
evm-cli bridge register-resource [flags]
Flags:
--bridge string bridge contract address
--handler string handler contract address
-h, --help help for register-resource
--resourceId string resource ID to be registered
--target string contract address to be registered
Set a token contract as mintable/burnable
Usage:
evm-cli bridge set-burn [flags]
Flags:
--bridge string bridge contract address
--handler string ERC20 handler contract address
-h, --help help for set-burn
--tokenContract string token contract to be registered
Deploy smart contracts.
Used to deploy all or some of the contracts required for bridging. Selection of contracts can be made by either specifying --all or a subset of flags
Usage:
evm-cli deploy [flags]
Flags:
--all deploy all
--bridge deploy bridge
--bridgeAddress string bridge contract address. Should be provided if handlers are deployed separately
--chainId string chain ID for the instance (default "1")
--erc20 deploy ERC20
--erc20Handler deploy ERC20 handler
--erc20Name string ERC20 contract name
--erc20Symbol string ERC20 contract symbol
--erc721 deploy ERC721
--fee string fee to be taken when making a deposit (in ETH, decimas are allowed) (default "0")
-h, --help help for deploy
--relayerThreshold uint number of votes required for a proposal to pass (default 1)
--relayers strings list of initial relayers
ERC20-related instructions.
Usage:
evm-cli erc20 [command]
Available Commands:
add-minter Add a minter to an Erc20 mintable contract
allowance Get the allowance of a spender for an address
approve Approve tokens in an ERC20 contract for transfer
balance Query balance of an account in an ERC20 contract
deposit Initiate a transfer of ERC20 tokens
mint Mint tokens on an ERC20 mintable contract
Flags:
-h, --help help for erc20
Add a minter to an Erc20 mintable contract.
Usage:
evm-cli erc20 add-minter [flags]
Flags:
--erc20Address string ERC20 contract address
-h, --help help for add-minter
--minter string address of minter
Get the allowance of a spender for an address.
Usage:
evm-cli erc20 allowance [flags]
Flags:
--erc20Address string ERC20 contract address
-h, --help help for allowance
--owner string address of token owner
--spender string address of spender
Approve tokens in an ERC20 contract for transfer.
Usage:
evm-cli erc20 approve [flags]
Flags:
--amount string amount to grant allowance
--decimals uint ERC20 token decimals (default 18)
--erc20address string ERC20 contract address
-h, --help help for approve
--recipient string address of recipient
Query balance of an account in an ERC20 contract.
Usage:
evm-cli erc20 balance [flags]
Flags:
--accountAddress string address to receive balance of
--erc20Address string ERC20 contract address
-h, --help help for balance
Initiate a transfer of ERC20 tokens.
Usage:
evm-cli erc20 deposit [flags]
Flags:
--amount string amount to deposit
--bridge string address of bridge contract
--decimals uint ERC20 token decimals
--destId string destination chain ID
-h, --help help for deposit
--recipient string address of recipient
--resourceId string resource ID for transfer
Mint tokens on an ERC20 mintable contract.
Usage:
evm-cli erc20 mint [flags]
Flags:
--amount string amount to mint fee (in ETH)
--decimal uint ERC20 token decimals (default 18)
--dstAddress string Where tokens should be minted. Defaults to TX sender
--erc20Address string ERC20 contract address
-h, --help help for mint
ERC721-related instructions.
Add a minter to an ERC721 mintable contract.
Usage:
evm-cli erc721 add-minter [flags]
Flags:
--erc721Address string ERC721 contract address
-h, --help help for add-minter
--minter string address of minter
Utils-related instructions. Useful for debugging
Usage:
evm-cli utils [command]
Available Commands:
hashList List tx hashes
simulate Simulate transaction invocation
Flags:
-h, --help help for utils
List tx hashes.
Usage:
evm-cli utils hashList [flags]
Flags:
--blockNumber string block number
-h, --help help for hashList
Replay a failed transaction by simulating invocation; not state-altering
Usage:
evm-cli utils simulate [flags]
Flags:
--blockNumber string block number
--fromAddress string address of sender
-h, --help help for simulate
--txHash string transaction hash
Though Celo is an EVM-compatible chain, it deviates in its implementation of the original Ethereum specifications, and therefore is deserving of its own separate module.
See: differences between EVM and Celo.
Usage:
celo-cli [command]
Available Commands:
bridge Bridge-related instructions
deploy Deploy smart contracts
erc20 erc20-related instructions
Flags:
-h, --help help for celo-cli
The differences alluded to above in how Celo constructs transactions versus those found within Ethereum can be viewed below by taking a look at the Message structs in both implementations.
Here you will find fields relating to the most recent London hardfork (EIP-1559), most notably gasFeeCap
and gasTipCap
.
Message {
from: from,
to: to,
nonce: nonce,
amount: amount,
gasLimit: gasLimit,
gasPrice: gasPrice,
gasFeeCap: gasFeeCap,
gasTipCap: gasTipCap,
data: data,
accessList: accessList,
isFake: isFake,
}
In Celo's struct you will notice that there are additional fields added for feeCurrency
, gatewayFeeRecipient
and gatewayFee
. You may also notice the ethCompatible
field, a boolean value we added in order to quickly determine whether the message is Ethereum compatible or not, ie, that feeCurrency
, gatewayFeeRecipient
and gatewayFee
are omitted.
Message {
from: from,
to: to,
nonce: nonce,
amount: amount,
gasLimit: gasLimit,
gasPrice: gasPrice,
feeCurrency: feeCurrency, // Celo-specific
gatewayFeeRecipient: gatewayFeeRecipient, // Celo-specific
gatewayFee: gatewayFee, // Celo-specific
data: data,
ethCompatible: ethCompatible, // Bool to check presence of: feeCurrency, gatewayFeeRecipient, gatewayFee
checkNonce: checkNonce,
}
Bridge-related instructions.
Usage:
celo-cli bridge [command]
Available Commands:
register-resource Register a resource ID
set-burn Set a token contract as mintable/burnable
Flags:
-h, --help help for bridge
Register a resource ID with a contract address for a handler
Usage:
celo-cli bridge register-resource [flags]
Flags:
--bridge string bridge contract address
--handler string handler contract address
-h, --help help for register-resource
--resourceId string resource ID to be registered
--target string contract address to be registered
Set a token contract as mintable/burnable in a handler
Usage:
celo-cli bridge set-burn [flags]
Flags:
--bridge string bridge contract address
--handler string ERC20 handler contract address
-h, --help help for set-burn
--tokenContract string token contract to be registered
Deploy smart contracts.
This command can be used to deploy all or some of the contracts required for bridging. Selection of contracts can be made by either specifying --all or a subset of flags.
Usage:
celo-cli deploy [flags]
Flags:
--all deploy all
--bridge deploy bridge
--bridgeAddress string bridge contract address. Should be provided if handlers are deployed separately
--chainId string chain ID for the instance (default "1")
--erc20 deploy ERC20
--erc20Handler deploy ERC20 handler
--erc20Name string ERC20 contract name
--erc20Symbol string ERC20 contract symbol
--erc721 deploy ERC721
--fee string fee to be taken when making a deposit (in ETH, decimas are allowed) (default "0")
-h, --help help for deploy
--relayerThreshold uint number of votes required for a proposal to pass (default 1)
--relayers strings list of initial relayers
erc20-related instructions
Usage:
celo-cli erc20 [command]
Available Commands:
add-minter Add a minter to an Erc20 mintable contract
allowance Set a token contract as mintable/burnable
approve Approve tokens in an ERC20 contract for transfer
balance Query balance of an account in an ERC20 contract
deposit Initiate a transfer of ERC20 tokens
mint Mint tokens on an ERC20 mintable contract
Flags:
-h, --help help for erc20
Add a minter to an Erc20 mintable contract.
Usage:
celo-cli erc20 add-minter [flags]
Flags:
--erc20Address string ERC20 contract address
-h, --help help for add-minter
--minter string address of minter
Set a token contract as mintable/burnable in a handler.
Usage:
celo-cli erc20 allowance [flags]
Flags:
--erc20Address string ERC20 contract address
-h, --help help for allowance
--owner string address of token owner
--spender string address of spender
Approve tokens in an ERC20 contract for transfer.
Usage:
celo-cli erc20 approve [flags]
Flags:
--amount string amount to grant allowance
--decimals uint ERC20 token decimals (default 18)
--erc20address string ERC20 contract address
-h, --help help for approve
--recipient string address of recipient
Query balance of an account in an ERC20 contract.
Usage:
celo-cli erc20 balance [flags]
Flags:
--accountAddress string address to receive balance of
--erc20Address string ERC20 contract address
-h, --help help for balance
Initiate a transfer of ERC20 tokens.
Usage:
celo-cli erc20 deposit [flags]
Flags:
--amount string amount to deposit
--bridge string address of bridge contract
--decimals uint ERC20 token decimals
--destId string destination chain ID
-h, --help help for deposit
--recipient string address of recipient
--resourceId string resource ID for transfer
Mint tokens on an ERC20 mintable contract.
Usage:
celo-cli erc20 mint [flags]
Flags:
--amount string amount to mint fee (in ETH)
--decimal uint ERC20 token decimals (default 18)
--dstAddress string Where tokens should be minted. Defaults to TX sender
--erc20Address string ERC20 contract address
-h, --help help for mint
We take all security issues seriously, if you believe you have found a security issue within a ChainSafe project please notify us immediately. If an issue is confirmed, we will take all necessary precautions to ensure a statement and patch release is made in a timely manner.
Please email us a description of the flaw and any related information (e.g. reproduction steps, version) to security at chainsafe dot io.
GNU Lesser General Public License v3.0