LogoLogo
Block ExplorerDiscordTwitterMirror
  • What Is Canto?
  • Free Public Infrastructure
    • NOTE
    • Canto Lending Market
    • Canto DEX
  • Canto Neofinance
    • Overview
    • Application Specific Dollar
  • User Guides
    • Connecting to Canto
    • Bridging Assets
      • Bridging to Canto
      • Bridging from Canto
      • Synapse Bridge
      • Celer cBridge
    • Providing Liquidity
    • Lending & Borrowing
    • Staking
    • Governance
  • EVM Development
    • Overview
    • Quickstart Guide
    • NOTE, DEX, and Lending Market
    • Contract Secured Revenue (CSR)
    • Verifying Contracts
    • Contract Addresses
    • Testnet
  • Running a Node
    • Validators
      • Quickstart Guide
      • Useful Commands
      • Snapshots
      • FAQ
      • Troubleshooting
      • Uptime
      • Slashing
    • Archive Node
    • Graph Node (Subgraphs)
  • Technical Reference
    • Application Specific Dollar
      • asdOFT
      • asdRouter
      • asdUSDC
    • Liquidity Coordinator
      • VotingEscrow
      • GaugeController
      • LendingLedger
      • LiquidityGauge
    • Architecture & Design
      • Onboarding Module
      • Gravity Bridge
      • NOTE Design
      • Canto Lending Protocol
      • IBC Token Recovery
    • Governance
      • Governance Module
      • GovShuttle Module
      • Lending Market Governance
    • Tokenomics
    • Audits
Powered by GitBook
On this page
  • Mainnet
  • Testnet
  • Libraries
  • Beginner's Guide
  • Writing a Smart Contract
  • Deploying a Smart Contract
  1. EVM Development

Quickstart Guide

PreviousOverviewNextNOTE, DEX, and Lending Market

Last updated 1 year ago

Building smart contracts for the Canto EVM is the same as doing so for Ethereum or any other EVM-compatible chain, with the only difference being the network itself.

Smart contracts can be deployed using your Ethereum tooling of choice, including , , , , and others. To get started, simply configure your environment to use Canto's RPC and chain ID.

Mainnet

RPC URL: https://canto.slingshot.finance/

Chain ID: 7700

Explorer:

Alternative RPC URLs
Alternative Block Explorers

Canto EVM:

Canto EVM and Native:

Testnet

RPC URL: https://canto-testnet.plexnode.wtf

Chain ID: 7701

Libraries

When building frontends or other applications that require on-chain data, you'll likely want to use a library to retrieve that data.

const ethers = require('ethers')

const provider = new ethers.providers.JsonRpcProvider("https://canto.slingshot.finance")

async function printCurrentBlock() {
  console.log(await provider.getBlockNumber())
}

printCurrentBlock()

Beginner's Guide

In case you're new to Solidity development, here are step-by-step instructions on how you can deploy your first contract on Canto using Remix:

Writing a Smart Contract

The first step in deploying a smart contract on Canto is writing the contract's source code in Solidity. To do this, create a new file in your Remix workspace:

Name the file as desired with the .sol extension and begin writing your code. You can also use source code from contracts that are already deployed on Ethereum.

pragma solidity 0.8.17;

contract Example {
    uint storedData;

    function set(uint x) public {
        storedData = x;
    }

    function get() public view returns (uint) {
        return storedData;
    }
}

Once your code is ready, hit Ctrl+S to compile your smart contract.

Deploying a Smart Contract

Returning to Remix, navigate to the deployment tab, which is the fifth icon down on the vertical menu. Click on the environment drop-down box and select Injected Provider - Metamask:

A MetaMask prompt will appear asking you to connect your wallet to Remix. As always, make sure you are comfortable with the permissions that are being requested and click Connect.

Once you've connected your wallet, you'll see your account address under Account. Make sure this is where you want to deploy your contract from and then hit Deploy.

If your smart contract uses constructor arguments, enter them in the field adjacent to the Deploy button before attempting to deploy your contract.

After you hit Deploy, a MetaMask prompt will appear with a contract deployment transaction. Confirm the transaction.

As soon as the block is mined, your smart contract will be live on the Canto EVM. You can find the address of your smart contract at the bottom left of the Remix interface under Deployed Contracts, or by looking for the recipient of the contract deployment transaction in your wallet or on the block explorer.

Explorer: Alternative Testnet Explorer URL:

Needless to say, you can interact with the Canto EVM using most Ethereum libraries, such as , , and – just initialize a provider with the Canto RPC using your library of choice. For example:

For this example, let's copy and paste the following source code based on the :

To deploy your smart contract, start by making sure you have MetaMask installed and . Since this contract is for testing purposes, we'll connect to the Canto testnet.

Hardhat
Truffle
Foundry
Remix
https://www.oklink.com/canto
https://canto.neobase.one
https://canto.evm.chandrastation.com
https://jsonrpc.canto.nodestake.top/
https://canto.dexvaults.com/
https://cantoscan.xyz/
https://www.gacanto.com/
https://canto.dex.guru/
https://www.mintscan.io/canto
https://testnet.tuber.build/
https://canto-test.dex.guru/
ethers.js
web3.js
web3.py
official Solidity documentation
connected to Canto