Skip to main content

Tokens and cycles

Beginner
Getting started
Tutorial

Overview

On the Internet Computer, there are three types of token assets: ICP tokens, cycles, and ICRC tokens. ICP and cycles are the most important for every developer to understand and use, as they are necessary for deploying and maintaining a canister.

ICP tokens are important because they can be converted into cycles and used to pay for a canister's resource consumption. Cycles reflect the real cost of operations for resources such as physical hardware, rack space, energy, storage devices, and bandwidth.

ICP tokens

ICP is the Internet Computer's native utility token. Its value is determined on the open market. ICP tokens play a key role in the governance and economics of the Internet Computer.

There are three primary ways to use ICP tokens:

  • Convert ICP into cycles, which are required to pay for a canister's resources. All dapp developers must acquire cycles to deploy their canister onto the mainnet.

  • Trade ICP for other assets, such as other tokens.

  • Stake ICP in a neuron in return for network governance participation and rewards.

Cycles

The Internet Computer runs on a network of nodes owned and operated by a community of independent node providers distributed across the globe. Node providers spend money to run and maintain nodes, such that they purchase hardware and pay for the electricity and network bandwidth used by the node. The Internet Computer compensates these node providers on a monthly basis by minting and distributing rewards in the form of ICP tokens.

Canisters consume the resources provided by these nodes when they are deployed on the mainnet. To make ICP sustainable, canisters are required to pay for the resources they use.

Resource consumption is not paid in ICP tokens but cycles. As the canister is used, its cycles balance is continuously reduced. Eventually, the canister needs to be "topped up" with more cycles.

To get cycles, you must convert ICP tokens into cycles.

Why are cycles different from ICP tokens?

While the value of an ICP token is volatile, cycles are not. Cycles are pegged to XDR, a group of fiat currencies. This allows resource consumption and canister execution on ICP to be a rather stable price.

Other token types

The Internet Computer supports creating and deploying custom fungible or non-fungible tokens through the ICRC standards. Each ICRC standard defines a set of parameters that must be met to adhere to the standard. Not all ICRC standards are for tokens; some are for notifications, architectures, or other network functions.

What is a ledger?

A ledger is a system canister used to store accounts and their transactions. Each token on the Internet Computer has its own ledger. This means that there are separate ledgers for ICP tokens, cycles, and every ICRC token that has been deployed on the network.

Learn more about ledgers.

Obtaining cycles

You need to obtain ICP tokens, then convert them into cycles using dfx. However, when participating at DFINITY events like hackathons or working on a developer grant, you will receive a coupon which you can redeem to claim free cycles from the cycles faucet.

Each developer identity has both a principal and a ledger account identifier

A principal has the format itk7v-ihlxk-ktdrh-fcnst-vkoou-orj77-52ogl-jqwj5-zpfdv-az3lr-xqe and is used for canister ownership, management, and holding cycles.

A ledger account identifier has the format e213184a548871a47fb526f3cba24e2ee2fbbc8129c4ab497ef2ce535130a0a4 and is used to send and receive tokens like ICP. 

1. Get your account's ledger account ID.

dfx ledger account-id
Output
b0d7beee54be8679a42e999218a16a0d396f223d7e44d259ac089848c1b820bf

2. Send ICP tokens to this ledger account ID.

You can obtain ICP tokens from an exchange or through a developer grant. If you are using an exchange, initiate a withdrawal transaction, then enter the ledger account ID as the "destination" address to send ICP tokens to.

3. Check the balance.

dfx ledger balance --network=ic
Output
2.00000000 ICP

Converting ICP to cycles is done through the cycles ledger, a ledger canister that enables developer identities to convert, hold, send, and receive cycles.

The price of cycles is fixed against the price of XDR, where 1 trillion cycles equals 1 XDR.

Cycles are measured in very large numbers, such as billions and trillions. When you talk about cycle transfers and replenishment, you will usually operate with trillions of cycles.

These commands must be run with the --network=ic flag. The cycles ledger is not necessary for local development and therefore not part of the local replica.

4. Convert ICP into cycles.

Replace AMOUNT with the number of ICP tokens you want to convert into cycles.

dfx cycles convert --amount AMOUNT --network=ic
Output
Transfer sent at block height 16146446
Using transfer at block height 16146446
Account was topped up with 6_229_700_000_000 cycles! New balance is 6_229_600_000_000 cycles.
Calculating how many cycles you need

The amount of cycles that your canister will use depends on a variety of factors. Cycles are charged for storage, compute, update messages, special features, and more. To get an approximation, you can view the detailed cycles cost table or use the cycles pricing calculator.

5. Confirm the balance.

dfx cycles balance --network=ic
Output
6.230 TC (trillion cycles).

Next step

Next, it's time to write the code for a smart contract.