Cascadia
  • Welcome to Cascadia
    • Brand Guidelines
    • Official Links
  • Artificial Intelligence
    • Incentives
  • Developers
    • Addresses
    • CosmWasm
      • Smart Contracts
      • Install Requirements
      • Set your Environment
      • Optimization
      • Deployment
      • Multi-Chain Contracts
        • The Actor Model
      • CW1 Subkeys Contract
        • Guide
      • CW20 Base Contract
        • Guide
      • C721 Base Contract
        • Guide
      • Upload Contract
        • Create a WASM File
      • Sign and Verify
        • Guide
    • Solidity
      • Deployment
      • Verification
        • Block Explorer
        • Hardhat
  • Directory
    • Address
    • API
    • Applications
    • Explorer
    • Faucet
    • Genesis
    • Governance
    • GRPC
    • Guide
    • Peers
    • RPC
    • Snapshot
    • State Sync
    • Website
    • Websocket
  • Governance
    • Align
      • Cooldown Period
      • Functions
    • Off-Chain
    • On-Chain
      • Voting
    • Proposals
      • On-Chain Voting via CLI
      • Proposal (Example)
    • VeTokenomics
      • Model
      • Voting Power Calculation
    • Analytics
  • Network
    • ChainID & Address Prefix
    • Configuration
    • Consensus
    • Denomination
    • Distribution
      • Block Rewards
      • Gas Fees
    • ESG
    • Faucet
    • Modules
    • Parameters
    • Peers
  • Security
    • Disclosure Policy
    • Multisignature
  • Staking
    • Claim
    • Delegate
    • Manual
    • Redelegate
    • Undelegate
  • Use Cases
    • Business Development and Marketing
    • Consumer Relationship Management
  • Node
    • Cloud Platforms
      • Amazon Web Services
      • Google Cloud Platform
    • Snapshot
    • State-Sync
    • Upgrade
      • Automated
      • Manual
  • Validators
    • System Requirements
    • Installation
    • Reference
      • Customization
  • Community
    • Discord
    • Telegram
    • Twitter
  • Legal
    • Privacy Policy
    • Terms & Conditions
Powered by GitBook
On this page
Edit on GitHub
  1. Developers
  2. CosmWasm

Deployment

Step 1: Deploy the wasm binary to the testnet

Use the wasmd Go CLI or CosmJS Node Console.

To upload the code to the blockchain:

wasmd query wasm list-code $NODE

Alternative for uninitialized environment variables:

wasmd query wasm list-code --node https://rpc.malaga-420.cosmwasm.com:443

Step 2: Store the bytecode on-chain and get the Code Id.

RES=$(wasmd tx wasm store artifacts/cw_nameservice.wasm --from wallet --other-options...)
echo $RES
CODE_ID=$(echo $RES | jq -r '.logs[0].events[-1].attributes[0].value')

Step 3: Check instantiated contracts using the Code Id.

wasmd query wasm list-contract-by-code $CODE_ID $NODE --output json

Step 4: Verify the uploaded wasm binary.

wasmd query wasm code $CODE_ID $NODE download.wasm
diff artifacts/cw_nameservice.wasm download.wasm

Step 5: Instantiate the wasm contract:

wasmd tx wasm instantiate $CODE_ID "$INIT" --from wallet --other-options...

To interact with a contract

Register a name:

wasmd tx wasm execute $CONTRACT "$REGISTER" --amount 100umlg --from wallet --other-options...

Transfer the name record to another address:

wasmd tx wasm execute $CONTRACT "$TRANSFER" --amount 999umlg --from wallet --other-options...

Using CosmJS Node Console for deployment:

Initialize a CosmJS CLI session:

npx @cosmjs/cli@^0.28.1 --init https://raw.githubusercontent.com/InterWasm/cw-plus-helpers/main/base.ts

Import necessary utilities and upload the wasm binary.

Instantiate the Contract in CosmJS:

Define default fees, create an instance using the code id, and get the contract address.

Contract Interaction in CosmJS:

Register a name and transfer ownership to another address.

PreviousOptimizationNextMulti-Chain Contracts

Last updated 1 year ago