概要
この章では、2つのL1 Blockchain間でメッセージを送信していきます。 ローカル環境をリセットしたい場合は、「L1の削除」の「L1を完全に削除」を参考にしてください。
Relayerのデプロイ
まずは、2つのL1 Blockchain間でメッセージを中継するオフチェーンコンポーネントであるRelayerをデプロイしていきます。
L1 Blockchainの作成時はRelayerはまだデプロイされていません。
deploy コマンドの実行時に以下のメッセージが最後に表示されているはずです。
Relayer is not deployed due to: relayer process failed during setup
To deploy a local relayer later on, call `avalanche interchain relayer deploy`
This does not affect L1 operations besides Interchain MessagingこのようにRelayerは別途デプロイする必要があるため、以下のコマンドを実行してデプロイしていきます。
avalanche interchain relayer deployRelayerをデプロイするネットワークの選択を求められるので、「Local Network」を選択してください。
? In which Network will operate the Relayer?:
▸ Local Network
Devnet
Fuji TestnetRelayerのログレベルの選択を求められるので、「info」を選択してください。
? Which log level do you prefer for your relayer?:
▸ info
warn
error
off
↓ fatalRelayerにL1 Blockchainの情報を設定するか聞かれるので、「Yes, I want to configure source and destination blockchains」を選択してください。
? Do you want to add blockchain information to your relayer?:
▸ Yes, I want to configure source and destination blockchains
No, I prefer to configure the relayer later on
Explain the differenceRelayerの設定を行うL1 Blockchainの情報について聞かれるので、「Add a blockchain」を選択してください。
? Configure the blockchains that will be interconnected by the relayer:
▸ Add a blockchain
Cancel追加するL1 Blockchainについて聞かれるので、送付元L1 Blockchain(Source)と送付先L1 Blockchain(Destination)として追加したいので、「Source and Destination」を選択してください。
? What role should the blockchain have?:
▸ Source and Destination
Source only
Destination only
Explain the difference
Cancel追加したいL1 Blockchainについて選択を求められるので、「Blockchain chain1」を選択してください。
? Which blockchain do you want to set both as source and destination?:
C-Chain
▸ Blockchain chain1
Blockchain chain2
CustomRelayerへの報酬を受け取るアドレスの設定を求めらるので、「Use the Genesis Allocated address...」か「Get address from an existing stored key...」のどちらかを選択してください。
? Which address do you want to receive relayer rewards on chain1?:
Use the Genesis Allocated address 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
▸ Get address from an existing stored key (created from avalanche key create or avalanche key import)
Custom「Get address from an existing stored key」を選択した場合、以下のようにどの鍵を使用するか聞かれるので、「ewoq」を選択してください。
? Which stored key should be used receive relayer rewards on chain1?:
sample-key
▸ ewoq
cli-awm-relayer
cli-teleporter-deployerRelayerにガス代を支払う鍵の選択を求められるので、「Get private key from an existing stored key...」を選択してください。
Please provide a key that is not going to be used for any other purpose on destination
Use the arrow keys to navigate: ↓ ↑ → ←
? Which private key do you want to use to pay relayer fees on chain1?:
▸ Get private key from an existing stored key (created from avalanche key create or avalanche key import)
Customどの鍵を使用するか聞かれるので、「ewoq」を選択してください。
? Which stored key should be used pay relayer fees on chain1?:
sample-key
▸ ewoq
cli-awm-relayer
cli-teleporter-deployerさらに追加するか確認を求められるので、「Add a blockchain」を選択して、先ほどの手順でもう1つのL1 Blockchainを追加してください。
? Configure the blockchains that will be interconnected by the relayer:
▸ Add a blockchain
Remove a blockchain
Preview
Confirm
Cancel追加ができたら、再度確認を求められるので設定の確認をするために「Preview」を選択してください。
? Configure the blockchains that will be interconnected by the relayer:
Add a blockchain
Remove a blockchain
▸ Preview
Confirm
Cancel以下のように「Source」と「Destination」に2つのL1 Blockchainが追加されていれば設定ができています。
+-------------+--------+
| Source | chain1 |
+ +--------+
| | chain2 |
+-------------+--------+
| Destination | chain1 |
+ +--------+
| | chain2 |
+-------------+--------+「Confirm」を選択してください。
? Configure the blockchains that will be interconnected by the relayer:
Add a blockchain
Remove a blockchain
Preview
▸ Confirm
Cancel確認を求められるので、「Yes」を選択してください。
? Confirm?:
▸ Yes
No, keep editingRelayerがL1 Blockchain間のメッセージを中継するため、宛先チェーンのガス代を補充しておく必要があります。 そのため、以下では事前にガス代を補充しておくか確認されるので、「Yes, I want to fund destination blockchains」を選択してください。
? Do you want to fund relayer destinations?:
▸ Yes, I want to fund destination blockchains
No, I prefer to fund the relayer later on
Explain the difference確認を求められるので、「Yes, I will send funds to it」を選択してください。
? Do you want to fund relayer for destination chain1 (current C-Chain AVAX balance: 999999.975720250)?:
▸ Yes, I will send funds to it
Not now補充を行う鍵の選択を求められるので、「Get private key from an existing stored key...」を選択してください。
? Which private key do you want to use to fund the relayer destination chain1?:
Use the private key of the Genesis Allocated address 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
▸ Get private key from an existing stored key (created from avalanche key create or avalanche key import)
Custom「ewoq」を選択してください。
? Which stored key should be used fund the relayer destination chain1?:
sample-key
▸ ewoq
cli-awm-relayer
cli-teleporter-deployerいくら補充するか聞かれるので、「10000」など任意の値を入力してください。
✔ Amount to transfer (available: 999999.965720): 10000以下のように出力されていれば実行成功です。
Relayer version icm-relayer-v1.6.6
Executing Relayer
✓ Local AWM Relayer successfully started for Local Network
Logs can be found at /Users/cardene/.avalanche-cli/runs/LocalNetwork/local-relayer/icm-relayer.logもし以下のようなエラーメッセージが表示されたら、既にポート番号が使用されているのでポートを変更する必要があります。
2025/09/06 12:02:59 maxprocs: Leaving GOMAXPROCS=12: CPU quota undefined
{"level":"info","timestamp":"2025-09-06T12:02:59.644+0900","logger":"icm-relayer","caller":"main/main.go:95","msg":"Initializing icm-relayer"}
{"level":"info","timestamp":"2025-09-06T12:02:59.648+0900","logger":"icm-relayer","caller":"main/main.go:105","msg":"Initializing destination clients"}
{"level":"info","timestamp":"2025-09-06T12:02:59.649+0900","logger":"icm-relayer","caller":"evm/destination_client.go:200","msg":"Initialized destination client","blockchainID":"w7ThnGXmC4ZtUDZE7Wv5bDFzsgnZa4c48Y2EBGJNdUs88Bheo","evmChainID":"11","nonce":5}
{"level":"info","timestamp":"2025-09-06T12:02:59.651+0900","logger":"icm-relayer","caller":"evm/destination_client.go:200","msg":"Initialized destination client","blockchainID":"SMXGPr8rzQJiFDbiuKbARMNmYBpw6bLDwYPk55s4Z9PpqXWQG","evmChainID":"22","nonce":5}
{"level":"info","timestamp":"2025-09-06T12:02:59.651+0900","logger":"icm-relayer","caller":"main/main.go:113","msg":"Initializing source clients"}
{"level":"info","timestamp":"2025-09-06T12:02:59.651+0900","logger":"icm-relayer","caller":"main/main.go:141","msg":"Initializing app request network"}
{"level":"info","timestamp":"2025-09-06T12:02:59.651+0900","logger":"icm-relayer","caller":"metrics/server.go:36","msg":"Starting metrics server...","port":9092}
{"level":"fatal","timestamp":"2025-09-06T12:02:59.651+0900","logger":"icm-relayer","caller":"metrics/server.go:44","msg":"Metrics check server exited with error","error":"listen tcp :9092: bind: address already in use"}
Error: relayer process failed during setupまずはRelayerの設定ファイルを探します。
LATEST_CFG=$(ls -t ~/.avalanche-cli/runs/*/icm-relayer-config.json | head -1)
echo "$LATEST_CFG"以下のようにRelayerの設定ファイルの場所が出力されます。
/Users/<username>/.avalanche-cli/runs/network_20250906_114049/icm-relayer-config.json設定ファイルをコピーします。
cp "$LATEST_CFG" "${LATEST_CFG}.bak"Relayerの設定ファイルのポート番号を 9092 から 19192 と 9093 から 19193 に置き換えていきます。
jq '.["metrics-port"]=19192 | .["api-port"]=19193' "$LATEST_CFG" > "$LATEST_CFG.tmp" && mv "$LATEST_CFG.tmp" "$LATEST_CFG"deploy コマンドを実行してしまうと、設定ファイルが上書きされてしまうので、start コマンドを実行します。
avalanche interchain relayer start --local以下のように出力されていれば実行成功です。
Relayer version icm-relayer-v1.6.6
Executing Relayer
✓ Local AWM Relayer successfully started for Local Network
Logs can be found at /Users/cardene/.avalanche-cli/runs/LocalNetwork/local-relayer/icm-relayer.log以下のようにいくつかオプションがあるので1つずつ簡単に説明します。
--allow-private-ips allow relayer to connec to private ips (default true)
--amount float automatically fund l1s fee payments with the given amount
--bin-path string use the given relayer binary
--blockchain-funding-key string key to be used to fund relayer account on all l1s
--blockchains strings blockchains to relay as source and destination
--cchain relay C-Chain as source and destination
--cchain-amount float automatically fund cchain fee payments with the given amount
--cchain-funding-key string key to be used to fund relayer account on cchain
--cluster string operate on the given cluster
--devnet operate on a devnet network
--endpoint string use the given endpoint for network operations
-f, --fuji testnet operate on fuji (alias to testnet
--key string key to be used by default both for rewards and to pay fees
-l, --local operate on a local network
--log-level string log level to use for relayer logs
-t, --testnet fuji operate on testnet (alias to fuji)
--version string version to deploy (default "latest-prerelease")--allow-private-ipsRelayerがプライベートIP(例: 192.168.x.x)への接続を許可します。 デフォルトはtrueです。--amount float各L1 Blockchainの手数料用残高を指定額だけ自動で補充します)。--bin-path string使用するRelayerのバイナリファイルへのパスを指定します。--blockchain-funding-key string設定したいL1 BlockchainのRelayerアカウントに資金を送るアカウントを指定します。--blockchains strings中継対象のブロックチェーンを指定します。 複数ある場合はカンマ区切りで設定できます。--cchainC-Chain上のL1 Blockchainを指定します。--cchain-amount floatC-Chainの手数料用残高を指定額だけ補充します。--cchain-funding-key stringC-Chain上のRelayerに資金を送付するアカウントを指定します(--blockchain-funding-keyを上書き)。--cluster string操作対象のクラスタ名を指定します(Avalanche CLIで設定したノード群)。--devnetDevnet上のL1 Blockchainを指定します。--endpoint stringネットワーク操作に使うエンドポイント URLを指定します。-f, --fujiFuji上のL1 Blockchainを指定します。--key string報酬の受取と手数料支払いの両方に使用する鍵を指定します(Avalanche CLIに保存キー名など)。-l, --localローカルネットワーク上のL1 Blockchainを指定します。-t, --testnetTestnet上のL1 Blockchainを指定します。(--fujiのエイリアス)。--version stringデプロイするRelayerのバージョンを指定します。 デフォルトは、"latest-prerelease"です。
Relayerのログ
AWM リレイヤー(ICM のメッセージ中継プロセス)のログを見やすく整形して表示します。 AWM リレイヤーがエラーを返していたり、正常に動作しているか確認したい時にログの確認ができると便利です。 以下のコマンドを実行してください。
avalanche interchain relayer logs以下のようにログを確認したいネットワークを聞かれるので、「Local Network」を選択してください。
? Choose a network for the operation:
▸ Local Network
Fuji Testnet以下のようにログが表示されていれば実行成功です。
+-----+----------+--------+------------------------------------------------------------------------------------+
| | TIME | CHAIN | LOG |
+-----+----------+--------+------------------------------------------------------------------------------------+
| ℹ️ | 16:41:52 | | Initializing icm-relayer |
| ℹ️ | 16:41:52 | | Initializing destination clients |
| ℹ️ | 16:41:52 | chain1 | Initialized destination client |
| | | | blockchainID=chain1 |
| | | | evmChainID=11 |
| ℹ️ | 16:41:52 | chain2 | Initialized destination client |
| | | | blockchainID=chain2 |
| | | | evmChainID=22 |
| ℹ️ | 16:41:52 | | Initializing source clients |
| ℹ️ | 16:41:52 | | Initializing app request network |
| ℹ️ | 16:41:52 | | Starting metrics server... |
| ℹ️ | 16:41:52 | chain2 | Checking sufficient stake for source blockchain |
| | | | blockchainID=chain2 |
| | | | subnetID=2LG6ifevesrpBqndpbRQmQ8kQYKVeZHUaBJVtTpDNzAy4uprqo |
| ℹ️ | 16:41:52 | chain1 | Checking sufficient stake for source blockchain |
| | | | blockchainID=chain1 |
| | | | subnetID=2W9boARgCWL25z6pMFNtkCfNA5v28VGg9PmBgUJfuKndEdhrvw |
| ℹ️ | 16:41:57 | | Connected to sufficient stake |
| | | | subnetID=2W9boARgCWL25z6pMFNtkCfNA5v28VGg9PmBgUJfuKndEdhrvw |
| ℹ️ | 16:41:57 | | Connected to sufficient stake |
| | | | subnetID=2LG6ifevesrpBqndpbRQmQ8kQYKVeZHUaBJVtTpDNzAy4uprqo |
| ℹ️ | 16:41:57 | chain1 | Creating application relayers |
| | | | originBlockchainID=chain1 |
| ℹ️ | 16:41:57 | chain1 | processed-missed-blocks set to false, starting processing from chain head |
| | | | blockchainID=chain1 |
| ℹ️ | 16:41:57 | | Creating checkpoint manager |
| | | | relayerID=0x5815530c7437b7d3e3538e55bc4d86c4e5dd4671514a740b3bb8c467565973c5 |
| ℹ️ | 16:41:57 | chain1 | Created application relayer |
| | | | destinationAddress=0x0000000000000000000000000000000000000000 |
| | | | destinationBlockchainID=chain1 |
| | | | originSenderAddress=0x0000000000000000000000000000000000000000 |
| | | | relayerID=0x5815530c7437b7d3e3538e55bc4d86c4e5dd4671514a740b3bb8c467565973c5 |
| | | | sourceBlockchainID=chain1 |
| ℹ️ | 16:41:57 | | Creating checkpoint manager |
| | | | relayerID=0x7ea37b8a94e7c4a39ffaebf539af90c40e4c09fe5fdd99171a9d2fea0120cddc |
| ℹ️ | 16:41:57 | chain1 | Created application relayer |
| | | | destinationAddress=0x0000000000000000000000000000000000000000 |
| | | | destinationBlockchainID=chain2 |
| | | | originSenderAddress=0x0000000000000000000000000000000000000000 |
| | | | relayerID=0x7ea37b8a94e7c4a39ffaebf539af90c40e4c09fe5fdd99171a9d2fea0120cddc |
| | | | sourceBlockchainID=chain1 |
| ℹ️ | 16:41:57 | chain1 | Created application relayers |
| | | | blockchainID=chain1 |
| ℹ️ | 16:41:57 | chain2 | Creating application relayers |
| | | | originBlockchainID=chain2 |
| ℹ️ | 16:41:57 | chain2 | processed-missed-blocks set to false, starting processing from chain head |
| | | | blockchainID=chain2 |
| ℹ️ | 16:41:57 | | Creating checkpoint manager |
| | | | relayerID=0xc38c0bba6c38fa1e6439dcde4e17443662ec8b67adc2e214472b7c775035667b |
| ℹ️ | 16:41:57 | chain2 | Created application relayer |
| | | | destinationAddress=0x0000000000000000000000000000000000000000 |
| | | | destinationBlockchainID=chain2 |
| | | | originSenderAddress=0x0000000000000000000000000000000000000000 |
| | | | relayerID=0xc38c0bba6c38fa1e6439dcde4e17443662ec8b67adc2e214472b7c775035667b |
| | | | sourceBlockchainID=chain2 |
| ℹ️ | 16:41:57 | | Creating checkpoint manager |
| | | | relayerID=0xdb6acd3998e0e02d1d9560bac5defc81819c36ca3cdfab534d8138f3f1d175fd |
| ℹ️ | 16:41:57 | chain2 | Created application relayer |
| | | | destinationAddress=0x0000000000000000000000000000000000000000 |
| | | | destinationBlockchainID=chain1 |
| | | | originSenderAddress=0x0000000000000000000000000000000000000000 |
| | | | relayerID=0xdb6acd3998e0e02d1d9560bac5defc81819c36ca3cdfab534d8138f3f1d175fd |
| | | | sourceBlockchainID=chain2 |
| ℹ️ | 16:41:57 | chain2 | Created application relayers |
| | | | blockchainID=chain2 |
| ℹ️ | 16:41:57 | | Initialization complete |
| ℹ️ | 16:41:57 | chain2 | Creating relayer |
| | | | blockchainID=chain2 |
| | | | blockchainIDHex=3991a75ccbcd2bbf4be87b0699f9e2eade79f3e093ef3930292923d0ae62ec4c |
| | | | subnetID=2LG6ifevesrpBqndpbRQmQ8kQYKVeZHUaBJVtTpDNzAy4uprqo |
| | | | subnetIDHex=af6dd38e4fd6c2ba7e949605a5686e8dd3db136228ed54eb18559ddba4bb7bc1 |
| ℹ️ | 16:41:57 | chain1 | Creating relayer |
| | | | blockchainID=chain1 |
| | | | blockchainIDHex=7addd461a59c348d1ee7096f51ff448be96bb81b2363ea2e5fb2b01f307b16f1 |
| | | | subnetID=2W9boARgCWL25z6pMFNtkCfNA5v28VGg9PmBgUJfuKndEdhrvw |
| | | | subnetIDHex=c5e17d557e60fe8002dee4b7943d8a85c9171a32f5f082765d430b8ab5f98441 |
| ℹ️ | 16:41:57 | chain2 | Listener initialized. Listening for messages to relay. |
| | | | originBlockchainID=chain2 |
| ℹ️ | 16:41:57 | chain1 | Listener initialized. Listening for messages to relay. |
| | | | originBlockchainID=chain1 |
| ℹ️ | 16:41:57 | chain2 | Processing historical logs |
| | | | blockchainID=chain2 |
| ℹ️ | 16:41:57 | chain1 | Processing historical logs |
| | | | blockchainID=chain1 |
| ℹ️ | 16:46:03 | chain1 | Unpacked warp message |
| | | | destinationAddress=0x0000000000000000000000000000000000000000 |
| | | | destinationBlockchainID=chain2 |
| | | | originSenderAddress=0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC |
| | | | sourceBlockchainID=chain1 |
| | | | warpMessageID=2Myjm3RaKXLc3vKwG1diy4pNudJczCpb8nWzATC8krPxb82vaq |
| ℹ️ | 16:46:03 | chain1 | Registering message handler |
| | | | originSenderAddress=0x253b2784c75e510dD0fF1da844684a1aC0aa5fcf |
| | | | originTxID=0x2997bf62e2cd594b7c3400dc981aa999d7a6367d9b2882530e204bebe74a1700 |
| | | | relayerID=0x7ea37b8a94e7c4a39ffaebf539af90c40e4c09fe5fdd99171a9d2fea0120cddc |
| | | | sourceBlockchainID=chain1 |
| | | | warpMessageID=2Myjm3RaKXLc3vKwG1diy4pNudJczCpb8nWzATC8krPxb82vaq |
| ℹ️ | 16:46:03 | | Relaying message |
| | | | relayerID=0x7ea37b8a94e7c4a39ffaebf539af90c40e4c09fe5fdd99171a9d2fea0120cddc |
| ℹ️ | 16:46:03 | chain1 | Signing subnet not found, requesting from PChain |
| | | | blockchainID=chain1 |
| | | | destinationBlockchainID=chain2 |
| | | | teleporterMessageID=2kkGQH7VTZdYW1v8gyJpuqNcnTrKtjdAcKCcwPDAZ5MdQM1KpS |
| | | | warpMessageID=2Myjm3RaKXLc3vKwG1diy4pNudJczCpb8nWzATC8krPxb82vaq |
| ℹ️ | 16:46:03 | chain1 | Created signed message. |
| | | | destinationBlockchainID=chain2 |
| | | | signingSubnetID=2W9boARgCWL25z6pMFNtkCfNA5v28VGg9PmBgUJfuKndEdhrvw |
| | | | sourceBlockchainID=chain1 |
| | | | teleporterMessageID=2kkGQH7VTZdYW1v8gyJpuqNcnTrKtjdAcKCcwPDAZ5MdQM1KpS |
| | | | warpMessageID=2Myjm3RaKXLc3vKwG1diy4pNudJczCpb8nWzATC8krPxb82vaq |
| ℹ️ | 16:46:03 | chain2 | Sending message to destination chain |
| | | | destinationBlockchainID=chain2 |
| | | | teleporterMessageID=2kkGQH7VTZdYW1v8gyJpuqNcnTrKtjdAcKCcwPDAZ5MdQM1KpS |
| | | | warpMessageID=2Myjm3RaKXLc3vKwG1diy4pNudJczCpb8nWzATC8krPxb82vaq |
| ℹ️ | 16:46:03 | chain2 | Sending transaction |
| | | | blockchainID=chain2 |
| | | | senderAddress=0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC |
| | | | txID=0xb7781069eadf864f664c45ea433fa22a2a9462e323c0d45ade8483c47b4d6fd6 |
| ℹ️ | 16:46:03 | chain2 | Sent transaction |
| | | | blockchainID=chain2 |
| | | | senderAddress=0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC |
| | | | txID=0xb7781069eadf864f664c45ea433fa22a2a9462e323c0d45ade8483c47b4d6fd6 |
| ⚠️ | 16:46:03 | chain2 | operation failed, retrying... |
| | | | blockchainID=chain2 |
| | | | logMessage=waitForReceipt |
| | | | senderAddress=0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC |
| ℹ️ | 16:46:04 | chain2 | Delivered message to destination chain |
| | | | destinationBlockchainID=chain2 |
| | | | teleporterMessageID=2kkGQH7VTZdYW1v8gyJpuqNcnTrKtjdAcKCcwPDAZ5MdQM1KpS |
| | | | txID=0xb7781069eadf864f664c45ea433fa22a2a9462e323c0d45ade8483c47b4d6fd6 |
| | | | warpMessageID=2Myjm3RaKXLc3vKwG1diy4pNudJczCpb8nWzATC8krPxb82vaq |
| ℹ️ | 16:46:04 | chain2 | Finished relaying message to destination chain |
| | | | destinationBlockchainID=chain2 |
| | | | relayerID=0x7ea37b8a94e7c4a39ffaebf539af90c40e4c09fe5fdd99171a9d2fea0120cddc |
| | | | txID=0xb7781069eadf864f664c45ea433fa22a2a9462e323c0d45ade8483c47b4d6fd6 |
+-----+----------+--------+------------------------------------------------------------------------------------+以下のようにいくつかオプションがあるので1つずつ簡単に説明します。
--endpoint string use the given endpoint for network operations
--first uint output first N log lines
-f, --fuji testnet operate on fuji (alias to testnet
--last uint output last N log lines
-l, --local operate on a local network
--raw raw logs output
-t, --testnet fuji operate on testnet (alias to fuji)--endpoint stringログ取得に用いる接続先エンドポイントURLを指定します。--first uint先頭からN行のログを出力します。-f, --fujiFujiテストネットを対象にします(--testnetのエイリアス)。--last uint末尾からN行のログを出力します。-l, --localローカルネットワークを対象にします。--raw整形せずそのままのログ(raw)を出力します。 フィルタやパイプ処理向けです。-t, --testnetTestnetを対象にします(--fujiのエイリアス)。
Relayerの停止
現在稼働中のAWM リレイヤーを停止します。 以下のコマンドを実行してください。
avalanche interchain relayer stop停止対象のネットワークについて聞かれるので、「Local Network」を選択してください。
? Choose a network for the operation:
▸ Local Network
Fuji Testnet以下のように出力されればリレイヤーの停止が成功しています。
✓ Local AWM Relayer successfully stopped for Local Network以下のようにいくつかオプションがあるので1つずつ簡単に説明します。
--cluster string operate on the given cluster
--endpoint string use the given endpoint for network operations
-f, --fuji testnet operate on fuji (alias to testnet
-l, --local operate on a local network
-t, --testnet fuji operate on testnet (alias to fuji)--cluster string操作対象のクラスタ名を指定します。--endpoint stringAvalanche CLIの制御で使用する接続先エンドポイント URLを指定します。-f, --fujiFujiテストネットを対象にします(--testnetのエイリアス)。-l, --localローカルネットワークを対象にします。-t, --testnetTestnetを対象にします(--fujiのエイリアス)。
Relayerの起動
Relayerの作成後に、何らかの理由でRelayerを停止してしまったり、設定ファイルから起動させたい場合があります。 以下のコマンドを実行してください。
avalanche interchain relayer start起動対象のネットワークについて聞かれるので、「Local Network」を選択してください。
? Choose a network for the operation:
▸ Local Network
Fuji Testnet以下のように出力されていたら起動成功です。
Executing Relayer
✓ Local AWM Relayer successfully started for Local Network
Logs can be found at /Users/cardene/.avalanche-cli/runs/LocalNetwork/local-relayer/icm-relayer.log以下のようにいくつかオプションがあるので1つずつ簡単に説明します。
--bin-path string use the given relayer binary
--cluster string operate on the given cluster
--endpoint string use the given endpoint for network operations
-f, --fuji testnet operate on fuji (alias to testnet
-l, --local operate on a local network
-t, --testnet fuji operate on testnet (alias to fuji)
--version string version to use (default "latest-prerelease")--bin-path string使用するRelayerのバイナリファイルのパスを指定します。--cluster string操作対象のクラスタ名を指定します(Avalanche CLIで命名したノード群)。--endpoint stringAvalanche CLIの制御で使用する接続先エンドポイント URLを指定します。-f, --fujiFujiテストネットを対象にします(--testnetのエイリアス)。-l, --localローカルネットワークを対象にします。-t, --testnetTestnetを対象にします(--fujiのエイリアス)。--version string起動に使用するRelayerのバージョンを指定します。 デフォルトは、"latest-prerelease"です。
messengerコントラクトのdeploy
指定したL1 BlockchainにICM MessengerコントラクトとICM Registryコントラクトをデプロイします。 ICM Messengerコントラクトは、メッセージの送受信を行い、ICM Registryコントラクトは各L1 BlockchainのRelayerのアドレスとICM Messengerコントラクトのアドレスを管理します。 以下のコマンドを実行してください。
avalanche interchain messenger deployデプロイ対象のネットワークの選択を求められるので、「Local Network」を選択してください。
? On what Network do you want to deploy the ICM Messenger?:
▸ Local Network
Devnet
Fuji Testnet
Mainnetデプロイ対象のL1 Blockchainの選択を求められるので、RelayerをデプロイしたL1 Blockchainのうち片方を選択してください。
? Which Blockchain would you like to deploy ICM to?:
? Which Blockchain would you like to deploy ICM to?:
C-Chain
▸ Blockchain chain1
Blockchain chain2
Customデプロイを行うアカウントの選択を求められるので、「Use the private key of the Genesis Allocated address...」か「Get private key from an existing stored key...」を選択してください。
? Which private key do you want to use to deploy ICM?:
Use the private key of the Genesis Allocated address 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
▸ Get private key from an existing stored key (created from avalanche key create or avalanche key import)
Custom「Get private key from an existing stored key...」を選択した場合は、「ewoq」を選択してください。
? Which stored key should be used deploy ICM?:
sample-key
▸ ewoq
cli-awm-relayer
cli-teleporter-deployer既にデプロイ済みであるため、以下のようなメッセージが表示されますが、デプロイされていない場合はこの手順で2つのコントラクトがデプロイされます。
ICM Messenger has already been deployed to chain1
ICM Messenger has already been deployed to c-chain以下のようにいくつかオプションがあるので1つずつ簡単に説明します。
--blockchain string deploy ICM into the given CLI blockchain
--blockchain-id string deploy ICM into the given blockchain ID/Alias
--c-chain deploy ICM into C-Chain
--cchain-key string key to be used to pay fees to deploy ICM to C-Chain
--cluster string operate on the given cluster
--deploy-messenger deploy ICM Messenger (default true)
--deploy-registry deploy ICM Registry (default true)
--devnet operate on a devnet network
--endpoint string use the given endpoint for network operations
--force-registry-deploy deploy ICM Registry even if Messenger has already been deployed
-f, --fuji testnet operate on fuji (alias to testnet
--genesis-key use genesis allocated key to fund ICM deploy
--include-cchain deploy ICM also to C-Chain
--key string CLI stored key to use to fund ICM deploy
-l, --local operate on a local network
-m, --mainnet operate on mainnet
--messenger-contract-address-path string path to a messenger contract address file
--messenger-deployer-address-path string path to a messenger deployer address file
--messenger-deployer-tx-path string path to a messenger deployer tx file
--private-key string private key to use to fund ICM deploy
--registry-bytecode-path string path to a registry bytecode file
--rpc-url string use the given RPC URL to connect to the subnet
-t, --testnet fuji operate on testnet (alias to fuji)
--version string version to deploy (default "latest")--blockchain stringAvalanche CLIで管理しているブロックチェーン名を指定して、そのL1 Blockchain上にICMコントラクトをデプロイします。--blockchain-id stringブロックチェーンID/エイリアス(CB58 など)を直接指定してICMコントラクトをデプロイします。--c-chainC-ChainにICMをデプロイします。--cchain-key stringC-Chain側のデプロイ手数料を支払うための鍵名(Avalanche CLIに保存された鍵)を指定します。--cluster string操作対象のクラスタ名(Avalanche CLIが命名したノード集合)を指定します。--deploy-messenger(デフォルト: true) ICM Messengerコントラクトをデプロイします。 不要ならfalseにします。--deploy-registry(デフォルト: true) ICM Registryコントラクトをデプロイします。 不要ならfalseにします。--devnetDevnetを対象にします。--endpoint stringAvalanche CLIのネットワーク操作に使う制御用エンドポイントURLを指定します。--force-registry-deployICM Messengerコントラクトが既にデプロイ済みでもRegistryコントラクトを強制デプロイします。-f, --fujiFujiを対象にします(--testnetのエイリアス)。--genesis-keyL1 Blockchain作成時のアカウントを、ICMコントラクトのデプロイアドレスとして使用します。--include-cchain指定したL1 Blockchainに加えてC-ChainにもICMコントラクトをデプロイします。--key stringAvalanche CLIに保存済みのアカウント名を、ICMコントラクトのデプロイに使用します。-l, --localローカルネットワークを対象にします。-m, --mainnetMainnetを対象にします。--messenger-contract-address-path stringMessengerコントラクトアドレスを書き出す/読み込むファイルパスを指定します。--messenger-deployer-address-path stringMessengerコントラクトのデプロイヤーのアドレスを記録するファイルパスを指定します。--messenger-deployer-tx-path stringMessengerコントラクトのデプロイ時のトランザクション情報を記録するファイルパスを指定します。--private-key string秘密鍵を直接指定し、ICMコントラクトのデプロイを行うアドレスに設定します。--registry-bytecode-path stringRegistryコントラクトのバイトコードを外部ファイルから読み込む場合のパスを指定します。--rpc-url string対象サブネット(L1 Blockchain)に接続するためのRPC URLを指定します(RPC=ノードのHTTP/HTTPSエンドポイント)。-t, --testnetTestnetを対象にします(--fujiのエイリアス)。--version string(デフォルト:"latest") デプロイするICMコントラクトのバージョンを指定します。
Token Transferrerコントラクトのデプロイ
指定したL1 BlockchainにToken Transferrerコントラクト(L1 Blockchain間でトークンをロック/ミントしてTransferするためのコントラクト群)をデプロイします。 Home Chainは送信元L1 Blockchain(ラップドトークンを発行)、Remote Chainは送信先L1 Blockchain(ラップドトークンをBurnする側)です。 以下のコマンドを実行してください。
avalanche interchain tokenTransferrer deployToken Transferrerコントラクトをデプロイするネットワークの選択を求められるので、「Local Network」を選択してください。
? On what Network do you want to deploy the Transferrer?:
▸ Local Network
Devnet
Fuji Testnet
Mainnet送付元L1 Blockchainの選択を求められるので、「Blockchain chain1」を選択してください。
? Where is the Token origin?:
C-Chain
▸ Blockchain chain1
Blockchain chain2
My blockchain isn't listedデプロイするコントラクトについて聞かれるので、「Deploy a new Home for the token」を選択してください。
? What kind of token do you want to be able to transfer?:
A token that already has a Home deployed (recommended)
▸ Deploy a new Home for the token
Explain the differenceネイティブトークンの送付を行うので、「The native token TK01」を選択してください。
? What kind of token do you want to deploy the Home for?:
▸ The native token TK01
An ERC-20 tokenコントラクトのデプロイとガス代の負担をするアドレスの選択を求められるので、「Use the private key of the Genesis Allocated address...」か「Get private key from an existing stored key...」を選択してください。
? Which private key do you want to use to pay for home deployment fees, and collateralization (if necessary)?:
Use the private key of the Genesis Allocated address 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
▸ Get private key from an existing stored key (created from avalanche key create or avalanche key import)
Custom「Get private key from an existing stored key...」を選択した場合は、「ewoq」を選択してください。
? Which stored key should be used pay for home deployment fees, and collateralization (if necessary)?:
sample-key
▸ ewoq
cli-awm-relayer
cli-teleporter-deployer送付先L1 Blockchainの選択を求められるので、「Blockchain chain2」を選択してください。
? Where should the token be available as an ERC-20?:
C-Chain
▸ Blockchain chain2
My blockchain isn't listedコントラクトのデプロイとガス代の負担をするアドレスの選択を求められるので、「Use the private key of the Genesis Allocated address...」か「Get private key from an existing stored key...」を選択してください。
? Which private key do you want to use to pay for remote deploy fees?:
Use the private key of the Genesis Allocated address 0x8db97C7cEcE249c2b98bDC0226Cc4C2A57BF52FC
▸ Get private key from an existing stored key (created from avalanche key create or avalanche key import)
Custom「Get private key from an existing stored key...」を選択した場合は、「ewoq」を選択してください。
? Which stored key should be used pay for remote deploy fees?:
sample-key
▸ ewoq
cli-awm-relayer
cli-teleporter-deployer以下のように出力されていれば実行成功です。
Downloading Avalanche ICTT Contracts
Compiling Avalanche ICTT Contracts
Wrapped Native Token Deployed to http://127.0.0.1:58685/ext/bc/w7ThnGXmC4ZtUDZE7Wv5bDFzsgnZa4c48Y2EBGJNdUs88Bheo/rpc
TK01 Address: 0xCB5bf91D236ebe6eF6AE57342570884234bd11Cc
Home Deployed to http://127.0.0.1:58685/ext/bc/w7ThnGXmC4ZtUDZE7Wv5bDFzsgnZa4c48Y2EBGJNdUs88Bheo/rpc
Home Address: 0xBBfCE55AD100b5bEd880083fCE366120347Af872
Remote Deployed to http://127.0.0.1:58782/ext/bc/SMXGPr8rzQJiFDbiuKbARMNmYBpw6bLDwYPk55s4Z9PpqXWQG/rpc
Remote Address: 0x768AF58E63775354938e9F3FEdB764F601c038b4
Registering remote contract with home contract以下のようにいくつかオプションがあるので1つずつ簡単に説明します。
--c-chain-home
--c-chain-remote
--cluster string
--deploy-erc20-home string
--deploy-native-home
--deploy-native-remote
--devnet
--endpoint string
-f, --fuji
-h, --help
--home-blockchain string
--home-genesis-key
--home-key string
--home-private-key string
--home-rpc string
-l, --local
-m, --mainnet
--remote-blockchain string
--remote-genesis-key
--remote-key string
--remote-private-key string
--remote-rpc string
--remote-token-decimals uint8
--remove-minter-admin
-t, --testnet
--use-home string
--version string
--config string
--log-level string
--skip-update-check--c-chain-homeHome ChainをC-Chainに設定します。--c-chain-remoteRemote ChainをC-Chainに設定します。C--cluster string操作対象のクラスタ名を指定します(Avalanche CLIで命名したノード集合)。--deploy-erc20-home string指定したチェーンのERC20トークンをHomeとして扱うTransferrer Homeコントラクトをデプロイします(トークンのコントラクトアドレスを指定します)。--deploy-native-homeネイティブトークンをHomeとして扱うTransferrer Homeコントラクトをデプロイします。--deploy-native-remoteネイティブトークンを Remote 側で扱う Transferrer Remote をデプロイします(Home 側ネイティブに対応するラップドトークンを発行します)。--devnetDevnet上で処理を実行します。--endpoint stringネットワーク操作に使う制御エンドポイントURLを指定します。-f, --fujiFuji上で処理を実行します(--testnetのエイリアスです)。--home-blockchain stringHome ChainとするAvalanche CLIで管理しているL1 Blockchain名を指定します。--home-genesis-keyHome Chain側でコントラクトをデプロイするときに、L1 Blockchain作成時に生成されるアカウントを使用します。--home-key stringHome Chain側にコントラクトをデプロイする時に使用するAvalanche CLIに保存されている鍵名を指定します。--home-private-key stringHome Chain側にコントラクトをデプロイする時に使用する秘密鍵を指定します。--home-rpc stringHome Chain側のRPC URLを指定します。-l, --localローカルネットワーク上で処理を実行します。-m, --mainnetMainnet上で処理を実行します。--remote-blockchain stringRemote Chain側でコントラクトをデプロイするときに、L1 Blockchain作成時に生成されるアカウントを使用します。--remote-genesis-keyRemote Chain側でコントラクトをデプロイするときに、L1 Blockchain作成時に生成されるアカウントを使用します。--remote-key stringRemote Chain側にコントラクトをデプロイする時に使用するAvalanche CLIに保存されている鍵名を指定します。--remote-private-key stringRemote Chain側にコントラクトをデプロイする時に使用する秘密鍵を指定します。--remote-rpc stringRemote Chain側のRPC URLを指定します。--remote-token-decimals uint8Remote Chain側のラップドトークンの小数桁数を指定します。 未指定の場合は Home Chain側トークンの桁数を使用します(新規ラップドネイティブは18がデフォルト)。--remove-minter-adminRemote Chain側で設定されているNative Minter(ネイティブ発行プリコンパイル)管理者を無効化します。 Remote Chain側での不正ミント権限を排除して、Transferrerの発行制御に一元化します。-t, --testnetTestnet上で処理を実行します(--fujiのエイリアスです)。--use-home string既存のTransferrer Homeコントラクトのアドレスを指定して再利用します(新規デプロイせずに紐付けます)。--version stringデプロイするAvalanche Interchain Token Transfer (ICTT)のタグ/ブランチ/コミットを指定します。 デフォルトはmainブランチです。