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 DuKong Chain (Testnet).
The Smart Contract included in this demo is a very simple contract that stores the number of times the contract is "Poked".
# Download the CLIcurl-LO<https://github.com/MANTRA-Finance/public/raw/main/mantrachain-testnet/mantrachaind-linux-amd64.zip># Unzip the CLIunzipmantrachaind-linux-amd64.zip
On MacOS:
# Download the CLI for Intel chipscurl-LO<https://github.com/MANTRA-Finance/public/raw/main/mantrachain-hongbai/mantrachaind-static-darwin-amd64.tar.gz># Download the CLI for Silicon chips (M1, M2...)curl-LO<https://github.com/MANTRA-Finance/public/raw/main/mantrachain-hongbai/mantrachaind-static-darwin-arm64.tar.gz># Extract the CLItar-xzvfmantrachaind-static-darwin-*.tar.gz
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
You will need some OM test tokens stored in your wallet address in order to interact with the network. In order to get testnet tokens please request faucets atMANTRA Discord Server.
Check your balance mantrachaind query bank balances [YOUR WALLET ADDRESS] $NODE
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 it using mantrachaind query tx [YOUR TX HASH] $NODE
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 event
You can Query it mantrachaind query tx [YOUR TX HASH] $NODE
or mantrachaind query tx [YOUR TX HASH] $NODE -o json | jq -r '.events[] | select(.type == "instantiate") | .attributes[] | select(.key == "_contract_address").value' if you have jq installed
You 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
If you query the contact again, You should now see the counter "Value" has increased.
Last updated
export CHAIN_ID="mantra-dukong-1"
export RPC="<https://rpc.dukong.mantrachain.io>"
# If you are using the bash terminal (usually Windows/Linux) add the following lines:
export NODE="--node $RPC"
export TXFLAG="$NODE --chain-id $CHAIN_ID --gas-prices 0.01uom --gas auto --gas-adjustment 1.5"
# Otherwise, if you are using zsh terminal (usually MacOS) add the following lines instead:
export NODE=(--node $RPC)
export TXFLAG=($NODE --chain-id $CHAIN_ID --gas-prices 0.01uom --gas auto --gas-adjustment 1.5)