XION
DiscordGithub
  • Welcome to XION
  • XION'S Core
    • Concepts
      • Generalized Chain Abstraction
      • Intro to Account Abstraction
      • XION's Meta Accounts
      • Meta Accounts Design
      • Architecture & Tech Glossary
      • Use Cases
  • developers
    • Xion Quick Start
      • Zero to Dapp in 5 Minutes
        • Launch a User Map Dapp on XION in 5 Minutes
        • React Native Mobile Dapp on XION in 5 Minutes
    • Mobile dapp Development on XION
      • Set up your XION Mobile Development Environment
      • Create Mobile Dapp and Integrate Meta Account Authentication
    • Getting Started (Advanced)
      • Set Up Local Environment
        • Setting up your Local Smart Contract Development Environment for XION
          • Setting up your XION Smart Contract Development Environment on Windows (WSL2 + Ubuntu)
        • Set Up an Integrated Development Environment (IDE)
        • Interacting with Xion Chain using Xion Daemon
      • Your First Contract
        • Deploying Your First Smart Contract on XION
      • Gasless UX & Permission Grants
        • Enabling Gasless Transactions with Treasury Contracts
      • Dapp Development
        • Account Abstraction with Gasless Transactions
        • Interact with XION via your Backend Service
    • Re-using Existing Contracts
      • Deployed Contracts on XION
      • Non-Fungible Tokens (NFTs)
      • Fungible Tokens
      • Marketplace
      • Multisig
      • Proxy Contracts
      • Membership Management
      • Governance
    • Web3 for Web2 Developers
      • Web2 vs Web3 App Architecture: A Comparison
      • Misconceptions and Misapplied Web2 Patterns
      • Recommended Architecture for Dapps on XION
    • Building for Mainnet
      • Xion Testnet: Your Development Playground
      • Building with Audited & Battle-Tested Contracts
      • Community Engagement: Building Support for Your dApp
      • Deploying to Xion Mainnet
        • Smart Contract Audits: Process, Costs & Support
        • Governance Process to Deploying Smart Contracts to Mainnet
    • Learn & Build
      • Token Factory
        • Creating, Minting, and Interacting with a Token Factory Token
        • Building a React dApp to Interact with Token Factory Tokens
        • Integrating a Token Factory Token in a Smart Contract
      • Websockets
        • WebSockets with Xion: Real-Time Communication
      • Mobile Development
        • Building a React Native Mobile App with Abstraxion (Xion.js)
      • Oracles
        • Creating a Smart Contract with Pyth Oracle Integration
      • Indexers: Optimized Data Retrieval
        • SubQuery
      • Use Cases
        • Building a Per-User Data Storage Dapp
    • Reference and Resources
      • Requesting XION Testnet Tokens
      • Public Endpoints & Resources
      • Block Explorers
      • Governance
        • Deploying Smart Contracts to Mainnet
      • Developer Tools: Abstract
      • IBC Denoms on XION Networks
      • Frequently Asked Questions
      • XION Token Contract Addresses on EVM Chains
  • Nodes & Validators
    • Run a Node
      • System Specifications
      • Build the Xion Daemon
      • Download the Xion Daemon
      • Configure the Xion Daemon
        • app.toml
        • client.toml
        • config.toml
      • Join the XION Network
        • xion-testnet-1
      • Confirm node is running
    • Become a Validator
      • Initial Setup
      • Obtain a XION Wallet Address
      • Obtain Funds
        • Testnet
      • Create Validator
    • IBC Relayers and Tokens
  • Others
    • Resources
Powered by GitBook
On this page
  • cosmwasm-check utility
  • Verifying the installation

Was this helpful?

Edit on GitHub
  1. developers
  2. Reference and Resources
  3. CosmWasm Resources
  4. Introductory Section

Setting Up Environment

Last updated 2 months ago

Was this helpful?

A user can choose to either set up a local testnet or connect to an existing network. For easy testing, the XION testnet is available for deploying and running ones contracts.

To set up a local testnet, see Running a Local Testnet. For details on the available XION networks, see the page.

To work with CosmWasm smart contract, a user will need rust installed on their machine. If the user does not have it installed, they can find installation instructions on the Rust website.

Additionally, the user will need the Wasm rust compiler backend installed to build Wasm binaries.

Also, to be able to upload Rust Wasm Contracts into the blockchain, a user will need to install docker.

To minimize their contract sizes, it will be required to run CosmWasm Rust Optimizer; without that, more complex contracts might exceed a size limit.

cosmwasm-check utility

An additional helpful tool for building smart contracts is the cosmwasm-checkutility. It allows a user to check if the wasm binary is a proper smart contract ready to upload into the blockchain. A user can install it using cargo:

$ cargo install cosmwasm-check

If the installation succeeds, a user should be able to execute the utility from your command line.

$ cosmwasm-check --version

Contract checking 1.2.3

Verifying the installation

To guarantee a user is ready to build their smart contracts, they will need to make sure they can build examples. Checkout the cw-plus repository and run the testing command in its folder:

$ git clone git@github.com:CosmWasm/cw-plus.git

$ cd ./cw-plus

cw-plus $ cargo test

A user should see that everything in the repository gets compiled, and all tests pass.

cw-plus is a great place to find example contracts - look for them in contracts directory. The repository is maintained by CosmWasm creators, so contracts in there should follow good practices.\

To verify the cosmwasm-check utility, first, a user will need to build a smart contract. Go to some contract directory, for example, contracts/cw1-whitelist, and call cargo wasm:

cw-plus $ cd contracts/cw1-whitelist

cw-plus/contracts/cw1-whitelist $ cargo wasm

A user should be able to find their output binary in the target/wasm32-unknown-unknown/release/ of the root repo directory - not in the contract directory itself! Now they can check if contract validation passes:

cw-plus/contracts/cw1-whitelist $ cosmwasm-check ../../target/wasm32-unknown-unknown/release/cw1_whitelist.wasm

Available capabilities: {"iterator", "cosmwasm_1_1", "cosmwasm_1_2", "stargate", "staking"}

../../target/wasm32-unknown-unknown/release/cw1_whitelist.wasm: pass

All contracts (1) passed checks!

If you intend to use xiond as your preferred client, we recommend you to set up these variables. Otherwise you will have to type in node, chain id and gas-price details with every command you execute.

# bash
export NODE="--node $RPC"
export TXFLAG="${NODE} --chain-id xion-testnet-2 --gas-prices 0.25uxion --gas auto --gas-adjustment 1.4"

# zsh
export NODE=(--node $RPC)
export TXFLAG=($NODE --chain-id xion-testnet-2 --gas-prices 0.25uxion --gas auto --gas-adjustment 1.4)

Get the RPC endpoint from the Public Endpoints & Resources section

Networks