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
  3. Upload Contract

Create a WASM File

Step 1: Access the Contract Code

Whether you've authored the code or acquired it from another source, having access to the smart contract code is essential.

Step 2: Identify the Folder Structure

A typical smart contract will resemble the structure below:

cw-contract/
├── .cargo/
│   └── config 
├── .circleci/
│   └── config.yml 
├── .github/workflows/
│   └── Basic.yml 
├── examples/
│   └── schema.rs 
├── schema/ 
├── src/ 
│   ├── state.rs 
│   ├── contract.rs  
│   ├── lib.rs  
│   ├── msg.rs  
│   └── error.rs 
└── target/ 

Step 3: Create the WASM File

Unoptimized Version: Use the command cargo wasm.

Optimized Version: If you have Docker installed, utilize the following:

docker run --rm -v "$(pwd)":/code \
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/rust-optimizer:0.12.6

Ensure the command is run from the root directory of the folder.

WASM files that aren't optimized can become excessively large. This can lead to potential deployment issues on Cascadia or incur elevated gas fees. Whenever feasible, aim for an optimized WASM file.

Step 4: Upload the WASM File

Navigate to the Contract Upload section on Cascadia.

Select your generated WASM file.

Click on the "Upload Contract" button.

PreviousUpload ContractNextSign and Verify

Last updated 1 year ago