A Quick Example for Deployment using mantrachaind
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".
Poke.wasm - about as simple as it gets - click here
Step 1. Download and extract the pre-built binary
On Linux:
On MacOS:
Refer to the Install Prerequisites section for more details.
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 at MANTRA 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] $NODEor
mantrachaind query tx [YOUR TX HASH] $NODE -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 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 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
If you query the contact again, You should now see the counter "Value" has increased.
Last updated