# What Is Canto?

[Canto](https://canto.io/) is a permissionless general-purpose blockchain running the Ethereum Virtual Machine (EVM). It was built to deliver on the promise of DeFi – that through a post-traditional financial movement, new systems will be made accessible, transparent, decentralized, and free.

At launch, Canto provides an EVM execution layer via [Ethermint](https://docs.ethermint.zone/), secured by a Proof of Stake Cosmos SDK consensus layer, in addition to core [Free Public Infrastructure (FPI)](https://canto.gitbook.io/canto/welcome/how-does-canto-work/free-public-infrastructure-fpi) primitives. These primitives include:

* [Canto DEX](/free-public-infrastructure/dex) — a zero-fee DEX for liquidity providers
* [Canto Lending Market (CLM)](/free-public-infrastructure/lending-market) — a pooled lending Compound v2 fork
* [NOTE](/free-public-infrastructure/note) — a fully collateralized unit of account token issued by the CLM which also serves the ecosystem as a USDC/USDT soft-pegged stablecoin

**Over time we expect this stack to change significantly and new financial primitives to be added to best fulfill the Canto mission.**

## Core Tenets

Canto’s goal is to become the best execution layer for original work. Canto accomplishes this in three ways:

**Liquidity as a Free Public Good:**

Zero fees for Liquidity Providers (LPs). Canto makes liquidity free for protocols, arbitrageurs and traders.

**Rent Extraction Resistant:**

Canto aims to establish Free Public Infrastructure. Core DeFi primitives will not have sovereign governance tokens, nor the capacity to extract rent in the future.

**Minimal Viable User Capture:**

Where possible, Canto avoids interface-driven user ownership. Public infrastructure DEXes will have no swapping interface, so all users must trade on third-party aggregators. This will facilitate user acquisition for new protocols.

## Approach to Decentralization

Canto is designed to support free public infrastructure, while eliminating centralized incentives:

* There is no official foundation.
* There was no presale.
* There is no vesting.
* There are no venture backers.

## Community Engagement

Canto is a distributed community of DeFi advocates for a free public infrastructure.

Though the initial Canto contributors have created the following resources for Canto announcements and details, there are no official Canto channels or branding assets, as any Canto community member can create resources, channels, imagery and discussion on Canto.


# Free Public Infrastructure

Canto realizes the vision set out by the first builders that core primitives should exist as **Free Public Infrastructure** (FPI).

Having observed the growth of the DeFi space, from the launch of DAI in late 2017 to the emergence of many DeFi projects in 2021, three core primitives have emerged to anchor any healthy DeFi ecosystem:

* Decentralized exchanges (DEXes) such as Uniswap and Sushiswap
* Lending markets such as Compound and Aave
* Decentralized unit of accounts such as DAI, USDC or USDT

As the ecosystem has grown, every core primitive has made the same decision: launch a governing protocol token that derives value from its ability to extract rent from future users.

Canto takes a different approach by choosing to launch these core DeFi primitives as public utility protocols, or Free Public Infrastructure (FPI).

Where existing protocols serve their community more similarly to a pay-by-hour private parking garage, Canto’s FPI intends to provide for its community in a manner more akin to free parking on a city street.

For [Canto’s decentralized exchange](/free-public-infrastructure/dex), the protocol cannot be upgraded and will remain ungoverned. It will run in perpetuity on Canto without ever being able to launch a token or implement additional fees over time, preventing the possibility of a predatory evolution toward rent-seeking behaviors.

For the [Canto Lending Market](/free-public-infrastructure/lending-market), governance is controlled by Canto stakers. Canto stakers have broad interests in the growth of the ecosystem and fostering the best environment for both developers and DeFi users. As such, they have no incentive to extract rent at the application layer.

For [NOTE](/free-public-infrastructure/note), the unit of account token, the interest charged to stabilize its price will be contributed toward funding public goods. The algorithm responsible for adjusting this interest rate is designed to change the interest rate in order to promote a less volatile value as opposed to maximizing revenue. All interest paid by borrowers will be distributed to lenders, with no fees extracted at the protocol layer.

By giving governance powers to the chain, we expect the operation of the primitives to naturally align with the public interest, resulting in a healthy and robust ecosystem free from zero-sum games that have since come to dominate the once egalitarian system of decentralized finance.


# NOTE

NOTE is the unit of account on Canto. NOTE is an over-collateralized currency backed by stablecoins and RWAs, with a value perpetually rebalanced toward $1 through an algorithmic interest rate policy. It is:

* Over-collateralized
* Capital efficient
* Fully decentralized
* Automated

NOTE cannot be created – it must be borrowed from the Accountant, a smart contract that implements the algorithmic interest rate policy, via the [Canto Lending Market](/user-guides/lending-and-borrowing) (CLM).

All interest charged by the Accountant is earmarked for funding public goods. It is held in the Community Treasury and controlled by Canto governance.

### Over-collateralization

NOTE is a fully immutable ERC-20 token backed by collateral lent to the CLM. It can can only be borrowed by users who post select collateral assets.

At this time, eligible collateral assets are short-term US treasury bill tokens USYC, fBILL, and ifBILL:

| Token  | Issuer                                  |
| ------ | --------------------------------------- |
| USYC   | [Hashnote](https://www.hashnote.com/)   |
| fBILL  | [FortunaFi](https://www.fortunafi.com/) |
| ifBILL | [FortunaFi](https://www.fortunafi.com/) |

For every NOTE in circulation, there is more than 1 USD worth of collateral held by the CLM.

## Maintaining NOTE Price Stability <a href="#price-algorithm" id="price-algorithm"></a>

Since NOTE cannot be created, only borrowed, the Accountant contract utilizes interest rates to manage the circulating supply of NOTE, and by proxy, its price. The interest rate on NOTE automatically adjusts up or down every 6 hours based on a TWAP of the market price of NOTE.

Aiming to provide a public utility, the algorithm responsible for adjusting this interest rate is designed to change the interest rate in order to promote a less volatile value as opposed to maximizing revenue.

If NOTE is trading under $1, the interest rate is raised to strengthen the incentive for buying NOTE on secondary markets and lending it to the CLM. If NOTE is trading over a dollar, the interest rate is lowered to make borrowing NOTE from the CLM and selling it on secondary markets more attractive.

For launch, each interest epoch will be 6 hours and the rate will adjust by 0.25 (the *adjustor coefficient*) of the difference between the price of NOTE and $1.00.

**NOTE Interest Rate Formula:**

$$
newInterestRate = max(0,(1 - price (NOTE))\*Adjuster Coefficient+ priorInterestRate)
$$

**Example:**

* Current Interest Rate: 4%
* NOTE average price over the last 6 hours: 1.04

$$
newInterestRate = max(0,(1-1.04)\*0.25+4%) = 3%
$$

If NOTE is trading above $1, the interest rate is lowered to weaken the NOTE price. If NOTE is trading below $1, the interest rate is raised to strengthen the NOTE price.

## cNOTE <a href="#cnote" id="cnote"></a>

cNOTE is the deposit token received when supplying [NOTE](/free-public-infrastructure/note), Canto's native unit of account, to the [Canto Lending Market](/free-public-infrastructure/lending-market).


# Canto Lending Market

For the Canto Lending Market (CLM), governance is controlled by Canto stakers. Canto stakers have broad interests in the growth of the ecosystem and fostering the best environment for both developers and DeFi users. As such, they have no incentive to extract rent at the application layer.

As long as liquidity mining incentives are provided to Canto stakers, CLM will always be available.

## Using Canto Lending Market

A user interface for supplying assets to and borrowing assets from the Canto Lending Market is available at [app.canto.io/lending](https://app.canto.io/lending), although the underlying contracts can easily be integrated with other frontends and smart contract protocols.

In addition to supporting Canto's [neofinance](/neofinance/overview) ecosystem by supplying RWAs and/or cNOTE, users can deposit LP tokens to the lending market to earn incentives.

## Design

CLM is an adaptation of Compound V2. It operates with an AMM that allows users to carry out borrowing and lending transactions using the underlying liquidity pool. This stands in contrast to the alternative of forcing peer-to-peer transactions. Using underlying liquidity in this manner reduces wait times and makes the system self-sustaining.

Governance over the Canto Lending Market by Canto stakers is enabled by the custom [`x/govshuttle`](/technical-reference/governance/govshuttle-module) module.


# Canto DEX

In order to prevent the possibility of a predatory evolution toward rent-seeking behaviors, Canto’s decentralized exchange protocol:

* Cannot be upgraded
* Has no official interface
* Runs in perpetuity without the ability to implement fees

At launch, users can interact with the DEX contracts through [Slingshot](https://app.slingshot.finance/), a DEX aggregator platform.

## **Trading on Canto DEX**

Like other DEXes, Canto uses an automated market maker (AMM) to price assets. The AMM derives liquidity for trading pairs from user-supplied pools of assets called liquidity pools.

At launch, Canto supports two types of liquidity pools:

* Full range liquidity pools using a `xy=k` formula (constant product)
* Concentrated liquidity pools using a `yx^3 + xy^3 = k` formula, to deepen liquidity for stablecoins and other units of account such as Note

## **Providing Liquidity**

In order to participate in Canto liquidity mining, users are able to provide liquidity to the Canto DEX at [app.canto.io/lp](https://app.canto.io/lp).

Users providing liquidity receive LP tokens that can be supplied in the [Canto Lending Market](/free-public-infrastructure/lending-market) to earn incentives.

### **Incentivized Pools**

At present, Canto has 5 incentivized pools:

* USDC/NOTE Concentrated Liquidity Pool (`yx^3 + xy^3 = k`)
* USDT/NOTE Concentrated Liquidity Pool (`yx^3 + xy^3 = k`)
* NOTE/CANTO Full Range Liquidity (\`xy = k\`)
* CANTO/ETH Full Range Liquidity (`xy = k`)
* CANTO/ATOM Full Range Liquidity (`xy = k`)


# Overview

Neofinance envisions a new era of financial efficiencies, unlocked at scale, by deploying offchain assets on protocol rails. The Canto neofinance ecosystem consists of several primitives designed to enable transparent, competitive financial terms.

## RWA Backing for NOTE <a href="#rwas" id="rwas"></a>

Neofinance on Canto revolves around a decentralized unit of account – NOTE – which is backed by Real-World Assets (RWAs). At present, NOTE is backed by Canto-native tokenized treasury bills in the form of USYC, fBILL, and ifBILL:

| Token  | Issuer                                  |
| ------ | --------------------------------------- |
| USYC   | [Hashnote](https://www.hashnote.com/)   |
| fBILL  | [FortunaFi](https://www.fortunafi.com/) |
| ifBILL | [FortunaFi](https://www.fortunafi.com/) |

Purchasers of tokenized treasury bills can supply these assets to the [Canto Lending Market](/free-public-infrastructure/lending-market) and borrow NOTE against them, allowing them to achieve superior capital efficiency.

## cNOTE <a href="#cnote" id="cnote"></a>

cNOTE is a tokenized deposit of NOTE, and the primary productive asset in the Canto neofinance ecosystem. Any user can permissionlessly [supply NOTE](/user-guides/lending-and-borrowing#supplying-tokens) to the Canto Lending Market to obtain cNOTE.

To ensure deep liquidity, liquidity mining incentives are in place for cNOTE/USDC and NOTE/USDC concentrated trading pools on Ambient Finance, [funded by Canto governance](https://app.canto.io/governance/proposal/121).

## Neofinance Coordinator

Neofinance Coordinator is a novel, Canto-native protocol which incentivizes the lending of cNOTE on downstream lending markets. Incentives are paid in CANTO and funded by network governance.

Current downstream lending markets include [Vivacity Finance](https://vivacity.finance).

For more information, see the [technical reference for Neofinance Coordinator](#neofinance-coordinator).


# Application Specific Dollar

Application Specific Dollar (asD) is a Canto-native protocol that allows teams to earn yield on user deposits by deploying white-label stablecoins backed by [NOTE](https://docs.canto.io/free-public-infrastructure-fpi/note). **With asD V2, Application Specific Dollars can be minted from and bridged to other LayerZero-enabled networks.**

Anyone can permissionlessly deploy an asD token. Likewise, anyone can permissionlessly mint an asD token by depositing NOTE. In turn, the asD smart contract deposits NOTE into the Canto Lending Market, with lending yield claimable only by the asD token's deployer.

asD tokens are always backed 1:1 by NOTE.

## asD V2

asD V2 is the second iteration of Application Specific Dollar, utilizing LayerZero's Omnichain Fungible Token (OFT) standard to enable the bridging of asD tokens across supported networks.

The [`asdOFT` ](https://github.com/Plex-Engineer/ASD-V2/blob/main/contracts/asd/asdOFT.sol)contract is a standard contract for all asD tokens. When deploying this contract, the token deployer can choose an arbitrary name and symbol for their asD token.

### Helper contracts

While asD tokens are native to Canto and can only be minted in exchange for NOTE, the [`asdRouter` ](https://github.com/Plex-Engineer/ASD-V2/blob/main/contracts/asd/asdRouter.sol)helper contract enables asD tokens to be minted from other chains with USDC deposits. This contract:

1. Wraps bridged USDC as asdUSDC
2. Swaps asdUSDC for NOTE on Ambient
3. Mints the specified asD token on Canto
4. Sends the asD token to the destination chain and address

The [`asdUSDC` ](https://github.com/Plex-Engineer/ASD-V2/blob/main/contracts/asd/asdUSDC.sol)wrapper contract is used to wrap whitelisted representations of USDC into a single Canto-native token, which has deep swap liquidity with NOTE. This enables compatibility with various representations of USDC, such as USDC.e.

## Technical Reference

{% content-ref url="/pages/lsXV3G520Hg4ORtISLNp" %}
[Application Specific Dollar](/technical-reference/application-specific-dollar)
{% endcontent-ref %}


# Connecting to Canto

**As an EVM-compatible chain, you can connect to the Canto network using any Ethereum wallet.**

{% hint style="info" %}
While Canto itself is compatible with all Ethereum wallets, the [**app.canto.io**](https://app.canto.io/) interface is only compatible with injected wallets such as MetaMask and others listed on this page.
{% endhint %}

## With MetaMask

Assuming you have already installed and configured [MetaMask](https://metamask.io/) in your browser of choice, follow these steps to add the Canto network:

1. Open the MetaMask extension.
2. At the top of the interface, click on the network you are connected to e.g. "Ethereum Mainnet".
3. Click on "Add Network":\
   \ <img src="/files/supRVVNVQVDxIr2woe2R" alt="" data-size="original">
4. Enter the following RPC settings:\
   \
   **Network Name:** CANTO\
   **New RPC URL:** <https://canto.slingshot.finance>\
   **Chain ID:** 7700\
   **Currency Symbol:** CANTO\
   **Block Explorer URL:** <https://www.oklink.com/canto>

<details>

<summary>Alternative RPC URLs</summary>

* <https://canto-rpc.ansybl.io>
* <https://canto.gravitychain.io>

</details>

<details>

<summary>Alternative Block Explorers</summary>

Canto EVM:

* <https://parsec.fi/>
* <https://cantoscan.xyz/>
* <https://canto.dex.guru/>

Canto EVM and Native:

* <https://www.mintscan.io/canto>

</details>

<details>

<summary>Testnet RPC URL</summary>

**Network Name:** Canto Testnet\
**New RPC URL:** `https://canto-testnet.plexnode.wtf`\
**Chain ID:** 7701\
**Currency Symbol:** CANTO\
**Block Explorer URL:** <https://testnet.tuber.build/> **Alternative Explorer URL:** <https://canto-test.dex.guru/>

</details>

After saving the network, you will be able to connect to it at any time using the dropdown menu.

If you skip this step and attempt to connect to applications on [**app.canto.io**](https://app.canto.io/), a MetaMask prompt will appear allowing you to add the network with a single click.

## Other Wallets

The Canto network and [**app.canto.io**](https://app.canto.io/) interface are compatible with other injected wallets, such as the following:

### Enkrypt

On [Enkrypt](https://www.enkrypt.com/?mtm_campaign=Canto%20Wiki%20Connecting%20to%20Cant), Canto is a default network which can be added using the *Manage Networks* button at the bottom-left of the wallet interface.

{% hint style="info" %}
Request other supported wallets be added to this list by making a Pull Request to the [Canto docs repository](https://github.com/Canto-Network/docs).
{% endhint %}


# Bridging Assets

## Canto.io

The [**app.canto.io/bridge**](https://app.canto.io/bridge) frontend allows you to bridge assets in and out of Canto from Ethereum, Cosmos Hub, and other IBC-enabled chains. Under the hood, it is powered by Gravity Bridge, LayerZero, and IBC, depending on the asset being bridged.

For more information about using the frontend, see the following pages:

* [Bridging to Canto](/user-guides/bridging-assets/to-canto)
* [Bridging from Canto](/user-guides/bridging-assets/from-canto)

## Third-Party Bridges

Various third-party bridges also support bridging directly to the Canto EVM:

* [Synapse Bridge](/user-guides/bridging-assets/synapse)
* [Celer cBridge](/user-guides/bridging-assets/celer)


# Bridging to Canto

With the [**app.canto.io**](https://app.canto.io/bridge) frontend, you can natively bridge to Canto from Ethereum, Cosmos Hub, and other IBC-enabled chains. Once bridged, you'll be able to move assets to the Canto EVM and begin interacting with Canto's Free Public Infrastructure and DApps.

## Bridge Tokens From Ethereum <a href="#from-ethereum" id="from-ethereum"></a>

At present, the Ethereum bridge supports WETH, USDC, USDT, and wstETH transfers (via Gravity Bridge) as well as CANTO and cNOTE transfers (via LayerZero). To bridge assets from the Ethereum network to the Canto network, follow these steps:

1. Navigate to [**app.canto.io/bridge**](https://app.canto.io/bridge) and connect your MetaMask wallet on the Ethereum network.
2. Select the token you would like to bridge and input the quantity.
3. Click `BRIDGE IN` and confirm the transaction(s) in your wallet. In addition to the bridge transaction, you may need to confirm transactions to wrap ETH and/or approve the token.

{% hint style="info" %}
When bridging to Canto for the first time, you will also be prompted to sign a message in your wallet to generate a public key for the Canto network.
{% endhint %}

<figure><img src="/files/LcGwMetqo7S0wvPkZa0C" alt=""><figcaption></figcaption></figure>

Assets bridged from Ethereum arrive on the Canto EVM after approximately 20 minutes.

## Bridge IBC Tokens From Cosmos Chains <a href="#from-cosmos" id="from-cosmos"></a>

IBC transfers can be used to bridge selected assets including ATOM, GRAV, and OSMO to Canto from Cosmos Hub and other IBC-enabled chains.

**To ensure the assets you bridge in can be used on the Canto EVM, use the** [**app.canto.io**](https://app.canto.io/bridge) **frontend to initiate IBC transfers:**

1. Navigate to [**app.canto.io/bridge**](https://app.canto.io/bridge) and connect your MetaMask wallet on the Ethereum network.
2. Select the IBC token you would like to bridge. This will prompt a Keplr popup asking you to unlock your wallet, connect to the token's native network, and add the Canto network (if necessary).
3. Input the quantity and click `BRIDGE IN`.
4. Confirm the transaction in Keplr.

{% hint style="info" %}
When bridging to Canto for the first time, you will also be prompted to sign a message in your wallet to generate a public key for the Canto network.
{% endhint %}

<figure><img src="/files/zCasgTITFQBGhrTKUnxs" alt=""><figcaption></figcaption></figure>

<details>

<summary>Supported IBC Assets</summary>

* SOMM
* GRAV
* AKT
* OSMO
* CRE
* KAVA
* INJ\*
* CMDX
* DVPN
* EVMOS\*
* XPRT
* stkATOM
* STRD
* stEVMOS
* stATOM
* stJUNO
* stOSMO
* stSTARS
* QCK
* qATOM
* qREGEN
* qSTARS

\*limited compatibility with canto.io – see [Manual IBC Transfer](#manual-ibc-transfer).

</details>

<details>

<summary>Manual IBC Transfer</summary>

Advanced users may wish to initiate IBC transfers manually. Before doing so, ensure the token you are transferring is one of the [Supported IBC Assets](#supported-ibc-assets) and that you are bridging the token from its native chain.

**Do not attempt to IBC transfer tokens to the Canto address in your Keplr wallet. Follow the instructions below.**

1. Navigate to [**app.canto.io/bridge**](https://app.canto.io/bridge) and connect your MetaMask wallet on the Ethereum network.
2. If bridging to Canto for the first time, **generate a Canto public key** by clicking on the red banner at the top of the page and signing the message with your wallet.
3. Open the sidebar by clicking the burger icon in the top-left corner of the page and click `add to keplr` to add the Canto network to Keplr.
4. Copy your Canto native address from the center of the page.
5. Make sure the "Show Advanced IBC Transfers" option is toggled on in Keplr wallet settings.
6. Switch to the chain you are trying to bridge from and click `IBC Transfer`.
7. Select *Canto Mainnet* as the destination chain.
8. **If bridging for the first time, add Canto by clicking "New IBC Transfer Channel" and selecting Canto Mainnet. Enter the correct channel for the chain you are bridging from.**
   * Cosmos Hub: `channel-358`
   * Gravity Bridge: `channel-88`
   * Kava: `channel-87`
   * Akash: `channel-59`
   * Osmosis: `channel-550`
   * Injective: `channel-99`
   * Comdex: `channel-58`
   * Crescent: `channel-34`
   * Sommelier: `channel-2`
   * Sentinel: `channel-71`
   * Evmos: `channel-62`
   * Persistence: `channel-80`
   * Stride: `channel-74`
   * Quicksilver: `channel-24`
9. Enter the amount you want to transfer and complete the transaction. Your tokens should arrive after a few minutes.

</details>


# Bridging from Canto

With the [**app.canto.io**](https://app.canto.io/bridge) frontend, you can bridge from Canto to Ethereum or to Cosmos Hub and other IBC-enabled chains. To ensure smooth bridging, assets can only be bridged to their native chains.

## Bridge ERC20s To Ethereum <a href="#erc20" id="erc20"></a>

ERC20 tokens like WETH, USDC, and USDT can be bridged from Canto to Ethereum via Gravity Bridge. As of January 2024, a Cosmos wallet such as Keplr is no longer needed if your EVM wallet supports custom chains.

To bridge, follow the steps below:

{% tabs %}
{% tab title="Reccomended (MetaMask)" %}
***Only follow these instructions if your EVM wallet supports custom chains e.g. MetaMask. If you are unsure, use the Legacy Flow.***

1. Navigate to [**app.canto.io/bridge**](https://app.canto.io/bridge) and select the *Bridge Out* tab.
2. Select an Ethereum-native asset and input the quantity.
3. Choose a bridging speed and click *Bridge Out*.
4. When prompted, confirm that you are using a supported wallet.
5. Sign the messages in your Ethereum wallet.
6. Between signing messages, accept the prompts to switch networks to Gravity Bridge and then back to Canto as they appear.

<figure><img src="/files/1QCLKQgCDyrFm6OBJVOS" alt=""><figcaption></figcaption></figure>
{% endtab %}

{% tab title="Legacy Flow (Rabby, Rainbow, Coinbase)" %}
***The Legacy Flow supports all EVM wallets. However, you must have a Cosmos wallet compatible with the Gravity Bridge network, such as*** [***Keplr***](https://www.keplr.app/)***.***

1. Navigate to [**app.canto.io/bridge**](https://app.canto.io/bridge) and select the Bridge Out tab.
2. Select an Ethereum-native asset and input the quantity.
3. Choose a bridging speed and click Bridge Out.
4. Select *Use Gravity Bridge Portal.*
5. Enter the Gravity Bridge address shown in your Keplr wallet.
6. Sign the messages in your Ethereum wallet.

Funds will arrive at your Gravity Bridge address within several minutes. To complete the process of bridging to Ethereum, navigate to [**bridge.blockscape.network**](https://bridge.blockscape.network/).
{% endtab %}
{% endtabs %}

## Bridge Canto/cNOTE to Ethereum (via LayerZero) <a href="#ofts" id="ofts"></a>

CANTO and cNOTE can be bridged directly from Canto to Ethereum via LayerZero. Aside from an Ethereum wallet such as MetaMask, this path requires no additional wallets or tooling.

To bridge CANTO or cNOTE from Canto to Ethereum, follow these steps:

1. Navigate to [**app.canto.io/bridge**](https://app.canto.io/bridge) and select the *Bridge Out* tab.
2. Select the asset you wish to bridge and input the quantity.
3. Click *Bridge Out* and confirm the transactions in your Ethereum wallet:

<figure><img src="/files/seEPgQX8AH67PmBOHn9D" alt=""><figcaption></figcaption></figure>

## Bridge IBC Tokens To Cosmos Chains <a href="#ibc" id="ibc"></a>

To bridge from Canto to Cosmos Hub or other IBC chains, you'll need to move your assets to the Canto Bridge first:

1. Navigate to [**app.canto.io/bridge**](https://app.canto.io/bridge) and select the *Bridge Out* tab.
2. Select the asset you wish to bridge and input the quantity.
3. Click *Bridge Out* and enter the address for the asset's native chain from your Keplr Wallet.
4. Confirm and sign the messages in your Ethereum wallet.

<figure><img src="/files/JIJyuA2j6VlVXoWVnVbr" alt=""><figcaption></figcaption></figure>


# Synapse Bridge

[Synapse Bridge](https://synapseprotocol.com/) is a multichain bridge that enables on-chain asset swaps between Canto and 10+ other blockchains, including Ethereum, Polygon, Optimism, Arbitrum, Avalanche, BNB Chain, and others.

## Using Synapse Bridge

The Synapse bridging process is identical regardless of whether you are bridging to or from Canto. To use the bridge, follow these steps:

1. Navigate to [**https://synapseprotocol.com/**](https://synapseprotocol.com/) and connect your wallet.
2. Under the *Origin* section, select the network you would like to bridge from, as well as the asset you would like to send and its amount.
3. Under the *Dest.* section, select the network you would like to bridge to (e.g. Canto) and the asset you would like to receive.
4. If necessary, click the *Approve* button and confirm the transaction in your wallet to approve the outgoing asset.
5. Finally, click the *Bridge your funds* button and confirm the transaction in your wallet to initiate the bridging process:

<figure><img src="/files/ZdaaeG3XTa20EvPRV5xF" alt=""><figcaption></figcaption></figure>

## Supported Assets

The Synapse Bridge supports the following assets on Canto:

* USDC
* USDT
* NOTE
* nUSD
* SYN

### Swap Routing

To ensure deep liquidity when bridging to and from Canto, the Synapse Bridge performs direct cross-chain swaps for just two assets:

* [nUSD](https://docs.synapseprotocol.com/reference/faq#synapse-bridge) – Synapse's stablecoin bridge asset
* [SYN](https://docs.synapseprotocol.com/reference/faq#the-syn-token) – Synapse's governance and incentive token

To send and receive other stablecoins on Canto, the Synapse Bridge swaps to and from nUSD using chain-specific stableswap pools on the origin and destination chains.

Synapse's [Canto Stableswap Pool](https://synapseprotocol.com/pools/canto2pool) consists of nUSD and NOTE, enabling users to bridge stablecoins across chains and swap to and from Canto's native unit of account in a single interaction.

Additionally, the Synapse Bridge integrates the [Canto DEX](/free-public-infrastructure/dex) for its feeless USDC <> NOTE and USDT <> NOTE liquidity. This means that users can bridge to and from USDC and USDT on Canto in a single interaction, via nUSD and NOTE.

For more information about how the Synapse Bridge works, see the [Synapse Protocol documentation](https://docs.synapseprotocol.com/).


# Celer cBridge

[Celer cBridge](https://cbridge.celer.network/) supports bridging of WBTC, BNB, BUSD and IBEX between Canto and numerous other blockchains, including Ethereum, Bitcoin, Polygon, Optimism, and others.

## Using Celer cBridge

The Celer bridging process is identical regardless of whether you are bridging to or from Canto. To use the bridge, follow these steps:

1. Navigate to [**https://cbridge.celer.network/**](https://cbridge.celer.network/) \*\*\*\* and connect your wallet.
2. Under the *From* section, select the network you would like to bridge from, as well as the asset you would like to send and its amount.
3. Under the *To* section, select the network you would like to bridge to (e.g. Canto).
4. Click the *Transfer* button. If necessary, approve the outgoing asset.
5. On the modal that appears, click the *Confirm Transfer* button.

<figure><img src="/files/Tq80KCslGRNTmuuVuioW" alt=""><figcaption></figcaption></figure>

## Supported Assets

Celer supports the following assets on Canto:

* [BNB](https://oklink.com/canto/address/0xFb7F77faaA3b69ef4C15d6305C79AD92B387C89F)
* [BUSD](https://oklink.com/canto/address/0x381Ea7A7EE6a1e2982e01E7b6837f775a1a4B07F)
* [WBTC](https://oklink.com/canto/address/0x08638a74A8134c747Dce29B57472cc2B57F35653)
* [IBEX](https://oklink.com/canto/address/0xFbdd194376de19a88118e84E279b977f165d01b8)

Liquidity for these tokens can be found within third-party DApps such as [Velocimeter](https://www.velocimeter.xyz/).


# Providing Liquidity

The [**app.canto.io**](https://app.canto.io/) frontend offers two interfaces for providing liquidity on the Canto DEX and Ambient:

* [**app.canto.io/lp**](https://app.canto.io/lp) – for incentivized pairs
* [**pools.canto.io**](https://pools.canto.io/) – for all other pairs

{% hint style="info" %}
To swap tokens through the Canto DEX or Ambient, use a third-party frontend or aggregator such as [Slingshot](https://app.slingshot.finance/trade/ETH).
{% endhint %}

## [app.canto.io/lp](https://app.canto.io/lp)

This interface is used to provide liquidity to any of Canto's incentivized liquidity pools. At the time of writing, these include the following:

* CANTO/NOTE (Canto DEX, volatile)
* CANTO/ETH (Canto DEX, volatile)
* CANTO/ATOM (Canto DEX, volatile)
* NOTE/USDC (Canto DEX, stable)
* NOTE/USDT (Canto DEX, stable)
* cNOTE/USDC (Ambient)
* NOTE/USDC (Ambient)

### Add Liquidity

In order to add liquidity to a pool using the LP interface:

1. Click on the `Add LP` button next to a pool and select `Manage LP`.
2. Enter how much liquidity you wish to provide, and click the `Add Liquidity` button.
3. Confirm the transactions in your wallet.

<figure><img src="/files/ryleJD4PV8r0PWdRixHg" alt=""><figcaption></figcaption></figure>

Liquidity tokens are automatically deposited to the Canto Lending Market ("staked") to earn liquidity incentives.

### Remove Liquidity

In order to remove liquidity from a pool using the LP interface:

1. Click on the `Manage LP` button next to a pool and select `Manage LP`.
2. Navigate to the `REMOVE` tab.
3. Enter how much liquidity you wish to remove, and click the `Remove Liquidity` button.
4. Confirm the transactions in your wallet.

## [**pools.canto.io**](https://pools.canto.io/)

This interface is used to create or provide liquidity to pools on the Canto DEX.

### Create a Pool

<figure><img src="/files/18h0W5d9w26tyzulME6k" alt=""><figcaption></figcaption></figure>

1. Click on the `Create a Pair` button.
2. Select the assets.
3. Sign the transactions in your wallet to create the pair.
4. Optionally, follow the steps below to add liquidity.

### Add Liquidity

<figure><img src="/files/YapESmIUKBaNL95UvBp3" alt=""><figcaption></figcaption></figure>

1. Click on the `ADD LP` button next to a pool or create a new pair as above.
2. Enter how much liquidity you wish to provide. For a new pair, the amounts of each asset will determine the starting price.
3. Click on the `APPROVE TOKENS` button and confirm the transactions in your wallet.
4. Finally, click on the `ADD LP` button and confirm the transactions in your wallet.

### Remove Liquidity

1. Click on the `ADD LP` button next to a pool and select the `REMOVE` tab.
2. Enter how much liquidity you wish to remove.
3. Click on the `REMOVE LP` button and confirm the transactions in your wallet.


# Lending & Borrowing

The Canto Lending Market at [**app.canto.io/lending**](https://app.canto.io/lending) allows users to lend and borrow assets. Currently, USDC, USDT, and NOTE can be supplied to and borrowed from the Canto Lending Market. Additionally, [USYC](https://docs.canto.io/neofinance/overview#rwas) can be supplied.

## Supplying Tokens

To supply an asset to the Canto Lending Market, follow these steps:

1. On the [**app.canto.io/lending**](https://app.canto.io/lending) homepage, click `SUPPLY NOTE`. For other assets, click `Supply` in the `RWAs` or `Stablecoins` tab.
2. Enter the quantity of the asset. If necessary, approve the token's transfer.
3. Click `Confirm` and confirm the transaction in your wallet.

<figure><img src="/files/x53cMIfdiPpiTQV0qtdR" alt=""><figcaption></figcaption></figure>

Once the transaction has been mined, asset-specific cTokens will be minted to your wallet. These tokens represent your lending position and are automatically burnt when withdrawing the supplied asset.

### Withdrawing Supplied Assets

To withdraw a supplied asset from the Canto Lending Market, follow these steps:

1. On the [**app.canto.io/lending**](https://app.canto.io/lending) homepage, click `SUPPLY NOTE`. For other assets, click `Supply` in the `RWAs` or `Stablecoins` tab.
2. Switch to the `Withdraw` tab and enter the quantity of the asset you wish to withdraw.
3. Click `Confirm` and confirm the transaction in your wallet.

If you have open borrow positions, note that you will not be able to withdraw if the hypothetical borrow limit usage exceeds 100%, as this would result in liquidation.

## Borrowing

In order to borrow an asset, there must be enough supply in the Canto Lending Market to borrow against. To do so, follow these steps:

1. On the [**app.canto.io/lending**](https://app.canto.io/lending) homepage, click `BORROW NOTE`. For other assets, click `Borrow` in the `Stablecoins` tab.
2. Enter the quantity of the asset you wish to borrow.
3. Click `Confirm` and confirm the transaction in your wallet.

<figure><img src="/files/lAjtc8reZPsdWaa3d1Ig" alt=""><figcaption></figcaption></figure>

Note that it is possible to manually enter a borrow amount whereby the `borrow limit used` exceeds 80%, but this is not advisable due to liquidation risk.

### Repaying Borrows

To repay a borrowed asset, follow these steps:

1. On the [**app.canto.io/lending**](https://app.canto.io/lending) homepage, click `BORROW NOTE`. For other assets, click `Borrow` in the `Stablecoins` tab.
2. Switch to the `Repay` tab and enter the quantity of the asset you wish to repay.
3. Click `Confirm` and confirm the transaction in your wallet.


# Staking

Staking, also known as delegating, is the process of locking up your CANTO tokens for a period of time to contribute to the security of the Canto network.

In exchange for locking up your tokens, you'll earn rewards in the form of additional CANTO, as well as voting power for governance proposals.

{% hint style="warning" %}
Staked tokens are subject to a **21 day unbonding period**. If you decide to unstake CANTO, you will have to wait 21 days before it returns to your wallet.
{% endhint %}

## How to Stake

Follow these steps to stake your CANTO:

1. Navigate to [**v2.app.canto.io/staking**](https://app.canto.io/staking) and connect your wallet.
2. Click on the "all validators" tab to see a list of network validators:\\

   <figure><img src="/files/VlYeDjNSweHpfYR0ePHE" alt=""><figcaption></figcaption></figure>
3. Click on the validator you would like to stake with:\\

   <figure><img src="/files/EfYtsPIrdZgV9CmYtrqV" alt=""><figcaption></figcaption></figure>
4. Enter the amount of CANTO you would like to stake and click "delegate".
5. Confirm the transaction in your wallet.

## Claiming Rewards

1. Navigate to [**app.canto.io/staking**](https://app.canto.io/staking) and connect your wallet.
2. Click on "claim rewards" and confirm the transaction in your wallet.

Note: You must claim rewards separately for every validator you have delegated to.

<figure><img src="/files/uq2kz3JgacETyt3S3YGi" alt=""><figcaption></figcaption></figure>

## Re-Delegating

You may wish to move your stake between validators without subjecting yourself to the unbonding period. This can be done by re-delegating your stake:

1. Navigate to [**v2.app.canto.io/staking**](https://app.canto.io/staking) and connect your wallet.
2. Click on the delegation you would like to re-delegate.
3. On the "redelegate" tab, choose the validator you would like to re-delegate to and enter the amount.
4. Click on "re-delegate" and confirm the transaction in your wallet.

{% hint style="warning" %}
You can only re-delegate from an account once every 21 days.
{% endhint %}

## How to Unstake

Follow these steps to unstake your CANTO:

1. Navigate to [**v2.app.canto.io/staking**](https://app.canto.io/staking) and connect your wallet.
2. Click on the delegation you would like to unstake.
3. On the "undelegate" tab, enter the amount you would like to undelegate.
4. Click on "undelegate" and confirm the transaction in your wallet.

When you unstake tokens, they will be subject to a 21 day unbonding period. You can see the progress of any unbonding accounts at the bottom of the staking homepage.

<figure><img src="/files/1qHaLs7IjeHK4WV3mfH3" alt=""><figcaption></figcaption></figure>

**Note**: You can only have 7 concurrent undelegations at a time for each validator. In other words, you can unstake 7 times from a given validator within a 21 day period.

## Risks (Slashing)

Staking CANTO is not without risk. By delegating tokens to a validator, you assume some responsibility for their behavior, proportionally to the size of your stake.

If a validator misbehaves, any tokens delegated to them will be [slashed](https://docs.app.canto.io/technical-reference/validators/slashing) by:

* 0.75% in the case of prolonged downtime
* 4% in the case of consensus faults

Due to slashing, performing due diligence on validators before staking any tokens and splitting your stake across multiple validators is highly recommended.

Aside from slashing, staked tokens are subject to a 21 day unbonding period from the moment they are unstaked, as previously mentioned. During this time, you will not be able to access your tokens.


# Governance

The Canto governance page at [**v2.app.canto.io/governance**](https://app.canto.io/governance) is a place where all users who have staked Canto can vote on proposals. This allows you to contribute to the blockchain and place votes on changes that will directly impact the Canto community.

<figure><img src="/files/eX4zz5KQIjD7J9WKMpon" alt=""><figcaption></figcaption></figure>

### Proposals

When entering the governance page, a list of all completed and ongoing proposals are shown. The title of the proposal, start time, end time, and a bar representing the current votes is shown in each block. For more information on each proposal, click on the proposal and a modal will open.

<figure><img src="/files/AzADxPoSEiX6IrgDnntN" alt=""><figcaption></figcaption></figure>

In the proposal modal, you can see more in depth information about the proposal including the description, individual vote count, and thresholds for the proposal. If the vote has ended, the modal will show `voting has ended` and you will not be able to vote.

### Voting

If the proposal is still ongoing, and you have staked canto at staking.canto.io, you are eligible to vote on the active proposal. You will see 4 options to choose from when voting, `yes`, `no`, `veto`, and `abstain`.

After selecting an option, click `vote` and sign the transaction in your wallet:

![Metamask Transaction](/files/1dlVRMzGyh3KDkqlRcIP)

After signing the vote, you will see a success message and the screen will refresh with your new vote added to the proposal.


# Overview

The Canto EVM runs [Geth](https://geth.ethereum.org/) and is fully EVM-compatible. This means that building on Canto's execution layer is just like building on Ethereum in that developers can:

* Connect with the same wallets,
* Deploy the same smart contract source code,
* Use the same tooling, and more.

## Canto vs Ethereum

At launch, Canto's execution layer is EVM-equivalent. Its differences from Ethereum include a shorter block time and modified gas fee model.

### Block time

Following the merge, Ethereum's block time is 12 seconds, whereas Canto EVM's block time is approximately 6 seconds.

### Gas fees

Canto EVM uses a modified EIP-1559 gas model *without* priority fees. The minimum base fee is 1000 acanto (the equivalent of gwei) and self-adjusts based on how full blocks are.


# Quickstart Guide

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 [Hardhat](https://hardhat.org/), [Truffle](https://trufflesuite.com/), [Foundry](https://getfoundry.sh/), [Remix](https://remix.ethereum.org/), 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:* [*https://www.oklink.com/canto*](https://www.oklink.com/canto)

<details>

<summary><strong>Alternative RPC URLs</strong></summary>

* <https://canto.neobase.one>
* <https://canto.evm.chandrastation.com>
* <https://jsonrpc.canto.nodestake.top/>
* <https://canto.dexvaults.com/>

</details>

<details>

<summary>Alternative Block Explorers</summary>

Canto EVM:

* <https://cantoscan.xyz/>
* <https://www.gacanto.com/>
* <https://canto.dex.guru/>

Canto EVM and Native:

* <https://www.mintscan.io/canto>

</details>

## Testnet

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

**Chain ID**: **7701**

*Explorer:* [*https://testnet.tuber.build/*](https://testnet.tuber.build/) *Alternative Testnet Explorer URL:* <https://canto-test.dex.guru/>

## Libraries

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

Needless to say, you can interact with the Canto EVM using most Ethereum libraries, such as [ethers.js](https://docs.ethers.io/v5/), [web3.js](https://web3js.readthedocs.io/en/v1.8.0/), and [web3.py](https://web3py.readthedocs.io/en/stable/) – just initialize a provider with the Canto RPC using your library of choice. For example:

```javascript
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:

<figure><img src="/files/rqArHaYPoCF6rtRshfJG" alt=""><figcaption></figcaption></figure>

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.

For this example, let's copy and paste the following source code based on the [official Solidity documentation](https://docs.soliditylang.org/en/v0.8.17/introduction-to-smart-contracts.html):

```solidity
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

To deploy your smart contract, start by making sure you have MetaMask installed and [connected to Canto](/user-guides/connecting-to-canto). Since this contract is for testing purposes, we'll connect to the Canto testnet.

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*:

<figure><img src="/files/hQcPM2asj4ralTa6tCDP" alt=""><figcaption></figcaption></figure>

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

{% hint style="info" %}
If your smart contract uses constructor arguments, enter them in the field adjacent to the *Deploy* button before attempting to deploy your contract.
{% endhint %}

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.


# NOTE, DEX, and Lending Market

When building DApps, you may wish to leverage Canto's Free Public Infrastructure, such as its native unit of account, DEX, or lending market. This page provides an overview of how these primitives are designed and how you can interact with them.

For mainnet and testnet deployment addresses, refer to the Contract Addresses page:

{% content-ref url="/pages/c8t0nFIvlTnxuPqgVtPT" %}
[Contract Addresses](/evm-development/contract-addresses)
{% endcontent-ref %}

## NOTE

[NOTE](https://docs.canto.io/free-public-infrastructure-fpi/note) must be borrowed from the Accountant via the Canto Lending Market. The amount of NOTE circulating at any given time (including NOTE that users have supplied back to the Canto Lending Market) is equal to the sum of all NOTE and cNOTE *not* held by the Accountant.

The NOTE smart contract may be modified and redeployed at a new address in the future. For this reason, DApps should use the `CToken.underlying()` view on the [cNOTE](https://docs.canto.io/evm-development/contract-addresses#neofinance) contract to determine the address for NOTE instead of hardcoding it.

## Canto DEX

The Canto DEX is built around three contracts: [`BaseV1Factory`](https://github.com/Canto-Network/clm/blob/7a734186ac773a8e53c55c07c5ec32d32a528b4a/src/Swap/BaseV1-core.sol#L530), [`BaseV1Pair`](https://github.com/Canto-Network/clm/blob/7a734186ac773a8e53c55c07c5ec32d32a528b4a/src/Swap/BaseV1-core.sol#L11), and [`BaseV1Router01`](https://github.com/Canto-Network/clm/blob/7a734186ac773a8e53c55c07c5ec32d32a528b4a/src/Swap/BaseV1-periphery.sol#L47). Each liquidity pool is represented by a unique `BaseV1Pair` contract generated by the `BaseV1Factory`.

For most use cases, `BaseV1Router01` offers sufficient functionality. Key methods include:

| Method                           | Description                                         |
| -------------------------------- | --------------------------------------------------- |
| `pairFor`                        | Calculates the address for a pair                   |
| `isPair`                         | Checks if an address is a valid pair                |
| `getReserves`                    | Fetches and sorts the reserves for a pair           |
| `getAmountOut`                   | Calculates amount out for a specified pair          |
| `addLiquidity`                   | Adds liquidity to a pair                            |
| `removeLiquidity`                | Removes liquidity from a pair                       |
| `swapExactTokensforTokensSimple` | Swaps one token for another directly                |
| `swapExactTokensforTokens`       | Swaps one token for another using a specified route |
| `getUnderlyingPrice`             | Gets underlying asset price as a mantissa           |

For CANTO-specific and other methods, refer to the [contract source code](https://github.com/Canto-Network/clm/blob/7a734186ac773a8e53c55c07c5ec32d32a528b4a/src/Swap/BaseV1-periphery.sol#L47).

## Canto Lending Market

The Canto Lending Market is an adaptation of [Compound v2](https://docs.compound.finance/v2/comptroller/). Its functional design is unchanged in that the primary means of interacting with the lending market is the [`CToken`](https://github.com/Canto-Network/clm/blob/main/src/CToken.sol), an ERC20 representation of a supplied asset.

Key methods on `CToken` contracts include:

| Method             | Description                                                          |
| ------------------ | -------------------------------------------------------------------- |
| `mint`             | Deposits a token and mints the corresponding CToken                  |
| `redeem`           | Redeems a specified amount of CToken tokens for the underlying token |
| `redeemUnderlying` | Redeems CToken tokens for a specified amount of the underlying token |
| `borrow`           | Borrows the underlying token                                         |
| `repayBorrow`      | Repays a borrow of the underlying token                              |

For more information on the Canto Lending Market's design, see the [Compound v2 docs](https://docs.compound.finance/v2/).


# Contract Secured Revenue (CSR)

Canto implements a fee split model called Contract Secured Revenue, or CSR, by means of the [`x/CSR`](https://github.com/Canto-Network/Canto/tree/csr/x/csr) module. CSR allows you to claim a percentage of all transaction fees paid by users when interacting with your smart contracts.

CSR was added in the Canto v5.0.0 chain upgrade with an initial fee split of 20%, following a successful [governance proposal](https://app.canto.io/governance/proposal/41).

## Overview

To earn CSR fees, you must register your contracts with the CSR **Turnstile** smart contract deployed on Canto mainnet at [0xEcf044C5B4b867CFda001101c617eCd347095B44](https://oklink.com/canto/address/0xEcf044C5B4b867CFda001101c617eCd347095B44). The source code for Turnstile can be found [here](https://github.com/Canto-Network/Canto/blob/csr/contracts/turnstile.sol).

Upon registering a contract, a transferrable NFT representing the right to claim that contract's revenue is minted to an address of your choice. Alternatively, you can assign a contract's revenue to an existing CSR NFT.

CSR fees for all registered contracts accrue in the Turnstile contract. To withdraw fees from the Turnstile contract, you must specify the token ID of a CSR NFT you hold.

## Registering a Contract <a href="#registering-a-contract" id="registering-a-contract"></a>

{% hint style="danger" %}
Calling the `register` method from an EOA does not revert and will mint a CSR NFT. However, no fees will be distributed to this NFT when the EOA transacts. **Additionally, any contracts later assigned to this NFT will \_not**\_\*\* generate CSR fees.\*\*
{% endhint %}

To register a smart contract for CSR, call the `register` method on the [Turnstile contract](https://oklink.com/canto/address/0xEcf044C5B4b867CFda001101c617eCd347095B44) **from the contract you wish to register.**

This method takes one parameter: the `address` to which the CSR NFT should be minted. This can be an address that does not exist (i.e. an address that has never transacted before).

You can register a contract in the constructor or otherwise; however, CSR fees will only begin accruing once the contract is registered.

```solidity
interface Turnstile {
    function register(address) external returns(uint256);
}
    
contract Example {
    Turnstile turnstile = Turnstile(0xabc...);
    
    constructor() {
        //Registers the smart contract with Turnstile
        //Mints the CSR NFT to the contract creator
        turnstile.register(tx.origin);
    }
}
```

The `register` method returns the token ID of the CSR NFT that was minted.

### Assignment <a href="#assignment" id="assignment"></a>

You can register a smart contract for CSR while assigning its fees to an existing CSR NFT by calling the `assign` method on the [Turnstile contract](https://oklink.com/canto/address/0xEcf044C5B4b867CFda001101c617eCd347095B44). This method also takes one parameter: the `uint256` token ID of the CSR NFT to which fees should be assigned.

The same constraints apply:

* You must call this method from the contract you wish to register.
* CSR fees will only begin accruing once the contract is registered.

```solidity
interface Turnstile {
    function assign(uint256) external returns(uint256);
}

contract Example {
    Turnstile turnstile = Turnstile(0xabc...);

    constructor() {
        //Registers the smart contract with Turnstile
        //Assigns this contract's fee revenue to CSR NFT #1
        turnstile.assign(1);
    }
}
```

The `assign` method returns the token ID of the CSR NFT that was passed to it.

## Withdrawing Fees <a href="#withdrawing-fees" id="withdrawing-fees"></a>

You can check the amount of fees that have accrued for a CSR NFT by reading the value stored in the `balances` mapping for the NFT's token ID.

To withdraw CSR fees, call the `withdraw` method on the Turnstile contract **from the address that holds the CSR NFT**. This method takes three parameters: the token ID of the CSR NFT, the address that should receive the fees, and the amount of fees to withdraw.

## Factory Contracts

You can implement the `register` and `assign` methods in factory contracts, such that child contracts are automatically registered for CSR when they are created.


# Verifying Contracts

The contributor-operated block explorer at <https://oklink.com/canto/> supports contract verification, allowing you to share your smart contracts' source code, methods, and ABIs with users and developers through the explorer itself.

Another 3rd-party operated block explorer at <https://canto.dex.guru/> supports smart contract verification with a native UI for Sourcify.

## Verifying with Sourcify

At present, the explorer only supports contract verification via Sourcify. To verify a contract, follow these steps:

1. Navigate to the contract you would like to verify on the Canto block explorer.
2. On the *Code* tab, click *Verify & Publish.*
3. Select verification via Sourcify and click *Next.*
4. Import or upload your project's source files and metadata.
   * For Hardhat, include the JSON file located at `artifacts/build-info`/
   * For Truffle, include the JSON file located at `build/contracts/`
5. Click *Verify & publish.* The contract will become verified within several minutes.

You can also verify contracts through the [Sourcify website](https://sourcify.dev/#/verifier). For more information on how to do so, as well as guidelines on how partial matches, libraries, and more are handled, see the [documentation](https://docs.sourcify.dev/docs/how-to-verify/).


# Contract Addresses

This page contains contract addresses for ERC20 tokens and Free Public Infrastructure deployed on Canto mainnet and testnet.

{% hint style="info" %}
CANTO is the native gas token on the Canto EVM and does not have a smart contract. An ERC20 wrapper for CANTO exists, called wCANTO.

ETH is an ERC20 token on the Canto EVM, so a wrapper is not needed.
{% endhint %}

## Mainnet (7700)

### ERC20 Tokens

| Contract | Address                                                                                                                   |
| -------- | ------------------------------------------------------------------------------------------------------------------------- |
| NOTE     | [0x4e71A2E537B7f9D9413D3991D37958c0b5e1e503](https://oklink.com/canto/address/0x4e71A2E537B7f9D9413D3991D37958c0b5e1e503) |
| WCANTO   | [0x826551890Dc65655a0Aceca109aB11AbDbD7a07B](https://oklink.com/canto/address/0x826551890Dc65655a0Aceca109aB11AbDbD7a07B) |
| ETH      | 0x5FD55A1B9FC24967C4dB09C513C3BA0DFa7FF687                                                                                |
| USDC     | 0x80b5a32E4F032B2a058b4F29EC95EEfEEB87aDcd                                                                                |
| USDT     | 0xd567B3d7B8FE3C79a1AD8dA978812cfC4Fa05e75                                                                                |
| ATOM     | 0xecEEEfCEE421D8062EF8d6b4D814efe4dc898265                                                                                |
| USYC     | 0xFb8255f0De21AcEBf490F1DF6F0BDd48CC1df03B                                                                                |
| fBILL    | 0x79ECCE8E2D17603877Ff15BC29804CbCB590EC08                                                                                |
| ifBILL   | 0x45bafad5a6a531Bc18Cf6CE5B02C58eA4D20589b                                                                                |

### Neofinance Coordinator

| Contract        | Address                                                                                                                       |
| --------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| VotingEscrow    | [0x2fed02d6d50a8786D53F308024400fDAD275F57C](https://oklink.com/canto/address/0x2fed02d6d50a8786D53F308024400fDAD275F57C)     |
| GaugeController | [0x46970b45d114420A71A3d76AA6c398173118C2b8](https://oklink.com/canto/address/0x46970b45d114420A71A3d76AA6c398173118C2b8)     |
| LendingLedger   | [0x831F746D3b0137B0F3311013e95842cf60Fa44Ed](https://www.oklink.com/canto/address/0x831f746d3b0137b0f3311013e95842cf60fa44ed) |

### Accountant

| Contract            | Address                                                                                                                   |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| AccountantDelegate  | [0xC0ce8477c81A9F6C972976440C7b3305C37432f3](https://oklink.com/canto/address/0xC0ce8477c81A9F6C972976440C7b3305C37432f3) |
| AccountantDelegator | [0x4F6DCfa2F69AF7350AAc48D3a3d5B8D03b5378AA](https://oklink.com/canto/address/0x4F6DCfa2F69AF7350AAc48D3a3d5B8D03b5378AA) |

### Canto DEX

| Contract       | Address                                                                                                                   |
| -------------- | ------------------------------------------------------------------------------------------------------------------------- |
| BaseV1Factory  | 0xE387067f12561e579C5f7d4294f51867E0c1cFba                                                                                |
| BaseV1Router01 | [0xa252eEE9BDe830Ca4793F054B506587027825a8e](https://oklink.com/canto/address/0xa252eEE9BDe830Ca4793F054B506587027825a8e) |
| CantoNoteLP    | 0x1D20635535307208919f0b67c3B2065965A85aA9                                                                                |
| CantoAtomLP    | 0x30838619C55B787BafC3A4cD9aEa851C1cfB7b19                                                                                |
| NoteUSDTLP     | 0x35DB1f3a6A6F07f82C76fCC415dB6cFB1a7df833                                                                                |
| NoteUSDCLP     | 0x9571997a66D63958e1B3De9647C22bD6b9e7228c                                                                                |
| CantoETHLP     | 0x216400ba362d8FCE640085755e47075109718C8B                                                                                |

### Ambient Finance

| Contract    | Address                                                                                                                   |
| ----------- | ------------------------------------------------------------------------------------------------------------------------- |
| CrocSwapDex | [0x9290C893ce949FE13EF3355660d07dE0FB793618](https://oklink.com/canto/address/0x9290C893ce949FE13EF3355660d07dE0FB793618) |

### Canto Lending Market

| Contract     | Address                                                                                                                   |
| ------------ | ------------------------------------------------------------------------------------------------------------------------- |
| Unitroller   | [0x5E23dC409Fc2F832f83CEc191E245A191a4bCc5C](https://oklink.com/canto/address/0x5E23dC409Fc2F832f83CEc191E245A191a4bCc5C) |
| Comptroller  | [0xD5DbF5cd90f158597f916591dBaDDe27E4A4d4Cf](https://oklink.com/canto/address/0xD5DbF5cd90f158597f916591dBaDDe27E4A4d4Cf) |
| cUSYC        | [0x0355E393cF0cf5486D9CAefB64407b7B1033C2f1](https://oklink.com/canto/address/0x0355E393cF0cf5486D9CAefB64407b7B1033C2f1) |
| cfBILL       | [0xF1F89dF149bc5f2b6B29783915D1F9FE2d24459c](https://oklink.com/canto/address/0xF1F89dF149bc5f2b6B29783915D1F9FE2d24459c) |
| cifBILL      | [0x897709FC83ba7a4271d22Ed4C01278cc1Da8d6F8](https://oklink.com/canto/address/0x897709FC83ba7a4271d22Ed4C01278cc1Da8d6F8) |
| cNOTE        | [0xEe602429Ef7eCe0a13e4FfE8dBC16e101049504C](https://oklink.com/canto/address/0xEe602429Ef7eCe0a13e4FfE8dBC16e101049504C) |
| cCANTO       | [0xB65Ec550ff356EcA6150F733bA9B954b2e0Ca488](https://oklink.com/canto/address/0xB65Ec550ff356EcA6150F733bA9B954b2e0Ca488) |
| cETH         | [0x830b9849e7d79b92408a86a557e7baaacbec6030](https://oklink.com/canto/address/0x830b9849E7D79B92408a86A557e7baAACBeC6030) |
| cUSDC        | [0xdE59F060D7ee2b612E7360E6C1B97c4d8289Ca2e](https://oklink.com/canto/address/0xdE59F060D7ee2b612E7360E6C1B97c4d8289Ca2e) |
| cUSDT        | [0x6b46ba92d7e94FfA658698764f5b8dfD537315A9](https://oklink.com/canto/address/0x6b46ba92d7e94FfA658698764f5b8dfD537315A9) |
| cATOM        | [0x617383F201076e7cE0f6E625D1a983b3D1bd277A](https://oklink.com/canto/address/0x617383F201076e7cE0f6E625D1a983b3D1bd277A) |
| cCantoNoteLP | [0x3C96dCfd875253A37acB3D2B102b6f328349b16B](https://oklink.com/canto/address/0x3C96dCfd875253A37acB3D2B102b6f328349b16B) |
| cCantoAtomLP | [0xC0D6574b2fe71eED8Cd305df0DA2323237322557](https://oklink.com/canto/address/0xC0D6574b2fe71eED8Cd305df0DA2323237322557) |
| cNoteUSDTLP  | [0xf0cd6b5cE8A01D1B81F1d8B76643866c5816b49F](https://oklink.com/canto/address/0xf0cd6b5cE8A01D1B81F1d8B76643866c5816b49F) |
| cNoteUSDCLP  | [0xD6a97e43FC885A83E97d599796458A331E580800](https://oklink.com/canto/address/0xD6a97e43FC885A83E97d599796458A331E580800) |
| cCantoETHLP  | [0xb49A395B39A0b410675406bEE7bD06330CB503E3](https://oklink.com/canto/address/0xb49A395B39A0b410675406bEE7bD06330CB503E3) |

### GovShuttle Module

| Contract | Address                                                                                                                   |
| -------- | ------------------------------------------------------------------------------------------------------------------------- |
| Port     | [0x648a5Aa0C4FbF2C1CF5a3B432c2766EeaF8E402d](https://oklink.com/canto/address/0x648a5Aa0C4FbF2C1CF5a3B432c2766EeaF8E402d) |

### Contract Secured Revenue (CSR) <a href="#csr" id="csr"></a>

| Contract  | Address                                                                                                                   |
| --------- | ------------------------------------------------------------------------------------------------------------------------- |
| Turnstile | [0xEcf044C5B4b867CFda001101c617eCd347095B44](https://oklink.com/canto/address/0xEcf044C5B4b867CFda001101c617eCd347095B44) |

### Multicall

| Contract   | Address                                                                                                                   |
| ---------- | ------------------------------------------------------------------------------------------------------------------------- |
| Multicall1 | [0x210b88d5Ad4BEbc8FAC4383cC7F84Cd4F03d18c6](https://oklink.com/canto/address/0x210b88d5Ad4BEbc8FAC4383cC7F84Cd4F03d18c6) |
| Multicall2 | [0x637490E68AA50Ea810688a52D7464E10c25A77c1](https://oklink.com/canto/address/0x637490E68AA50Ea810688a52D7464E10c25A77c1) |
| Multicall3 | [0xcA11bde05977b3631167028862bE2a173976CA11](https://oklink.com/canto/address/0xcA11bde05977b3631167028862bE2a173976CA11) |

## Testnet (7701)

{% hint style="info" %}
These contract addresses are for contracts deployed to the [new Canto testnet](/evm-development/testnet).
{% endhint %}

### ERC20 Tokens <a href="#testnet-erc20-tokens" id="testnet-erc20-tokens"></a>

| Contract | Address                                    |
| -------- | ------------------------------------------ |
| NOTE     | 0x03F734Bd9847575fDbE9bEaDDf9C166F880B5E5f |
| WCANTO   | 0x04a72466De69109889Db059Cb1A4460Ca0648d9D |
| ETH      | 0xCa03230E7FB13456326a234443aAd111AC96410A |
| USDC     | 0xc51534568489f47949A828C8e3BF68463bdF3566 |
| USDT     | 0x4fC30060226c45D8948718C95a78dFB237e88b40 |
| ATOM     | 0x40E41DC5845619E7Ba73957449b31DFbfB9678b2 |

### Neofinance Coordinator <a href="#testnet-neofinance-coordinator" id="testnet-neofinance-coordinator"></a>

| Contract        | Address                                    |
| --------------- | ------------------------------------------ |
| VotingEscrow    | 0x0C6CC7BB309639B720BCbcC7bFea48Ed4A39F43C |
| GaugeController | 0xc0395538ee9144a2A3acc2C9AD6329bFFe12AF22 |
| LendingLedger   | 0x94D288543c566Fc20d46A26be9c94Da79ebbcecD |

### Accountant <a href="#testnet-accountant" id="testnet-accountant"></a>

| Contract            | Address                                    |
| ------------------- | ------------------------------------------ |
| AccountantDelegate  | 0x63c8FEb024D7aAf02c2DC21708f0E17EB0b03F67 |
| AccountantDelegator | 0xdb91f7127Aa66855845696db77c37d1b6bEAd2db |

### Canto DEX <a href="#testnet-canto-dex" id="testnet-canto-dex"></a>

| Contract       | Address                                    |
| -------------- | ------------------------------------------ |
| BaseV1Factory  | 0x760a17e00173339907505B38F95755d28810570C |
| BaseV1Router01 | 0x463e7d4DF8fE5fb42D024cb57c77b76e6e74417a |
| CantoNoteLP    | 0x395E6ce7891f32278375Ff551B8ed61dF5579fE3 |
| CantoAtomLP    | 0x2bDF6c1302efc3c03D9C95f6fb5a4826A6bD964b |
| NoteUSDTLP     | 0x252631e22e1ECc2fc0E811562605ed624B7E31d5 |
| NoteUSDCLP     | 0x2db30A39Ec88247da8906506DB8E9dd933A5C775 |
| CantoETHLP     | 0x905D3d7F4C892d535160f1E2BA55f23Cd306718b |

### Canto Lending Market <a href="#testnet-canto-lending-market" id="testnet-canto-lending-market"></a>

| Contract     | Address                                    |
| ------------ | ------------------------------------------ |
| Unitroller   | 0x9514c07bC6e80B652e4264E64f589C59065C231f |
| Comptroller  | 0xA51436eF5D46EE56B0906DeC620466153f7fb77e |
| cNOTE        | 0x04E52476d318CdF739C38BD41A922787D441900c |
| cCANTO       | 0x477eaF5DECf6299EE937954084f0d53EFc57346F |
| cETH         | 0x260fCD909ab9dfF97B03591F83BEd5bBfc89A571 |
| cUSDC        | 0x9160c5760a540cAfA24F90102cAA14C50497d5b7 |
| cUSDT        | 0x3BEe0A8209e6F8c5c743F21e0cA99F2cb780D0D8 |
| cATOM        | 0x90FCcb79Ad6f013A4bf62Ad43577eed7a8eb961B |
| cCantoNoteLP | 0x2fd02CDB9Be9428d4eC2Ae969e52710601E219C6 |
| cCantoAtomLP | 0x4777Dc2b41f1f2Bd878205A61c1eA2609749928C |
| cNoteUSDTLP  | 0xBeD263484AEDFD449eE1ed8f0b4799192026E190 |
| cNoteUSDCLP  | 0xB2C5512a8A70835Cb9aBe830C9e61FBDdcd1dC81 |
| cCantoETHLP  | 0xf301c9d5804Fab3dd207ef75f78509db6393f37F |

### GovShuttle Module <a href="#testnet-govshuttle-module" id="testnet-govshuttle-module"></a>

| Contract | Address                                                                                                                   |
| -------- | ------------------------------------------------------------------------------------------------------------------------- |
| Port     | [0x648a5Aa0C4FbF2C1CF5a3B432c2766EeaF8E402d](https://oklink.com/canto/address/0x648a5Aa0C4FbF2C1CF5a3B432c2766EeaF8E402d) |

### Contract Secured Revenue (CSR) <a href="#testnet-csr" id="testnet-csr"></a>

| Contract  | Address                                    |
| --------- | ------------------------------------------ |
| Turnstile | 0xEcf044C5B4b867CFda001101c617eCd347095B44 |

### Multicall <a href="#testnet-multicall" id="testnet-multicall"></a>

| Contract   | Address                                                                                                                           |
| ---------- | --------------------------------------------------------------------------------------------------------------------------------- |
| Multicall1 | [0xe536cF7B00069894da25faC787d7aD9D211a2C1A](https://testnet.oklink.com/canto/address/0xe536cF7B00069894da25faC787d7aD9D211a2C1A) |
| Multicall2 | [0x0e356B86FA2aE1bEB93174C18AD373207a40F2A3](https://testnet.oklink.com/canto/address/0x0e356B86FA2aE1bEB93174C18AD373207a40F2A3) |
| Multicall3 | [0xcA11bde05977b3631167028862bE2a173976CA11](https://testnet.oklink.com/canto/address/0xcA11bde05977b3631167028862bE2a173976CA11) |

## LayerZero OFTs

{% hint style="info" %}
These contract addresses are for LayerZero representations of Canto assets. The deployment addresses (below) for OFTs are **the same on all chains**: Canto, Ethereum, Binance Smart Chain.
{% endhint %}

### Tokens

| Contract  | Address                                                                                                               |
| --------- | --------------------------------------------------------------------------------------------------------------------- |
| CANTO OFT | [0x56C03B8C4FA80Ba37F5A7b60CAAAEF749bB5b220](https://etherscan.io/address/0x56c03b8c4fa80ba37f5a7b60caaaef749bb5b220) |
| CNOTE OFT | [0xEbe265c9299d0C879bcc2A76948511BA6ED6C36D](https://etherscan.io/address/0xebe265c9299d0c879bcc2a76948511ba6ed6c36d) |


# Testnet

{% hint style="info" %}
Canto migrated to a new testnet network with chain ID 7701 (previously 740) in March 2023. Information about the new testnet is provided below.
{% endhint %}

Canto has a testnet network for development and testing purposes. To connect to and explore the testnet, use these details:

**Network Name:** Canto Testnet\
**New RPC URL:** `https://canto-testnet.plexnode.wtf`\
**Chain ID:** 7701\
**Currency Symbol:** CANTO\
**Block Explorer URL:** <https://testnet.tuber.build/>\
**Alternative Explorer URL:** <https://canto-test.dex.guru/>

## Faucet

A testnet faucet at <https://www.cantofaucet.com/> disperses 50 tokens per address per 24 hours.

Alternatively, use the `/driptestnet {address}` command in the #canto-testnet-faucet channel of the [Canto Discord](https://discord.gg/canto).

<details>

<summary>Discord Faucet Instructions</summary>

To use the faucet, locate the `#canto-testnet-faucet` channel in the Canto Discord. In this channel, begin typing `/driptestnet` into the chat bar. When you see the command appear above the chat bar, hit enter and paste in your wallet address. Finally, hit enter once more to send the command.

</details>

## Free Public Infrastructure

Canto's Free Public Infrastructure primitives, including the Canto DEX and Lending Market, are deployed to Canto testnet. Contract addresses can be found [here](https://docs.canto.io/evm-development/contract-addresses#testnet-7701).

## Contract Secured Revenue

[Contract Secured Revenue (CSR)](/evm-development/contract-secured-revenue) is enabled on Canto testnet. Turnstile is deployed at the same address as on mainnet i.e. 0xEcf044C5B4b867CFda001101c617eCd347095B44.


# Validators

Anyone can become a validator on Canto. In exchange for securing the network, validators can charge a percentage fee of their choosing on [staking rewards](/user-guides/staking) distributed to their delegators.

This section contains instructions on how to launch a validator node, as well as information and best practices on troubleshooting, slashing, and ensuring node uptime.

{% hint style="info" %}
For community troubleshooting and assistance, see the #builders-chat channel in the [Canto Discord](https://discord.gg/canto).
{% endhint %}

## Hosted Nodes

As an alternative to setting up and syncing a Canto node independently, dedicated validating nodes can be easily provisioned with [Ansybl](https://www.ansybl.io/).


# Quickstart Guide

This page contains step-by-step instructions for launching a Canto validator node.

Once you've set up your node, join the [Canto Network Validator Announcements channel](https://t.me/+9J0at4wgRw1lMzAx) on Telegram to stay up-to-date with chain upgrades and other governance proposals.

<details>

<summary>Hardware Requirements</summary>

**Minimum:** 16GB RAM, 100GB NVME SSD, 3.2 GHz x 4 CPU

**Recommended:** 32GB RAM, 500GB NVME SSD, 4.2 GHz x 6 CPU

**Operating System:** Linux (x86\_64 or amd64) e.g. Ubuntu or Arch Linux

</details>

## 1. Install Dependencies

Install dependencies (Ubuntu):

```sh
# Synchronize package index
sudo apt-get update

# Install packages
sudo snap install go --classic
sudo apt-get install git
sudo apt-get install gcc
sudo apt-get install make
```

## 2. Install `cantod`

Clone the official repo and install the current binary:

```sh
git clone https://github.com/Canto-Network/Canto.git
cd Canto
git checkout v7.0.0
make install
sudo mv $HOME/go/bin/cantod /usr/bin/
```

Generate and store keys:

```sh
cantod keys add <key_name>
```

To recover keys from an existing mnemonic, use the `--recover` flag.

## 3. Initialize Validator

Initialize the node and download the genesis file:

```sh
cantod init <MONIKER> --chain-id canto_7700-1
cd ~/.cantod/config
rm genesis.json
wget https://github.com/Canto-Network/Canto/raw/genesis/Networks/Mainnet/genesis.json
```

Replace `<moniker>` with whatever you'd like to name your validator.

## 4. Edit Config

```sh
# Add seed peer to config.toml
sed -i 's/seeds = ""/seeds = "ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:15556"/g' $HOME/.cantod/config/config.toml

# Set minimum gas price in app.toml
sed -i 's/minimum-gas-prices = "0acanto"/minimum-gas-prices = "0.0001acanto"/g' $HOME/.cantod/config/app.toml
```

## 5. Create systemd Service

Create the systemd service file:

```sh
sudo nano /etc/systemd/system/cantod.service
```

Copy and paste the following configuration and save:

```sh
[Unit]
Description=Canto Node
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/
ExecStart=/usr/bin/cantod start --trace --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable
Restart=on-failure
StartLimitInterval=0
RestartSec=3
LimitNOFILE=65535
LimitMEMLOCK=209715200

[Install]
WantedBy=multi-user.target
```

{% hint style="warning" %}
If using a non-root user, set the `User` and `WorkingDirectory` parameters accordingly, e.g.:

```
User=alice
WorkingDirectory=/home/alice/
```

{% endhint %}

## 6. Start Node

```sh
# Reload service files
sudo systemctl daemon-reload

# Create the symlink
sudo systemctl enable cantod.service

# Start the node
sudo systemctl start cantod

# Show logs
journalctl -u cantod -f
```

You should then get several lines of log files, which may include an `INVALIDARGUMENT` error causing the service to exit. This is expected; `Ctrl + C` out and follow the next steps.

## 7. Sync Node

Unless you wish to run an [archive node](/canto-node/archive-node), you should sync your node to the current block using [manual snapshots](/canto-node/validators/node-snapshots) or state-sync snapshots.

To use state-sync:

<pre class="language-sh"><code class="lang-sh"><strong># Set vars
</strong><strong>SNAP_RPC="https://canto-rpc.polkachu.com:443"
</strong>LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height)
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000))
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH

# Stop node
sudo systemctl stop cantod

# Reset cantod
cantod tendermint unsafe-reset-all --home $CANTO_HOME --keep-addr-book

# Add state-sync settings
sed -i -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" $HOME/.cantod/config/config.toml

# Restart
sudo systemctl start cantod
</code></pre>

## 8. Create Validator Transaction

Modify the following items below, removing the `<>`

* `<KEY_NAME>` should be the same as `<key_name>` when you followed the steps above in creating or restoring your key.
* `<VALIDATOR_NAME>` is whatever you'd like to name your node
* `<DESCRIPTION>` is whatever you'd like in the description field for your node
* `<SECURITY_CONTACT_EMAIL>` is the email you want to use in the event of a security incident
* `<YOUR_WEBSITE>` the website you want associated with your node
* `<TOKEN_DELEGATION>` is the amount of tokens staked by your node (minimum `1acanto`)

```sh
cantod tx staking create-validator \
--from <KEY_NAME> \
--chain-id canto_7700-1 \
--moniker="<VALIDATOR_NAME>" \
--commission-max-change-rate=0.01 \
--commission-max-rate=1.0 \
--commission-rate=0.05 \
--details="<DESCRIPTION>" \
--security-contact="<SECURITY_CONTACT_EMAIL>" \
--website="<YOUR_WEBSITE>" \
--pubkey $(cantod tendermint show-validator) \
--min-self-delegation="1" \
--amount <TOKEN_DELEGATION>acanto \
--fees 30000000000000000acanto \
--gas 300000
```

Your validator wallet must contain a non-zero amount of native CANTO in order to send the validator transaction. To get some, follow these steps:

1. Run `cantod debug addr $(cantod keys show <key_name> -a)` to see your validator's Bech32 and 0x addresses.
2. Send funds from a Canto EVM wallet to the 0x address shown
3. Alternatively, ask a validator who already has native CANTO to send funds to the Bech32 Acc address.

## 9. Update Binary

Once your validating node is up-and-running, join the [Canto Network Validator Announcements channel](https://discord.com/channels/993968517906960445/995469213080752159/1071089114503462982) on Telegram to stay up-to-date with chain upgrades and other governance proposals.

In case of a binary upgrade, you will need to re-fetch the Canto repository and install the new binary before restarting your node:

```sh
git pull

git checkout v7.0.0
make install

# Don't forget to move the installed binary to your path
sudo mv $HOME/go/bin/cantod /usr/bin/

# Restart
sudo systemctl stop cantod.service
sudo systemctl start cantod.service
```


# Useful Commands

Here are some useful commands for node operators:

<table><thead><tr><th width="375">Command</th><th>Description</th></tr></thead><tbody><tr><td><code>cantod keys list</code></td><td>Lists the names of keys created on your machine</td></tr><tr><td><code>cantod tendermint show-node-id</code></td><td>Shows your node ID</td></tr><tr><td><code>cantod keys show &#x3C;keyname> -a --bech val</code></td><td>Gets your valoper address</td></tr><tr><td><code>curl http://localhost:26657/status | jq .result.sync_info.catching_up</code></td><td>Checks if your node is catching up (query via the RPC, default port 26657) </td></tr><tr><td><code>query slashing signing-info $(cantod tendermint show-validator)</code></td><td>Checks if you are jailed or tombstoned</td></tr><tr><td><code>cantod query slashing signing-infos</code> </td><td>Shows blocks your node is missing</td></tr><tr><td><code>cantod tendermint show-address</code> </td><td>Shows your Tendermint consensus address for comparison to the list of validators missing blocks</td></tr></tbody></table>


# Snapshots

## Creating Snapshot

### Create folder for snapshots

```bash
mkdir -p $HOME/snapshots/canto
```

### Clone github repo

```bash
git clone https://github.com/SiddarthVijay/cosmos-snapshots.git
cd cosmos-snapshots
git checkout patch/v1-canto
```

### Create new snapshot

```bash
./canto_snapshot.sh
```

### Automation

You can add script to the cron

```sh
# start every day at 00:00
0 0 * * * /bin/bash -c '/root/canto_snapshot.sh'
```

***

## Consuming Snapshot

Snapshots also available on [Polkachu](https://polkachu.com/tendermint_snapshots/canto)

### Use Snapshot

Backup $HOME/.canto/priv\_validator\_state.json (cannot be recovered after following steps)

```bash
sudo systemctl stop cantod
cantod unsafe-reset-all
cd $HOME/.cantod
wget -O <snapshot_file>.tar <host_url>
tar -xvf <snapshot_file>.tar 
```

### Restart Node

```bash
sudo systemctl start cantod
# Watch logs
journalctl -u cantod -f
```

***


# FAQ

This page contains frequently asked questions, common errors and their solutions, as well as tips for troubleshooting.

## General

### Is there an active validator set?

Yes, Canto has an active validator set consisting of the 100 largest validators sorted by total stake (including self-delegated tokens).

Only validators in the active set are subject to slashing and earn staking rewards.

### How do I join the active validator set?

After sending the `create-validator` transaction, your validator will be automatically added to the active set if/when it has sufficient total stake to be in the top 100 validators.

If your validator was previously in the active set and has been jailed, use the `cantod tx slashing unjail` command to rejoin the active set.

### **Why is my validator not in the active set, with the `unbonding` status?**

For newly-created validators, there is some delay before showing up in the active set.

## Security

### **What ports should I open?**

Unless you intend to run a public seed node, you should **keep all ports closed**. If you leave all incoming ports closed, you will still be able to initiate a connection, but others will not be able to initiate a connection with you.

### **How do I run a public seed node?**

For those looking to run a public seed node, we recommend a [sentry node architecture](https://forum.cosmos.network/t/sentry-node-architecture-overview/454). This involves closing all ports on the validator and only exposing it to three sentry nodes which are in turn exposed to the internet.

## Other

### Can I use Docker?

Yes, you can use Docker. You can use a package like [Cosmos Omnibus](https://github.com/ovrclk/cosmos-omnibus).

## IBC Denom  Reference

```
ibc/641AA23673D8C7B9D93DF95FCA9E94C374AB1651FC066B976927915A5DEEFD28 - usdc

ibc/71CCCF108C28852D85E5127DD2C6092DBB9F7C786C24E6E462AD901F694ABFDA - Tether

ibc/9117A26BA81E29FA4F78F57DC2BD90CD3D26848101BA880445F119B22A1E254E - Atom 

ibc/CFA1D6C76182040F6B846AE2EF82DB7F8E0879E30CDFD6BFCAF699D29955E47F - Grav

ibc/05AA106DCCDE3E51C3C0694B348A8815D7F4906C968650A765EB2296D912C39F - WETH
```


# Troubleshooting

## Common Errors and Solutions

Here are a list of common errors when launching a node and their recommended solutions:

<table><thead><tr><th width="417">Error Description</th><th>Recommended Solution(s)</th></tr></thead><tbody><tr><td>Default gas fails when staking</td><td>Use <code>--gas auto</code></td></tr><tr><td><code>Error: couldn't read GenesisDoc file: open /root/.cantod/config/genesis.json: no such file or directory</code></td><td><p>Put the <code>genesis.json</code> file in the specified location, such as:</p><p><code>sudo wget https://github.com/Canto-Network/Canto/raw/main/Mainnet/genesis.json -P/root/.cantod/config/</code></p></td></tr><tr><td><code>Error during handshake: error on replay: validator set is nil in genesis and still empty after InitChain</code></td><td>Local: Remove <code>datadir</code> and restart<br><br>Cloud: Start a new instance</td></tr><tr><td><code>Failed to execute message; message index: 0: failed to delegate; acanto is smaller than acanto: insufficient funds"</code></td><td>Decrease the amount to less than your total CANTO balance</td></tr><tr><td><code>Stopping peer for error</code></td><td>No action required</td></tr></tbody></table>

## Tip: Rebuild from Scratch

If you run into unexpected issues when launching your node, it's worth rebuilding from scratch prior to any troubleshooting efforts. Follow these steps:

1. Delete `addressbook.json` in the config
2. Remove all old peers
3. Update persistent peers and seeds to newly shared
4. Fetch the new genesis file
5. Ensure binary is up to date
6. Start your node

## Tip: Consult EVMOS Docs

If you get stuck with something that isn't explained here, a good place to look for more information about your issue is the EVMOS community and docs.


# Uptime

To maximize uptime, validators should set up a backup node. To prevent double signing, dedicated Tendermint node signers such as [tmkms](https://github.com/iqlusioninc/tmkms) or [horcrux](https://github.com/strangelove-ventures/horcrux) can be used.

> If you’re new to running a validator, it's recommended to start out with tmkms to get your feet wet then ultimately make the jump to horcrux after you have a better understanding of cosmos infrastructure.

## Monitoring Tools

A popular uptime monitoring tool for Tendermint chains like Canto is [TenderDuty](https://github.com/blockpane/tenderduty). To get started, follow these steps:

1. Install tenderduty per the [official docs](https://github.com/blockpane/tenderduty/blob/main/docs/install.md) based on your preference (Docker or systemd).
2. Edit `config.yml` based on your validator and preferences:
   * Name the chain "Canto"
   * Add chain ID (`canto_7700-1` for mainnet)
   * Add your valoper address (using `cantod keys show <keyname> -a --bech val`)
   * Get relevant API keys (Discord, Telegram, PagerDuty) and set your alert config
3. Finally, start the service per the docs.

An alternative monitoring tool is [PANIC](https://github.com/SimplyVC/panic).


# Slashing

Canto implements the [Cosmos SDK slashing module](https://docs.cosmos.network/master/modules/slashing/), which penalizes validators for downtime and consensus faults in various ways:

* **Slashing:** the validator loses a percentage of their stake
* **Jailing:** the validator is temporarily removed from the validator set
* **Tombstoning (infinite jailing):** the validator is irreversibly removed from the validator set

## Downtime Slashing

Downtime slashing occurs when a validator fails to sign 3000 consecutive blocks, which corresponds to approximately five hours of downtime.

As a penalty for downtime, validators are:

* slashed by **0.75%**
* jailed for 1800 seconds (30 minutes)

## **Consensus Fault Slashing**

Consensus fault slashing occurs when a validator commits any kind of consensus fault, intentionally or unintentionally.

As a penalty for consensus faults, validators are:

* slashed by **5%**
* **tombstoned** (infinitely jailed)

{% hint style="danger" %}
The most common consensus fault is double signing. Do not attempt to run two validators with the same private key.
{% endhint %}

### **Tombstoning**

Validators who commit a consensus fault are put in a tombstone state, which means they are irreversibly removed from the validator set and cannot rejoin.

In this case, the only resolution for the validator and its delegators is to unbond and delegate anew pursuant to the 21-day unbonding period.

A tombstoned validator operator may relaunch under a different key, but will have to build up their delegations from scratch.


# Archive Node

{% hint style="warning" %}
Syncing and operating a Canto archive node is a time-consuming process. For convenience, consider provisioning a dedicated archive node with [Ansybl](https://www.ansybl.io/).
{% endhint %}

You may wish to archive the entire history of the Canto blockchain in order to index it with a Graph node or to roll your own block explorer. This means spinning up an **archive node**.

Complete step-by-step instructions for launching an archive node are provided below. If you're already comfortable installing and upgrading `cantod`, see step four for archive-specific config details.

As of block 2,500,000, the full archive state of Canto uses approximately 600GB of storage.

## 1. Install Dependencies <a href="#install-dependencies" id="install-dependencies"></a>

Install dependencies (Ubuntu):

```shell
sudo snap install go --classic
sudo apt-get install git
sudo apt-get install gcc
sudo apt-get install make
```

## 2. Install `cantod` <a href="#install-cantod" id="install-cantod"></a>

Clone the official repo and install the v1.0.0 binary:

```shell
git clone https://github.com/Canto-Network/Canto.git
cd Canto
git checkout v1.0.0
make install
sudo mv $HOME/go/bin/cantod /usr/bin/
```

## 3. Initialize `cantod` <a href="#initialize-cantod" id="initialize-cantod"></a>

Initialize the node and download the genesis file:

```shell
cantod init <MONIKER> --chain-id canto_7700-1
cd ~/.cantod/config
rm genesis.json
wget https://github.com/Canto-Network/Canto/raw/genesis/Networks/Mainnet/genesis.json
```

## 4. Edit Config <a href="#edit-config" id="edit-config"></a>

As when setting up a validating node, you'll need to set a seed peer (or persistent peers) as well as minimum gas prices:

```shell
# Add seed peer to config.toml
sed -i 's/seeds = ""/seeds = "ade4d8bc8cbe014af6ebdf3cb7b1e9ad36f412c0@seeds.polkachu.com:15556"/g' $HOME/.cantod/config/config.toml

# Set minimum gas price in app.toml
sed -i 's/minimum-gas-prices = "0acanto"/minimum-gas-prices = "0.0001acanto"/g' $HOME/.cantod/config/app.toml
```

**For an archive node specifically, the most important config setting is the pruning setting, which should be set to `nothing`:**

```shell
# Set pruning in app.toml
sed -i 's/pruning = "default"/pruning = "nothing"/g' $HOME/.cantod/config/app.toml
```

## 5. Create `systemd` Service <a href="#create-systemd-service" id="create-systemd-service"></a>

Create the `systemd` service file:

```shell
sudo nano /etc/systemd/system/cantod.service
```

Copy and paste the following configuration and save:

```shell
[Unit]
Description=Canto Node
After=network.target

[Service]
Type=simple
User=root
WorkingDirectory=/root/
ExecStart=/usr/bin/cantod start --trace --log_level info --json-rpc.api eth,txpool,personal,net,debug,web3 --api.enable
Restart=on-failure
StartLimitInterval=0
RestartSec=3
LimitNOFILE=65535
LimitMEMLOCK=209715200

[Install]
WantedBy=multi-user.target
```

## 6. Start the Node <a href="#start-node" id="start-node"></a>

```shell
# Reload service files
sudo systemctl daemon-reload

# Create the symlink
sudo systemctl enable cantod.service

# Start the node
sudo systemctl start cantod

# Show logs
journalctl -u cantod -f
```

If your node has issues connecting to the seed peer, you can [manually download an address book](https://polkachu.com/addrbooks/canto).

## 7. Update Binary <a href="#update-binary" id="update-binary"></a>

State breaking software upgrades took place at blocks:

* 218225 (v2.0.0)
* 1231500 (v3.0.0)
* 1274863 (v4.0.0)
* 2669495 (v5.0.0)
* 5144100 (v6.0.0)
* 6055770 (v7.0.0)

{% hint style="warning" %}
**Important**: v2.0.0 may cause AppHash errors at blocks that contained governance proposals (e.g. 804212). To avoid this, build from the `thomas/archive-patch` branch instead.
{% endhint %}

Upon reaching these blocks while syncing an archive node, the node will halt and throw an error every time it restarts until you update the binary. To do so, follow these steps:

```shell
# Stop cantod
sudo systemctl stop cantod

# Delete old binary from path and install new binary (run in /Canto/ folder)
git checkout thomas/archive-patch # Replace "thomas/archive-patch" with v3/4/5.0.0 as needed
sudo rm /usr/bin/cantod
make install
sudo mv $HOME/go/bin/cantod /usr/bin/

# Restart
sudo systemctl start cantod
```

For future binary upgrades, you will need to `git pull` to fetch the updated binary before you attempt to install it.


# Graph Node (Subgraphs)

{% hint style="info" %}
This page is a work in progress. Contributions are welcome on the [GitHub repo](https://github.com/Canto-Network/docs).
{% endhint %}

You can index historical activity on the Canto network by running a local Graph node, which custom subgraphs can be deployed to. This page contains instructions for doing so.

## Prerequisites

In order to spin up a Graph node, you will need access to a Canto node with historical data. The recommended approach is to sync your own [archive node](/canto-node/archive-node) first.

You'll also need to install Docker and Docker Compose on the machine you'll use to run the Graph node.

## Graph Node Setup

To set up the Graph node itself, start by cloning the default Graph repository:

```shell
git clone https://github.com/graphprotocol/graph-node/
```

If the Canto node you are using to sync is running on a different machine, change the RPC URL for the `ethereum` network in `graph-node/docker/docker-compose.yml`. Otherwise, the default value should work.

It is not necessary to change the name of the network, and doing so may require you to make additional config changes elsewhere.

Then run the setup file in `graph-node/docker` and start the node:

<pre class="language-shell"><code class="lang-shell"><strong># Run setup
</strong><strong>./setup.sh
</strong>
# Start Graph node
docker-compose up
</code></pre>

Optionally, use the `--detach` flag to start the Graph node in the background.

## Deploying Subgraphs

To deploy subgraphs to a Graph node, you'll need to create a subgraph specification consisting of both `subgraph.yaml` and `schema.graphql` files. Detailed information on creating subgraphs is available within [The Graph's documentation](https://thegraph.com/docs/en/developing/creating-a-subgraph/).

For contracts implementing common token standards like ERC20, ERC721, or ERC1155, you can use the [OpenZeppelin Subgraphs module](https://docs.openzeppelin.com/subgraphs/0.1.x/) to automatically generate a subgraph specification.

After compiling the specification files, run the following commands to create and deploy the subgraph:

```shell
# Create the subgraph
graph create generated/sample --node http://127.0.0.1:8020

# Deploy the subgraph
graph deploy --ipfs http://localhost:5001 --node http://localhost:8020 generated/sample ./generated/sample.subgraph.yaml
```

By default, Graph nodes host a GraphiQL user interface for each subgraph, which can be accessed at `http://localhost:8000/subgraphs/name/generated/sample`.

{% hint style="info" %}
These instructions are based on [a guide](https://medium.com/coinmonks/deploy-subgraphs-to-any-evm-aaaccc3559f) by Leon Do.
{% endhint %}


# Application Specific Dollar

[Application Specific Dollar](/neofinance/application-specific-dollar) is a Canto-native protocol that allows teams to earn yield on user deposits by deploying white-label stablecoins backed by [NOTE](https://docs.canto.io/free-public-infrastructure-fpi/note). asD V2 consists of the following contracts:

* [`asdOFT`](/technical-reference/application-specific-dollar/asdoft) – an asD token. Each asD instance exists as a deployment of this contract.
* [`asdRouter`](/technical-reference/application-specific-dollar/asdrouter) – enables asD tokens to be minted from other chains with USDC deposits.
* [`asdUSDC`](/technical-reference/application-specific-dollar/asdusdc) – a wrapper for whitelisted representations of USDC.

## Getting Started

To create an asD token, [deploy the `asdOFT` contract](/technical-reference/application-specific-dollar/asdoft#deployment) using your development tool of choice.

To enable bridging of an asD token to other networks:

* Deploy a [generic OFT](https://github.com/Plex-Engineer/ASD-V2/blob/main/contracts/asd/OFT.sol) on each network you wish to support.
* [Call `setPeer` on all OFT deployments](https://docs.layerzero.network/v2/developers/evm/oft/quickstart#setting-trusted-peers) (including the asD token on Canto) to link them.

### Minting

To mint an asD token, call the [mint](/technical-reference/application-specific-dollar/asdoft#mint) method on the asD token contract.

To mint by depositing USDC from another network, first obtain a whitelisted USDC OFT on the origin network (by wrapping or swapping). Then call the [LayerZero `send` method](https://docs.layerzero.network/v2/developers/evm/oft/composing#sending-token) on the OFT passing the [`composeMsg` paramater](/technical-reference/application-specific-dollar/asdrouter#minting).

The `asdRouter` contract handles swapping USDC for NOTE, minting the asD token, and bridging it back to the specified network and address.

### Withdrawals

To retrieve an asD token's underlying NOTE, call the [burn](/technical-reference/application-specific-dollar/asdoft#burn) method on the asD token contract.

If the token was minted with a USDC deposit, the withdrawal must be made manually:

1. If necessary, bridge the asD OFT back to Canto.
2. Unwrap ([burn](/technical-reference/application-specific-dollar/asdoft#burn)) the asD token to retrieve the underlying NOTE.
3. Swap the NOTE for USDC.
4. Bridge USDC back to the origin chain.


# asdOFT

[`asdOFT`](https://github.com/Plex-Engineer/ASD-V2/blob/main/contracts/asd/asdOFT.sol) is the standard contract for all asD tokens. It utilizes LayerZero's Omnichain Fungible Token (OFT) standard to enable bridging across supported networks.

## Deployment

In order to deploy an asD token, simply deploy a new instance of `asdOFT` on Canto. In the constructor, specify:

* `_name` – the name of your asD token
* `_symbol` – the symbol of your asD token
* `_lzEndpoint` – the contract address for the LayerZero endpoint on Canto, i.e. `0x1a44076050125825900e736c501f859c50fe728c`
* `_cNote` – the contract address for [cNOTE](/neofinance/overview#cnote) i.e. `0xEe602429Ef7eCe0a13e4FfE8dBC16e101049504C`
* `_csrRecipient` – the address to register for [Contract Secured Revenue](/evm-development/contract-secured-revenue) e.g. your wallet

## Methods

### `mint`

The `mint(uint256 _amount)` method allows users to permisionlessly mint an asD token by depositing NOTE, which is automatically supplied to the Canto Lending Market.

Before calling this method, a user must first approve the contract to spend their NOTE.

### `burn`

The `burn(uint256 _amount)` method allows holders of an asD token to burn the asD token, thereby withdrawing the underlying NOTE from the Canto Lending Market and returning it to the user.

### `withdrawCarry`

The `withdrawCarry(uint256 _amount)` method allows the owner of an asD token to withdraw carry (accrued interest) earned on NOTE backing that has been supplied to the Canto Lending Market. It ensures that a 1:1 NOTE:asD exchange rate is maintained after withdrawal.


# asdRouter

[`asdRouter`](https://github.com/Plex-Engineer/ASD-V2/blob/main/contracts/asd/asdRouter.sol) enables asD tokens to be minted from other chains with USDC deposits. Its only public method, `lzCompose`, is called by the LayerZero executor when minting is initiated by a user on another network.

<figure><img src="/files/Q0ACR4VKqsfoaI3xARWf" alt=""><figcaption></figcaption></figure>

## Minting

To mint asD tokens from another network, a user should first obtain a whitelisted USDC OFT on the origin network (by wrapping or swapping). Then call the [LayerZero `send` method](https://docs.layerzero.network/v2/developers/evm/oft/composing#sending-token) on the OFT passing the following struct (encoded as bytes) in the [`composeMsg` parameter](/technical-reference/application-specific-dollar/asdrouter#minting):

```solidity
struct OftComposeMessage {
    uint32 _dstLzEid; // destination endpoint id
    address _dstReceiver; // receiver on destination
    address _dstAsdAddress; // asD address on destination
    address _cantoAsdAddress; // asD on Canto (where to mint asD from)
    uint256 _minAmountASD; // minimum amount (slippage for swap)
    address _cantoRefundAddress; // canto refund address
    uint256 _feeForSend; // fee for bridge to destination chain
}
```

## Methods

### `lzCompose`

The `lzCompose(...)` method is called by the LayerZero executor when minting is initiated on another network. The calldata for this method is determined by the `composeMsg` parameter sent on the origin chain when USDC is sent, as described above.

This method:

1. Wraps bridged USDC as asdUSDC
2. Swaps asdUSDC for NOTE on Ambient
3. Mints the specified asD token on Canto
4. Sends the asD token to the destination chain and address


# asdUSDC

[`asdUSDC` ](https://github.com/Plex-Engineer/ASD-V2/blob/main/contracts/asd/asdUSDC.sol)is a wrapper contract for whitelisted representations of USDC. This enables compatibility with various representations of USDC, such as USDC.e.

Users do not need to interact with the asdUDC contract directly when depositing USDC into an asD token from another chain, as wrapping is performed by the asdRouter.

## Methods

### **`deposit`**

The `deposit(address _usdcVersion, uint256 _amount)` method allows users to wrap whitelisted USDC tokens, minting asdUSDC to their address.

Before calling this method, a user must approve the contract to spend their USDC.

### **`withdraw`**

The `withdraw(address _usdcVersion, uint256 _amount)` method enables users to unwrap asdUSDC, burning tokens to receive the specified USDC token.

### **`recover`**

The `recover(address _usdcVersion)` method is used to recover USDC that was sent to the contract by mistake, minting asdUSDC to the user. Optionally, this asdUSDC can then be withdrawn.


# Liquidity Coordinator

Liquidity Coordinator, formerly Neofinance Coordinator, is a minimal protocol which incentivizes providing liquidity to Canto neofinance primitives.

Rewards are sourced from network governance in the form of CANTO and distributed according to a vote locking mechanism to the following liquidity providers:

* Suppliers of [cNOTE](/neofinance/overview#cnote) on third-party lending markets (such as [Vivacity Finance](https://vivacity.finance/))
* LPs of TOKEN/WCANTO pairs on the [Canto DEX](/free-public-infrastructure/dex)&#x20;

## Architecture <a href="#architecture" id="architecture"></a>

Liquidity Coordinator consists of four smart contracts:

### [`VotingEscrow`](/technical-reference/liquidity-coordinator/votingescrow) <a href="#votingescrow" id="votingescrow"></a>

Allows users (typically protocols) to lock CANTO for a fixed 5-year period. In exchange for locking, users receive veCANTO which provides gauge voting rights.

{% embed url="<https://oklink.com/canto/address/0x2fed02d6d50a8786D53F308024400fDAD275F57C>" %}
Mainnet deployment
{% endembed %}

### [`GaugeController`](#gaugecontroller) <a href="#gaugecontroller" id="gaugecontroller"></a>

Allows lockers to vote on gauges, which represent LP tokens on the Canto DEX and/or cNOTE deposits on third-party lending markets. Voting takes place during one week epochs.

Incentives are weighted by gauge types (as determined by governance) and subsequently allocated proportionally to votes.

{% embed url="<https://oklink.com/canto/address/0x46970b45d114420A71A3d76AA6c398173118C2b8>" %}
Mainnet deployment
{% endembed %}

### [`LendingLedger`](#lendingledger) <a href="#lendingledger" id="lendingledger"></a>

Holds incentives received from Canto governance and continuously tracks balances of eligible LP tokens and cNOTE deposits, allowing liquidity providers to claim incentives proportionally to their balance at a given epoch.

Additionally, implements a view third-party lending markets can use to distribute secondary token rewards.

{% embed url="<https://www.oklink.com/canto/address/0x831f746d3b0137b0f3311013e95842cf60fa44ed>" %}
Mainnet deployment
{% endembed %}

### [`LiquidityGauge`](https://docs.canto.io/technical-reference/neofinance-coordinator/liquiditygauge)

Wraps LP tokens 1:1 to ensure balances can be tracked by `LendingLedger`.


# VotingEscrow

Users create and control locks on the [`VotingEscrow`](https://oklink.com/canto/address/0x2fed02d6d50a8786D53F308024400fDAD275F57C) contract. A user may only have one lock at any given time. Adding to a lock resets the 5-year lock period.

The code samples below demonstrate how to manage locks using ethers.js or foundry. You can also manage locks using a block explorer like [oklink.com/canto](https://github.com/Canto-Network/docs/blob/main/technical-reference/neofinance-coordinator/oklink.com/canto/README.md).

### Creating a Lock <a href="#creating-a-lock" id="creating-a-lock"></a>

To create a lock, call the `createLock(uint256 _value)` payable method. The call value and `_value` parameter must match.

**ethers.js**

```
amount = ethers.utils.parseEther("100") // 100 CANTO
await VotingEscrow.createLock(amount, { value: amount })
```

**foundry**

```
cast send --ledger 0x... "createLock(uint256)" 100 --value 100ether
```

#### Adding to a Lock <a href="#adding-to-a-lock" id="adding-to-a-lock"></a>

To add to your existing lock, call the `increaseAmount(uint256 _value)` payable method. The call value and `_value` parameter must match.

**ethers.js**

```
amount = ethers.utils.parseEther("100") // 100 CANTO
await VotingEscrow.increaseAmount(amount, { value: amount })
```

**foundry**

```
cast send --ledger 0x... "increaseAmount(uint256)" 100 --value 100ether
```

### Reading Voting Power <a href="#reading-voting-power" id="reading-voting-power"></a>

To read voting power, call the `balanceOf(address _owner)` view.

**ethers.js**

```
const votingPower = await VotingEscrow.balanceOf("0x...")
```

**foundry**

```
cast call 0x... "balanceOf(address)" 0x...
```

### Withdrawing <a href="#withdrawing" id="withdrawing"></a>

To withdraw a completed lock, call the `withdraw()` method.

**ethers.js**

```
await VotingEscrow.withdraw()
```

**foundry**

```
cast send --ledger 0x... "withdaw()"
```


# GaugeController

Lockers vote on gauges using the [`GaugeController`](https://oklink.com/canto/address/0x46970b45d114420A71A3d76AA6c398173118C2b8) contract. Gauges represent LP tokens on the Canto DEX and/or cNOTE deposits on third-party lending markets.&#x20;

Voting takes place during one week epochs.

### Voting <a href="#voting" id="voting"></a>

To vote for a gauge, call the `vote_for_gauge_weights(address _gauge_addr, uint256 _user_weight)` method. The `_gauge_addr` parameter is the address of a whitelisted gauge and `_user_weight` is the voting weight in bps (basis points).

**ethers.js**

```
await GaugeController.vote_for_gauge_weights(0x..., 10000) // 10,000 bps = 100%
```

**foundry**

```
cast send --ledger 0x... "vote_for_gauge_weights(address,uint256)" 0x... 10000
```

### Removing/Changing Votes <a href="#removingchanging-votes" id="removingchanging-votes"></a>

To remove or change votes cast in the current epoch, call the `vote_for_gauge_weights(address _gauge_addr, uint256 _user_weight)` method specifying a new weight (e.g. 0 bps).


# LendingLedger

LP tokens on the Canto DEX and cNOTE deposits on third-party lending markets are continuously tracked by [`LendingLedger`](https://oklink.com/canto/address/0x85156B45B3C0F40f724637ebfEB035aFB29BD083).

* In the case of cNOTE deposits, third-party lending markets call `sync_ledger` every time a user deposits or withdraws cNOTE.
* In the case of LP tokens, tokens should be wrapped in a [`LiquidityGauge`](https://docs.canto.io/technical-reference/neofinance-coordinator/liquiditygauge), which calls `sync_ledger` in the `_afterTokenTransfer` hook.

Additionally, users claim incentives from `LendingLedger`.

### Syncing Ledger <a href="#syncing-ledger" id="syncing-ledger"></a>

To sync the ledger, call the `sync_ledger(address _lender, int256 _delta)` method. The address is that of the user (liquidity provider) and the int256 is the amount of tokens deposited/received (positive) or withdrawn/sent (negative) with 18 decimal places of precision.

**Important:** The `sync_ledger` method reverts if the caller is not a whitelisted lending market or `LiquidityGauge`. As a result, lending markets integrating Liquidity Coordinator should wrap this method in a try-catch block to ensure liquidity providers can still deposit/withdraw if their market is removed from the whitelist.

**ethers.js**

```
await LendingLedger.sync_ledger(0x..., 10000000000000000000) // 10 cNOTE deposit
```

**foundry**

```
cast send --ledger 0x... "sync_ledger(address,int256)" 0x... 10000000000000000000
```

### Claiming <a href="#claiming" id="claiming"></a>

To claim incentives, call the `claim(address _market)` method. Previously, incentives could only be claimed for past epochs; however, incentives are now claimed for all epochs including partial incentives for the current epoch.

**ethers.js**

```
await LendingLedger.claim(0x...) // Claim all incentives
```

**foundry**

```
cast send --ledger 0x... "claim(address)" 0x...
```

### Secondary Rewards

Third-party protocols can use `LendingLedger`'s deposit tracking to implement secondary token rewards, e.g. lending market governance tokens.

Within the`userInfo` mapping, lending market addresses map to user addresses, which in turn map to `UserInfo` structs. `UserInfo.secRewardDebt` is the amount of secondary rewards the user is entitled to.


# LiquidityGauge

When an LP token is whitelisted on `LendingLedger`, a `LiquidityGauge` wrapper is automatically created. This simple wrapper calls `sync_ledger` in the `_afterTokenTransfer` hook to ensure eligible LP positions are continuously tracked by the protocol.

### Depositing <a href="#claiming" id="claiming"></a>

To deposit LP tokens into a wrapper, call the `depositUnderlying(uint256 _amount)` method. The wrapper must be approved to spend the underlying token.

**ethers.js**

```
await LiquidityGauge.depositUnderlying(10000000000000000000) // Deposit 10 LP tokens
```

**foundry**

```
cast send --ledger 0x... "depositUnderlying(uint256)" 10000000000000000000
```

### Withdrawing <a href="#claiming" id="claiming"></a>

To withdraw LP tokens from a wrapper, call the `withdrawUnderlying(uint256 _amount)` method.

**ethers.js**

```
await LiquidityGauge.withdrawUnderlying(10000000000000000000) // Withdraw 10 LP tokens
```

**foundry**

```
cast send --ledger 0x... "withdrawUnderlying(uint256)" 10000000000000000000
```


# Architecture & Design

The Canto network is a sovereign chain built using the [Cosmos SDK](https://docs.cosmos.network/main/intro/overview.html) and custom modules. Cosmos SDK chains can be scaffolded, built and interacted with using the [Ignite CLI.](https://docs.ignite.com/)&#x20;

Canto is EVM-enabled, utilizing a module called [Ethermint](https://github.com/tharsis/ethermint/tree/main/x) which deploys an EVM execution environment enabling Solidity code to be deployed directly from the Ethereum network. Canto enables a native bridge between CosmWasm tokens and ERC-20 standard tokens using the [ERC-20 module](https://github.com/tharsis/evmos/blob/main/x/erc20/spec/README.md).

This is it how it works:

1. The `x/erc20`module maintains a canonical one-to-one mapping of native Cosmos Coin denomination to ERC20 Token contract addresses (i.e `sdk.Coin`  ←→ ERC20), called `TokenPair.` The conversion of the ERC20 tokens ←→ Coin of a given pair can be enabled or disabled via governance.
2. A native Cosmos Coin corresponds to an `sdk.Coin` that is native to the [bank module](https://docs.cosmos.network/master/modules/bank/) (which controls account balances and token supply in Cosmos SDK). It can be either the native staking/gas denomination (eg: EVMOS, ATOM, etc) or an IBC fungible token voucher (i.e with denom format of `ibc/{hash}`). When a proposal is initiated for an existing native Cosmos Coin, the erc20 module will deploy a factory ERC20 contract, representing the ERC20 token for the token pair, giving the module ownership of that contract.
3. During the registration of a Cosmos Coin the following bank `Metadata` is used to deploy a ERC20 contract:
4. Holders of native Cosmos coins and IBC vouchers on the Canto chain can convert their Coin into ERC20 Tokens, which can then be used in the ethermint EVM, by creating a[`ConvertCoin`Tx](https://github.com/tharsis/evmos/blob/main/x/erc20/spec/04_transactions.md). Vice versa, the [`ConvertERC20`Tx](https://github.com/tharsis/evmos/blob/main/x/erc20/spec/04_transactions.md) allows holders of ERC20 tokens on the Canto chain to convert ERC-20 tokens back to their native Cosmos Coin representation.
5. The [EVM hooks](https://github.com/tharsis/evmos/blob/main/x/erc20/spec/05_hooks.md) allows users to convert ERC20s to Cosmos Coins by sending an Ethereum tx transfer to the module account address. This enables native conversion of tokens via Metamask and EVM-enabled wallets for both token pairs that have been registered through a native Cosmos coin or an ERC20 token.

To learn more about the Ethermint module, click [here](https://github.com/evmos/ethermint) (Credit to Tharsis).


# Onboarding Module

The `x/onboarding` module is a custom Canto module that automatically swaps a small amount of bridged IBC tokens for CANTO, and converts the remaining IBC tokens into their corresponding ERC20 tokens on the Canto EVM.

It was proposed in [CPIP-002](https://github.com/Canto-Network/CIPs/blob/main/CPIPS/CPIP-002.md) in order to improve the Canto onboarding UX from Ethereum, and later implemented in [Canto v7.0.0](https://app.canto.io/governance/proposal/113).

### Overview

The `x/onboarding` module consists of two components, which are both executed in the `Keeper.OnRecvPacket` callback:

* The **swap** component checks the recipient's CANTO balance on the Canto EVM, and automatically swaps a a small amount of bridged IBC tokens for CANTO if it is below the governance-controlled threshold (`AutoSwapThreshold`).
* The **convert** component automatically converts the remaining bridged IBC tokens into their corresponding ERC20 tokens on the Canto EVM.

The behavior of the module is non-atomic, meaning that IBC transfers are still processed even if one or both of the components fail.

### Swap

The swap component is a fork of IRISNET's [Coinswap module v1.6](https://github.com/irisnet/irismod/tree/v1.6.0/modules/coinswap), an AMM. Changes in the forked implementation include:

* Only token pairs on the whitelist can be created as a pool.
  * Pool creation fails if the token pair is not on the whitelist.
  * Initial whitelist: `Canto/USDC.grv`, `Canto/USDT.grv`, `Canto/ETH.grv`
* There is a limit on the number of CANTO tokens for each pool.
  * Deposits will fail if the amount of CANTO for the pool exceeds 10,000 Canto.
* Double swaps are disabled.

For risk management purposes, a swap will fail if the input coin amount exceeds a pre-defined limit (10 USDC, 10 USDT, 0.01 ETH) or if the swap amount limit is not defined.

### Convert

The convert component auto-converts the bridged IBC token into an ERC20 token on the Canto EVM, as in the [Evmos implementation](https://github.com/evmos/evmos/blob/fc612fc22846c00e7b8ae296215eea33cef09270/x/erc20/keeper/ibc_callbacks.go#L36) of this feature.

### Governance Parameters

The module has three parameters which are controlled by governance:

* **`EnableOnboarding`:** Enables or disables the module (default value: `true`)
* **`AutoSwapThreshold`:** The threshold balance of CANTO below which the swap component is triggered (default value: `4 canto`)
* **`WhitelistedChannels`:** The list of IBC channels the module is enabled for. (default value: `["channel-0"]` – Gravity Bridge)


# Gravity Bridge

Canto utilizes Gravity Bridge as its bridge provider and has fully integrated Gravity into the Canto native UI for a seamless user experience. The audit report can be viewed on [Code4rena](https://code4rena.com/reports/2021-08-gravitybridge).

For step-by-step directions on bridging assets to Canto, see [Getting Started](/user-guides/connecting-to-canto#bridging-assets-to-canto).

## What is Gravity Bridge?

Gravity Bridge is a trustless, neutral bridge between the Ethereum and Cosmos ecosystems built using the Cosmos SDK.&#x20;

Gravity Bridge operates similarly to how many cross-chain bridges work, i.e. locking up a native tokens on one side of the bridge and minting a representation of that token on the other, with a critical difference: Gravity Bridge uses the validator set to sign transactions instead of a multi-sig or permissioned set of actors. \
\
The Gravity Bridge has two components. A Solidity contract on Ethereum (Gravity.sol) and a CosmosSDK module on the Gravity Bridge blockchain.

### Gravity.sol

Gravity.sol is the Solidity contract that holds funds for Gravity Bridge on Ethereum. In contrast to the prevailing trend in other bridge designs, **Gravity.sol** a mere 580 lines of code, compact, and easy to review. It has been audited by three independent teams (Certik, Least Authority, and Code4rena) and it is not upgradable. It does not contain any trusted parties, of any kind.

Gravity.sol is fully controlled by the validators of the Gravity Bridge blockchain in proportion to their stake. This means that the security and decentralization of the bridge is the same as the Gravity Bridge blockchain itself.

For more details on Gravity Bridge, visit: [gravitybridge.net.](https://gravitybridge.net)


# NOTE Design

Since Note cannot be created, only borrowed, and the Supply rate is the same as the Borrow rate, a new mechanism was necessary to keep track of how much of the interest paid by to borrow Note goes to the Accountant (and ultimately the Community Treasury) versus how much is paid to external suppliers of Note.

This is achieved by supplying and redeeming liquidity during every action taken by an external user of cNote, using an additional call implemented in the mintFresh/redeemFresh, borrowFresh/repayBorrowFresh internal methods in CToken.sol:

1. When users **borrow Note or redeem cNote**, the function in CNote will call another function in the Accountant to supply cNote in the exact amount required to offset the request.
2. When Users supply or repay Note to the market, the function in CNote will call another function in Accountant to redeem exactly the same amount of Note from the market.

As a result, there is never any Note present in the CNote market other than during function calls, but there is an infinite amount of Note that can be borrowed or redeemed.

This also prevents supply inflation, as idle Note in the lending market pool would otherwise earn interest despite not being lent out.

It is important to note that the internal price in the lending market used to calculate liquidity for Note is always set to 1 USD regardless of the value of Note in the DEX.

### Architecture diagram

Our implementation of Note’s architecture is described below:

![](/files/XjyQQ9gpIpjz0fmUIcXA)


# Canto Lending Protocol

Canto’s Lending Protocol is deployed on the network's native EVM (Ethermint) and is based on [Compound Protocol](https://compound.finance/) v2. The main differences between Canto Lending and Compound are:

1. There is no Canto Lending specific token. ([Comp is Compound's ERC-20 token](https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/Comp.sol).) Instead, Canto’s ERC20 network token is used as the incentive token on Canto Lending. [Comptroller](https://github.com/compound-finance/compound-protocol/blob/master/contracts/ComptrollerG7.sol) smart contract gives out the token rewards. This file is modified to instead give out Canto rewards.
2. Governance on Canto Lending is controlled by Canto network validators rather than the Decentralized Application. Here is how it works:
   * Proposals are initiated on the Network side (Cosmos runtime) and voted on by network Validators as specified in the [SDK governance module](https://docs.cosmos.network/master/modules/gov/). The lending protocol governance has a specified proposal type that is custom to Canto and exactly matches Compound's proposal type.
   * After the proposal is approved, Canto's custom UniGov then sends the proposal type to the EVM module where it can be retrieved by a smart contract call to a specific address (”oracle address”).
   * When the proposal is retrieved, it is stored in the queue and then executed in the same manner as traditional governance outlined in [Compound's Governor Bravo](https://github.com/compound-finance/compound-protocol/blob/master/contracts/Governance/GovernorBravoDelegateG2.sol) after a proposal is approved.

Since the Canto Lending Protocol is closely based on Compound, you can find more information about its architecture in the [Compound Protocol documentation](https://github.com/compound-finance/compound-protocol/blob/master/README.md).


# IBC Token Recovery

IBC tokens from Cosmos SDK chains such as ATOM, GRAV, and OSMO can only be bridged to the Canto EVM if they were transferred to Canto from their native chain. While the [**app.canto.io**](https://app.canto.io/bridge) frontend ensures this, *manual* IBC transfers may result in these and other unsupported tokens being sent to Canto.

To retrieve these assets, use the IBC token recovery tool:

<figure><img src="/files/iA32Ggz2yhKJJWpYKIH9" alt=""><figcaption></figcaption></figure>

1. Navigate to [**app.canto.io/bridge**](https://app.canto.io/bridge) and select the `recovery` tab. **This tab will only be visible if the connected wallet contains assets not supported by the Canto EVM.**
2. Click the `recover` button next to the asset you would like to retrieve. Optionally, users can override which network the asset will be sent to, although this is not advised.
3. In the modal that appears, enter your address on the receiving network and click `confirm`:

<figure><img src="/files/jPJ4Y1hlTeeXKNQhqC1M" alt=""><figcaption></figcaption></figure>


# Governance

Canto introduces a new paradigm for governance called **unified governance** where governance of both the network itself *and* Free Public Infrastructure applications is controlled by network token stakeholders.

At launch, this means that Canto stakers can participate in governance of the Canto Lending Market, the Canto DEX, and the network itself. Any new primitives built under the Free Public Infrastructure model will also leverage unified governance as appropriate.

## Overview

Canto governance is based on the Cosmos SDK `x/gov` module with the addition of a custom-built module, `x/govshuttle`. The GovShuttle module is responsible for pushing passed proposal data from the governance module to a storage smart contract in the Canto EVM so that it can be read by DApps.


# Governance Module

Canto's on-chain governance system leverages the Cosmos SDK `x/gov` module. In this system, CANTO stakers can vote on proposals with votes weighted proportionally to their stake.

The module supports the following basic features:

* **Proposal submission:** Users submit governance proposals with a deposit. Once the minimum deposit is reached, the proposal enters voting.
* **Voting:** Participants can vote on proposals that reached MinDeposit.
* **Inheritance and penalties:** Delegators inherit their validator's vote if they don't vote themselves.
* **Claiming deposit:** Users that deposited on proposals can recover their deposits if the proposal was accepted OR if the proposal never entered the voting period.

## Proposal submission <a href="#proposal-submission" id="proposal-submission"></a>

Every account can submit proposals by sending a `MsgSubmitProposal` transaction through a [Canto node](/canto-node/validators). Once a proposal is submitted, it is identified by its unique `proposalID`.

### Proposal Messages <a href="#proposal-messages" id="proposal-messages"></a>

A proposal includes an `sdk.Msg` array, which is executed automatically if the proposal passes. Messages are executed by the governance `ModuleAccount` itself. Modules such as `x/upgrade`, that want to allow certain messages to be executed by governance only should add a whitelist within the respective msg server, granting the governance module the right to execute the message once a quorum has been reached. The governance module uses the `MsgServiceRouter` to check that these messages are correctly constructed and have a respective path to execute on but does not perform a full validity check.

## Deposit <a href="#deposit" id="deposit"></a>

To prevent spam, proposals must be submitted with a deposit in the cryptocurrency defined by the `MinDeposit` param.

When a proposal is submitted, it has to be accompanied with a deposit that must be strictly positive, but can be inferior to `MinDeposit`. The submitter doesn't need to pay for the entire deposit on their own. The newly created proposal is stored in an *inactive proposal queue* and stays there until its deposit passes the `MinDeposit`. Other token holders can increase the proposal's deposit by sending a `Deposit` transaction. If a proposal doesn't pass the `MinDeposit` before the deposit end time (the time when deposits are no longer accepted), the proposal will be destroyed: the proposal will be removed from state and the deposit will be burned (see x/gov `EndBlocker`). When a proposal deposit passes the `MinDeposit` threshold (even during the proposal submission) before the deposit end time, the proposal will be moved into the *active proposal queue* and the voting period will begin.

The deposit is kept in escrow and held by the governance `ModuleAccount` until the proposal is finalized (passed or rejected).

### Deposit refund and burn <a href="#deposit-refund-and-burn" id="deposit-refund-and-burn"></a>

When a proposal is finalized, the coins from the deposit are either refunded or burned according to the final tally of the proposal:

* If the proposal is approved or rejected but *not* vetoed, each deposit will be automatically refunded to its respective depositor (transferred from the governance `ModuleAccount`).
* When the proposal is vetoed with greater than 33.4% of the votes, deposits will be burned from the governance `ModuleAccount` and the proposal information along with its deposit information will be removed from state.
* All refunded or burned deposits are removed from the state. Events are issued when burning or refunding a deposit.

## Voting <a href="#vote" id="vote"></a>

### Participants <a href="#participants" id="participants"></a>

*Participants* are users that have the right to vote on proposals. On Canto, participants are bonded CANTO holders. Unbonded CANTO holders and other users do not get the right to participate in governance. However, they can submit and deposit on proposals.

Note that some *participants* can be forbidden to vote on a proposal under a certain validator if:

* The *participant* bonded or unbonded CANTO to said validator after the proposal entered voting period.
* The *participant* became a validator after the proposal entered voting period.

This does not prevent *participants* from voting with CANTO bonded to other validators. For example, if a *participant* bonds some CANTO to Validator A before a proposal entered voting period, and bonds more CANTO to Validator B after a proposal entered voting period, only the vote bonded to Validator B will be forbidden.

### Voting period <a href="#voting-period" id="voting-period"></a>

Once a proposal reaches `MinDeposit`, it immediately enters `Voting period`. We define `Voting period` as the interval between the moment the vote opens and the moment the vote closes. `Voting period` should always be shorter than `Unbonding period` to prevent double voting. The initial value of `Voting period` is 1 hour.

### Option set <a href="#option-set" id="option-set"></a>

The option set of a proposal refers to the set of choices participants can choose from when casting their votes.

The initial option set includes the following options:

* `Yes`
* `No`
* `NoWithVeto`
* `Abstain`

`NoWithVeto` counts as `No` but also adds a `Veto` vote. The `Abstain` option allows voters to signal that they do not intend to vote for or against the proposal but will accept the result of the vote.

### Quorum <a href="#quorum" id="quorum"></a>

Quorum is defined as the minimum percentage of voting power that needs to be cast on a proposal for the result to be valid. At launch, quorum is set to 33.4%.

### Threshold <a href="#threshold" id="threshold"></a>

Threshold is the minimum proportion of `Yes` votes to total votes (excluding `Abstain` votes) required for a proposal to be accepted.

Initially, the threshold is set at 50%. A possibility to veto exists if more than 33.4% of all votes are `NoWithVeto` votes. Both of these values are derived from the `TallyParams` on-chain parameter, which is modifiable by governance. This means that proposals are accepted if:

* There exist bonded tokens.
* Quorum has been achieved.
* The proportion of `Abstain` votes is inferior to 100%, i.e. at least one `Yes`, `No`, or `NoWithVeto` vote was submitted one.
* The proportion of `NoWithVeto` votes to total votes (including`Abstain` votes) is inferior to 33.4%.
* The threshold is met.

### Inheritance <a href="#inheritance" id="inheritance"></a>

If a delegator does not vote, they will inherit their validator's vote.

* If a delegator votes before their validator, they will not inherit their validator's vote.
* If a delegator votes after thei validator, they will override their validator's vote with their own. If the proposal is urgent, it is possible that the vote will close before delegators have a chance to react and override their validator's vote. This is not a problem, as proposals require more than 66.6% of the total voting power to pass before the end of the voting period. Because as little as 33.4% + 1 validation power could collude to censor transactions, non-collusion is already assumed for ranges exceeding this threshold.

### Validator’s punishment for non-voting <a href="#validator-s-punishment-for-non-voting" id="validator-s-punishment-for-non-voting"></a>

At present, validators are not punished for failing to vote.

### Governance address <a href="#governance-address" id="governance-address"></a>

Later, the Canto network may introduce permissioned keys that can only sign txs from certain modules. For the MVP, the `Governance address` will be the main validator address generated at account creation. This address corresponds to a different PrivKey than the Tendermint PrivKey which is responsible for signing consensus messages. Validators thus do not have to sign governance transactions with the sensitive Tendermint PrivKey.

## Software Upgrades <a href="#software-upgrade" id="software-upgrade"></a>

If proposals are of type `SoftwareUpgradeProposal`, then nodes need to upgrade their software to the new version that was voted for. This process is divided into two steps, signal and switch.

### Signal <a href="#signal" id="signal"></a>

After a `SoftwareUpgradeProposal` is accepted, validators are expected to download and install the new version of the software while continuing to run the previous version. Once a validator has downloaded and installed the upgrade, it will start signaling to the network that it is ready to switch by including the proposal's `proposalID` in its *precommits*.

Note: There is only one signal slot per *precommit*. If several `SoftwareUpgradeProposals` are accepted in a short timeframe, a pipeline will form and they will be implemented one after the other in the order that they were accepted.

### Switch <a href="#switch" id="switch"></a>

Once a block contains more than 66.6% *precommits* where a common `SoftwareUpgradeProposal` is signaled, all the nodes (including validator nodes, non-validating full nodes and light-nodes) are expected to switch to the new version of the software.

More information can be found in the [Cosmos SDK documentation.](https://docs.cosmos.network/master/modules/gov/)


# GovShuttle Module

The [`x/govshuttle`](https://github.com/Canto-Network/Canto/tree/main/x/govshuttle) module is a custom-built governance module that enables network-level governance over applications deployed to the Canto EVM.

At the functional level, the module passes information from Canto governance proposals on the Cosmos SDK layer to an oracle address (the "Port") on the Canto EVM, which can be read and implemented by Free Public Infrastructure smart contracts.

{% hint style="info" %}
Port Address (mainnet): 0x648a5Aa0C4FbF2C1CF5a3B432c2766EeaF8E402d
{% endhint %}

## Overview

On initialization, the `x/govshuttle` keeper checks to see if the Port contract is deployed to the Canto EVM. If not, the keeper uses the `DeployMapContract` function to deploy the Port.

```go
if nonce == 0 {
	*k.mapContractAddr, err = k.DeployMapContract(ctx, lm)
	if err != nil {
		return nil, err
	}
	return lm, nil
}
```

Deployment of this contract utilizes the `Create` function in Geth. The resulting contract is wholly owned by the module itself and *cannot* be modified by any other account.&#x20;

After deployment of the Port, governance proposals of predefined types are automatically routed to `x/govshuttle`. Upon passing of a proposal, the module's keeper calls the `AppendProposal`  function, which uses Geth’s `Call` function to add the proposal’s data to the Port contract's storage.

```go
func handleLendingMarketProposal(ctx sdk.Context, k *keeper.Keeper, p *types.LendingMarketProposal) error {
	err := p.ValidateBasic()
	if err != nil {
		return err
	}
	_, err = k.AppendProposal(ctx, p) 
	if err != nil {
		return err
	}
	return nil
}
```

The proposal types routed to the module are [specified in the Canto binary](https://github.com/Canto-Network/Canto/blob/main/x/govshuttle/proposal_handler.go#L12). At the time of writing,  `LendingMarketProposal` and `TreasuryProposal` proposals are routed to the module.

### Reading Shuttled Data in EVM

Reading a proposal written to the Port is as simple as querying the contract using the `QueryProp` view. This function takes in a `propId` (proposal ID) as an argument and returns the corresponding proposal’s data.

#### Example (ethers.js)

<pre class="language-javascript"><code class="lang-javascript"><strong>const Port = new ethers.Contract(0x648a5Aa0C4FbF2C1CF5a3B432c2766EeaF8E402d, ABI, provider)
</strong><strong>const proposalData = await Port.QueryProp(50)
</strong>console.log(proposalData) // returns...

/*
[
  50n,
  'Governance Proposal to Update Comp Speeds in Canto Lending Market',
  'If successful, this governance proposal will update comp speeds in the Canto Lending Market for Canto/Note, Canto/Atom, Canto/Eth, Note/USDC, Note/USDT, USDC, and USDT as detailed in https://canto.mirror.xyz/-nSUAL6_YXbXxrQoZiAmlwDPi4s_RsJrX0H6_1iUzEM',
  Result(1) [ '0x5E23dC409Fc2F832f83CEc191E245A191a4bCc5C' ],
  Result(1) [ 0n ],
  Result(1) [ '_setCompSpeeds(address[],uint256[],uint256[])' ],
  Result(1) [
    '0x0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000002600000000000000000000000000000000000000000000000000000000000000007000000000000000000000000de59f060d7ee2b612e7360e6c1b97c4d8289ca2e0000000000000000000000006b46ba92d7e94ffa658698764f5b8dfd537315a9000000000000000000000000d6a97e43fc885a83e97d599796458a331e580800000000000000000000000000f0cd6b5ce8a01d1b81f1d8b76643866c5816b49f000000000000000000000000c0d6574b2fe71eed8cd305df0da2323237322557000000000000000000000000b49a395b39a0b410675406bee7bd06330cb503e30000000000000000000000003c96dcfd875253a37acb3d2b102b6f328349b16b00000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000429d069189e00000000000000000000000000000000000000000000000000000429d069189e000000000000000000000000000000000000000000000000000017508f1956a8000000000000000000000000000000000000000000000000000017508f1956a800000000000000000000000000000000000000000000000000006ccd46763f1000000000000000000000000000000000000000000000000000006ccd46763f100000000000000000000000000000000000000000000000000000f8b0a10e4700000000000000000000000000000000000000000000000000000000000000000000070000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000'
  ]
*/
</code></pre>

The `x/govshuttle` module can be generalized to pass any form of information between Canto layers, including additional proposal types, allowing for a highly flexible, application-agnostic interface.


# Lending Market Governance

Here is a high level overview of how the Canto Lending Market is governed:

1. ​The proposals are initiated on the Network side (Cosmos runtime) and voted on by network validators as specified in the SDK governance module. Lending protocol governance uses a custom Canto proposal type equivalent to Compound V2's governance proposal type.
2. When a proposal is approved, the GovShuttle module sends the proposal type to the EVM module where it can be retrieved by a smart contract call to a specific oracle address.
3. When the proposal is retrieved, it is stored in the queue and then executed in the same manner as traditional governance on Compound V2, outlined in Compound's Governor Bravo after a proposal is approved.

### Technical Overview & Details

Here is a technical overview of Canto Lending Market governance:

1. User uses CLI to submit proposal.`cantod tx unigov submit-proposal “proposal text here” --address="address to map contract"`
2. This submits a proposal using the governance keeper.
3. Users vote on the proposal.
4. If the proposal passes, the governance module handler sends the proposal to the GovShuttle proposal handler, which triggers the GovShuttle module to call the keeper function `AppendLendingMarketProposal` located in the `proposals.go` file.
5. `AppendLendingMarketProposal` function takes in the `LendingMarketProposal` function from earlier and returns the address at which the Map Contract is deployed.
6. Lending Market can now use the `QueryProp` method on the map contract to return a proposal struct. Importantly, the lending market can only query proposals that have passed through GovShuttle governance.

Proposals are saved to the EVM as follows:

1. `DeployMapContract` packs the arguments contained in the proposal using `ProposalStoreContract.ABI.Pack`
2. Then it creates a contract address using `CreateAddress(types.ModuleAddress, nonce)`
3. It then creates a byte array with the packed data and passes that into a keeper call to the EVM with `CallEVMWithData(ctx, types.ModuleAddress, nil, data, true)`
4. Finally it returns the address where the Map Contract (shown below) with the initial proposal is deployed.

```
contract map {
	mapping proposalID : proposal
	
	// only GovShuttle module can call AddProposal method
	function AddProposal(id, proposal) {
		// add new proposal to mapping here
	}
	
	// anyone can call this method 
	function QueryProp(uint id) {
		// return proposal from mapping here using ID
	}
}

```

5\. If a GovShuttle proposal has passed before, add a proposal to the Map Contract by using:

```
CallEVM(ctx, 
	contracts.ProposalStoreContract.ABI, 
	types.ModuleAddress, 
	*k.mapContractAddr, 
	true, 
	"AddProposal", 
	sdk.NewIntFromUint64(m.GetPropId()).BigInt(), 
	lm.GetTitle(), 
	lm.GetDescription(), 
	ToAddress(m.GetAccount()), 
	ToBigInt(m.GetValues()), 
	m.GetSignatures(), 
	ToBytes(m.GetCalldatas())
)

```


# Tokenomics

CANTO is the native token of the Canto network. It is used to pay gas fees for transactions and can also be [staked with validators](/user-guides/staking) to help secure the network.

At genesis, the initial total supply of CANTO is 1,000,000,000 (one billion) tokens. Of this, the initial circulating supply of CANTO is 150,000,000 (one-hundred and fifty million) tokens.

## Token Distribution

The initial circulating supply of CANTO tokens is allocated as follows:

* **130,000,000 CANTO (13%) for initial contributors**
* **20,000,000 CANTO (2%)** **for Settlers of Canto** who took part in the launch of the testnet

The remaining total supply of CANTO is allocated as follows, pursuant to governance votes:

* **450,000,000 CANTO (45%) for long-term liquidity mining** to be distributed over the next 5-10 years
* **350,000,000 CANTO (35%) for medium-term liquidity mining** to be distributed over the upcoming months and years
* **50,000,000 CANTO (5%) for future public goods grants**

## Inflation

In order to maintain the security of the Canto network, the total max supply of CANTO inflates over time at a rate that is constantly decreasing. All tokens from inflation are distributed to CANTO stakers, proportionally to their stake in the network.

Early Canto contributors propose these emissions be structured in 30 day periods, with rewards distributed daily:

* For the first 30 day period, CANTO will inflate at a 19.84% APR.
* For subsequent periods, governance will vote to adjust emissions as appropriate.

Over time, the inflation of CANTO should tend to zero.


# Audits

Canto has undergone multiple audits by[ Code4rena](https://code4rena.com/).

* [Canto open audit contest 1 ](https://code4rena.com/contests/2022-06-canto-contest)
* [Canto open audit contest 2](https://code4rena.com/contests/2022-06-canto-v2-contest) based on mitigations from contest 1
* [Canto audit 3: Solo audit by Ghoul.sol](https://code4rena.com/reports/2022-07-canto) based on mitigations from contest 2

In addition, the Gravity Bridge was also audited by Code4rena:

* [Gravity Bridge audit report ](https://code4rena.com/reports/2021-08-gravitybridge/)


