This a CosmWasm smart contract that demonstrates the Inter-Blockchain Communication protocol capabilities.
This contract has the following functionality:
- Messages
- Send a
WhoAmI
message to a remote chain contract such as ibc-remote - Change the admin account of the contract
- Send a
- Queries
- Get contract admin
- Get test information received from remote chain contract on specified channel
- Get test information received from all remote chain contract on all channels
Compile and optimize the smart contract Wasm.
make && make optimize
- provenanced cli
See the Overview for end-to-end steps
This contract is intended to be used with the other two projects in the ibc
directory:
To simplify the setup and execution, several scripts are provided in the scripts directory.
-
The
setup_local_chain
script will start a Provenance chain with 3 funded accounts:validator
,localaccount
, andrelayer
. This "local" chain will use the default ports. -
store_and_init_local_contract.sh
The
store_and_init_local_contract
script stores and initializes the "local" smart contract. This step must be performed before starting therelayer
-
The
execute_contract
script will send aWhoAmI
request to theremote
chain contract. The remote contract will respond with data that includes the current block height, timestamp, and chain-id of the remote chain as well as the remote contract's address. It subsequently monitors the current state data of the local contract so that the response can be visualized. It normally requires around 10-12 blocks before the response is received.
-
#[cw_serde] pub enum PacketMsg { WhoAmI {}, }
-
#[cw_serde] pub struct WhoAmIResponse { pub account: String, pub block_info: BlockInfo, }