Messenger
What is messenger
Messenger is an independent inter-chain program. It works for MAP Omnichain Service.
Messenger listens to relevant events as preset in the program and builds a proof on the ledger of the source chain; then transmit the message of the event and proof to Vault or Data on the destination chain.
The flexibility of applications opens up many possibilities for Messenger, where applications can charge cross-chain users flexible transaction fees and reward Messenger accordingly.
Messenger SDK
As a main component of MAP Omnichain Services, Messenger SDK will be open to Dapp developers.
Quick Start
the recommanded way to get the executable is to download it from the release page.
if you want to build it from the source code,check the building section below.
2. Prepare the accounts for each chain
fund some accounts in order to send txs on each chain, you want to provice crosse-chain service. the esaiest way is to using the same one address for every chain.
after that we need to import the account into the keystore of compass. using the private key is the simplest way,run the following command in terminal:
during the process of importing, you will be asked to input a password. the password is used to encrypt your keystore.you have to input it when unlocking your account.
to list the imported keys in the keystore, using the command below:
3. Modify the configuration file
copy a example configure file from
modify the configuration accordingly. fill the accounts for each chain.
4. Running the executable
lauch and keep the executable runing simply by run:
you will be asked to input the password to unlock your account.(which you have inputed at step 2) if everything runs smoothly. it's all set
Building
Building compass requires a Go compiler(version 1.16 or later)
under the root directory of the repo
make build
: Builds compass
in ./build
.
make install
: Uses go install
to add compass
to your GOBIN.
Start with the following command:
Configuration
the configuration file is a small JSON file.
A chain configurations take this form:
chain | type |
---|---|
ethereum | ethereum |
bsc | bsc |
goerli | eth2 |
polygon | matic |
near | near |
klaytn | klaytn |
Options
Since MAP is also a EVM based chain, so the opts of the mapchain is following the options below as well Ethereum chains support the following additional options:
Blockstore
The blockstore is used to record the last block the maintainer processed, so it can pick up where it left off.
To disable loading from the chunk library, specify the "--fresh" flag. Add the fresh flag, and the program will execute from height 0,
In addition, the configuration file provides the "startBlock" option, and the program will execute from the startBlock
Keystore
Compass requires keys to sign and submit transactions, and to identify each bridge node on chain.
To use secure keys, see compass accounts --help
. The keystore password can be supplied with the KEYSTORE_PASSWORD
environment variable.
To import external ethereum keys, such as those generated with geth, use compass accounts import --ethereum /path/to/key
.
To import private keys as keystores, use compass accounts import --privateKey key
.
Chain Implementations
Ethereum (Solidity): contracts The Solidity contracts required for compass. Includes scripts for deployment.
Near
If you need to synchronize the near block, please install the near cli first. Here is a simple tutorial. For more information,
please check Near cli installation tutorial
First, install npm. Depending on the system, the running command is different. The following is an example of the installation command in
the ubuntu system. Use the apt install npm
command to run npm install -g near cli
,
After installation, use 'near -- version' to check whether the installation is successful
Configure the environment you need, for example:
` export NEAR_CLI_LOCALNET_RPC_SERVER_URL=https://archival-rpc.testnet.near.org
export NEAR_ENV=testnet `
Use the 'near login' command , Creates a key pair locally in .near-credentials
with an implicit account as the accountId. (hash representation of the public key)
And record the directory to the keystorePath option in the configuration file
In addition, another program needs to be run for near messenger. Please check near-lake-s3
Near
If you need to synchronize the near block, please install the near cli first. Here is a simple tutorial. For more information,
please check Near cli installation tutorial
First, install npm. Depending on the system, the running command is different. The following is an example of the installation command in
the ubuntu system. Use the apt install npm
command to run npm install -g near cli
,
After installation, use 'near -- version' to check whether the installation is successful
Configure the environment you need, for example:
` export NEAR_CLI_LOCALNET_RPC_SERVER_URL=https://archival-rpc.testnet.near.org
export NEAR_ENV=testnet `
Use the 'near login' command , Creates a key pair locally in .near-credentials
with an implicit account as the accountId. (hash representation of the public key)
And record the directory to the keystorePath option in the configuration file
In addition, another program needs to be run for near messenger. Please check near-lake-s3
Last updated