Hongbai Deployment and Interaction
This is a quick reference/demo of the deployment process for a developer to deploy, instantiate, and query a simple CosmWasm smart contact on the MANTRA Hongbai Chain (Testnet).
The Smart Contract included in this demo is a very simple contract that stores the number of times the contract is "Poked".
Poke.wasm - about as simple as it gets - click here
For more detailed information visit the online documentation at https://docs.mantrachain.io
Quick Reference
RPC Endpoints: https://rpc.hongbai.mantrachain.io
API Endpoints: https://api.hongbai.mantrachain.io
Faucet: http://faucet.hongbai.mantrachain.io
Explorer: http://explorer.hongbai.mantrachain.io
Step 1. Download and Unzip the Pre-Built binary (Linux)
NOTE: If you get an error when running the CLI missing libwasmvm.x86_64.so
then you need to download the lib by running:
sudo wget -P /usr/lib https://github.com/CosmWasm/wasmvm/releases/download/v1.3.1/libwasmvm.x86_64.so
If you are using the dev container in this repository then this is already installed.
Step 2. Setup Environment Variables
Step 3. Add a Wallet
Remember to save the address and the mnemonic
Step 4. Get Some Tokens
Check your balance
mantrachaind query bank balances [YOUR WALLET ADDRESS] $NODEARG
Step 5. Deploy your Smart Contract Code
Remember to take note of the the CodeId that is returned in the
store_code
event You can Query itmantrachaind query tx --type hash [YOUR TX HASH] $NODEARG
or
mantrachaind query tx --type hash [YOUR TX HASH] $NODEARG -o json| jq -r '.logs[0].events[] | select(.type == "store_code") | .attributes[] | select(.key == "code_id") | .value'
You can view your transaction using the hash returned e.g.
http://explorer.hongbai.mantrachain.io/mantrachain/transactions/[YOUR TX HASH]
Step 6. Create an instance of your Contract
Remember to take note of the contract address from the
_contract_address
eventYou can Query it
mantrachaind query tx --type hash [YOUR TX HASH] $NODEARG
or
mantrachaind query tx --type hash [YOUR TX HASH] $NODEARG -o json | jq -r '.events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address").value'
if you have jq installedYou can view your transaction using the hash returned e.g.
http://explorer.hongbai.mantrachain.io/mantrachain/transactions/[YOUR TX HASH]
Step 7. Interact with the Contract
Query the Poke Count
e.g.
mantra1m7wqgq02e95anl7jk2qruvtdl7afyff0d6pddr0zhqmgsvle70ls7aa2ws
"Poke" the Contract
If you query the contact again, You should now see the counter "Value" has increased.
Last updated