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. Solidity

Deployment

Step 1: Install Hardhat.

npm install -g hardhat

Step 2: Create Example smart contract project.

mkdir example-project
cd example-project
npx hardhat init

Step 3: Make .env and input your private key.

PRIVATE_KEY=<your_private_key>

Step 4: Install dotenv module.

npm install dotenv

Step 5: Import environmental variables to hardhat.config.js.

require('dotenv').config()
const private_key = process.env.PRIVATE_KEY

Step 6: Establish endpoint settings.

By default, the script will be using your local host "127.0.0.1" - If you are not running a localhost, you may leverage the public endpoint https://testnet.cascadia.foundation/ by making changes to networks in hardhat-config.js, for example:

networks: {
    cascadia: {
      url: "https://testnet.cascadia.foundation",
      accounts: [private_key]
    }
  },

The total result code in hardhat.config.js is the following:

require('dotenv').config()
const private_key = process.env.PRIVATE_KEY
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
  solidity: "0.8.17",
  networks: {
    cascadia: {
      url: "https://testnet.cascadia.foundation",
      accounts: [private_key]
    }
  }
};

Step 7: Deploy Contract.

npx hardhat run -netork cascadia scripts/deploy.js

Step 8: Obtain contract address from console.

~/deploy-doc$ npx hardhat run --network cascadia scripts/deploy.js
Lock with 1 CC and unlock timestamp 1706489110deployed to 0xA32C3d322b9e35071c42D03237176D53e15D464

PreviousSolidityNextVerification

Last updated 1 year ago

Step 9: Confirm successful deployment on Cascadia's .

Type your deployed contract address into the block explorer search bar or to confirm successful deployment.

block explorer
https://explorer.cascadia.foundation/address/<your_contract_deployed_address>