Skip to content

Commit

Permalink
Merge pull request #2951 from dfinity/cycles-overview
Browse files Browse the repository at this point in the history
Move advanced cycles docs from Getting Started to Digital Assets category
  • Loading branch information
jessiemongeon1 authored May 22, 2024
2 parents 16be874 + 3f2b482 commit 9751187
Show file tree
Hide file tree
Showing 21 changed files with 102 additions and 51 deletions.
4 changes: 2 additions & 2 deletions docs/concepts/tokens-cycles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";

<MarkdownChipRow labels={["Concept"]} />

## Overview
## Overview
Internet Computer Protocol tokens (ICP tokens) are a native utility token with a value determined on the open market. ICP tokens play a key role in both the governance and the economics of the Internet Computer.

## How to get ICP tokens
Expand Down Expand Up @@ -44,7 +44,7 @@ For developers, ICP tokens are important because they can be converted to cycles

Canister smart contracts must be able to pay for complete execution (all or nothing), but the platform sets limits on how many cycles a canister can hold and consume to prevent malicious code from draining resources.

To learn more about cycles and how to use them, see [here](/docs/current/developer-docs/getting-started/cycles/converting_icp_tokens_into_cycles).
To learn more about cycles and how to use them, see [here](/docs/current/developer-docs/defi/cycles/converting_icp_tokens_into_cycles).

For more information on cycles costs, see the tables in [computation and storage costs](/docs/current/developer-docs/gas-cost).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ dfx deploy assets --network "local"
### Deploying on the mainnet

:::info
To deploy to the mainnet, you will need a wallet that contains cycles. For more information on cycles wallets, please see [here](/docs/current/developer-docs/getting-started/cycles/cycles-wallet).
To deploy to the mainnet, you will need a wallet that contains cycles. For more information on cycles wallets, please see [here](/docs/current/developer-docs/defi/cycles/cycles-wallet).
:::

To deploy your asset canister to the mainnet, the following command can be used:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ dfx cycles convert AMOUNT --network ic
```

:::info
This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/getting-started/cycles/cycles-wallet).
This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/defi/cycles/cycles-wallet).

Please note that the cycles wallet will be removed from dfx in a future release.
:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ dfx cycles convert AMOUNT --network ic
```

:::info
This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/getting-started/cycles/cycles-wallet).
This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/defi/cycles/cycles-wallet).

Please note that the cycles wallet will be removed from dfx in a future release.
:::
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-docs/defi/icrc-1/icrc1-ledger-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ Check the set variables:
For each variable, the exported environment variable will be used unless otherwise specified:
- The `PRE_MINTED_TOKENS` is amount of tokens that are minted during deployment for a specific account (In this tutorial it will be the `DEFAULT` account).
- The `TRANSFER_FEE` is the transfer fee that users of the ledger will have to pay anytime they want to make a transfer.
- The `ARCHIVE_CONTROLLER` is the [controller principal](/docs/current/developer-docs/getting-started/cycles/cycles-wallet#controller-and-custodian-roles) of the archive canisters.
- The `ARCHIVE_CONTROLLER` is the [controller principal](/docs/current/developer-docs/defi/cycles/cycles-wallet#controller-and-custodian-roles) of the archive canisters.
- The `TRIGGER_THRESHOLD` is the number of blocks to archive when the trigger threshold is exceeded.
- The `CYCLE_FOR_ARCHIVE_CREATION` is the amount of cycles that will be sent to the archive canister when it is created.
- The `NUM_OF_BLOCK_TO_ARCHIVE` is the number of blocks that will be archived.
Expand Down
2 changes: 1 addition & 1 deletion docs/developer-docs/defi/icrc-1/token-quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ To create a token, you will need to export several environmental variables. The
```
- The `PRE_MINTED_TOKENS` is amount of tokens that are minted during deployment for a specific account (In this tutorial it will be the `DEFAULT` account).
- The `TRANSFER_FEE` is the transfer fee that users of the ledger will have to pay anytime they want to make a transfer.
- The `ARCHIVE_CONTROLLER` is the [controller principal](/docs/current/developer-docs/getting-started/cycles/cycles-wallet#controller-and-custodian-roles) of the archive canisters.
- The `ARCHIVE_CONTROLLER` is the [controller principal](/docs/current/developer-docs/defi/cycles/cycles-wallet#controller-and-custodian-roles) of the archive canisters.
- The `TRIGGER_THRESHOLD` is the number of blocks to archive when the trigger threshold is exceeded.
- The `CYCLE_FOR_ARCHIVE_CREATION` is the amount of cycles that will be sent to the archive canister when it is created.
- The `NUM_OF_BLOCK_TO_ARCHIVE` is the number of blocks that will be archived.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";

## Overview

When developing multiple projects simultaneously, it can be beneficial to deploy each project to a different local network for simplicity or to support different development workflows. Custom networks can be configured with `dfx` at both the system-wide and project-specific levels.
When developing multiple projects simultaneously, it can be beneficial to deploy each project to a different local network for simplicity or to support different development workflows. Custom networks can be configured with `dfx` at both the system-wide and project-specific levels.

## Defining system-wide networks in `networks.json`

Expand Down Expand Up @@ -42,7 +42,7 @@ By default, this file contains the following configuration:
}
```

Alternatively, if a `network.json` file is not defined locally, `dfx` will by default use the above configuration.
Alternatively, if a `network.json` file is not defined locally, `dfx` will by default use the above configuration.

### Defining a custom network

Expand Down Expand Up @@ -123,7 +123,7 @@ To define a project-specific network, add a "networks" section to your `dfx.json
}
```

If you are using a [cycles wallet](/docs/current/developer-docs/getting-started/cycles/cycles-wallet), be sure to deploy your cycles wallet to this custom network.
If you are using a [cycles wallet](/docs/current/developer-docs/defi/cycles/cycles-wallet), be sure to deploy your cycles wallet to this custom network.

```
dfx identity --network dev set-wallet $(dfx identity --network ic get-wallet)
Expand Down
4 changes: 2 additions & 2 deletions docs/developer-docs/gas-cost.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ You can learn more about the [reverse gas model](https://internetcomputer.org/ca

One downside of the ICP reverse gas model is that it requires prerequisite steps and ongoing maintenance for developers. Canisters must have their cycles balances maintained and regularly topped up as they continuously use resources. The canister will be removed from the network if it runs out of cycles. However, a [freezing threshold](/docs/current/tutorials/developer-journey/level-1/1.6-managing-canisters#setting-the-canisters-freezing-threshold) can be set that pauses a canister's executions if the cycles amount is expected to fall below a certain amount. There are several community tools that have been developed to automate managing a canister's cycles, such as [CycleOps](https://cycleops.dev/).

Learn how to query a [canister's cycles balance](/docs/current/tutorials/developer-journey/level-1/1.6-managing-canisters#checking-the-cycles-balance-of-a-canister).
Learn how to query a [canister's cycles balance](/docs/current/tutorials/developer-journey/level-1/1.6-managing-canisters#checking-the-cycles-balance-of-a-canister).

Learn how to [top up a canister](/docs/current/tutorials/developer-journey/level-1/1.6-managing-canisters#topping-up-a-canisters-cycles-balance).

Expand Down Expand Up @@ -184,7 +184,7 @@ The following table shows the calculated storage cost per GiB for a 30-day month


Monitoring cycles usage
- [Check your canister's cycles balance](/docs/current/developer-docs/getting-started/cycles/cycles-wallet#check-the-cycle-balance).
- [Check your canister's cycles balance](/docs/current/developer-docs/defi/cycles/cycles-wallet#check-the-cycle-balance).
- [Monitor your canister's cycles usage](/docs/current/developer-docs/getting-started/cycles/cycles_management_services).
- [Motoko cycles management library](https://github.com/CycleOperators/cycles-manager).

Expand Down
46 changes: 26 additions & 20 deletions docs/developer-docs/getting-started/cycles/cycles-faucet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,15 @@ import '/src/components/CenterImages/center.scss';

<MarkdownChipRow labels={["Beginner", "Tutorial"]} />

## What are ICP cycles?
The Internet Computer Protocol runs on a network of nodes owned and operated by a growing community of independent node providers (NPs) distributed across the globe. NPs spend money for running nodes, e.g. they purchase hardware and require electricity and network bandwidth. The Internet Computer Protocol compensates NPs on a monthly basis by minting and distributing rewards in the form of ICP tokens.
## Overview

To make ICP sustainable, <GlossaryTooltip>canisters</GlossaryTooltip> are required to pay for the resources they consume, e.g. storage and compute. Resource consumption is not paid in ICP tokens but **cycles**. It’s typically the canister’s developer who charges the canister with cycles. As the canister is used, its cycles balance is continuously reduced. Eventually, the canister needs to be “topped up” with more cycles. The default way to get cycles is to convert ICP tokens to cycles. When doing so, the protocol burns the ICP tokens.
To deploy a <GlossaryTooltip>canisters</GlossaryTooltip> onto the ICP mainnet, you must have cycles. Cycles are used to pay for the resources that a canister uses.

## Why are cycles different from ICP tokens?

While the value of an ICP token is volatile, cycles are not. They are pegged to [XDR](https://en.wikipedia.org/wiki/Special_drawing_rights), a basket of fiat currencies. This has the benefit that resource consumption, e.g. smart contract executions, on ICP has a somewhat stable price.

:::info
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.
:::

This guide explains how to use **cycles faucet** to acquire your first amount of 10T free cycles that could be used to deploy your dapps on the mainnet.
This guide explains how to use the **cycles faucet** to acquire 10T free cycles that can be used to deploy your dapps on the mainnet.

## Prerequisites

- [x] Install Internet Computer SDK following [this guide](/docs/current/developer-docs/getting-started/install/).
- [x] Install the [Internet Computer SDK](/docs/current/developer-docs/getting-started/install/).

## Step 1: Get a coupon.

Expand All @@ -42,7 +33,9 @@ First, you will need to navigate to [https://faucet.dfinity.org](https://faucet.

## Step 3: In this channel, execute the following slash command:

> /request
```
/request
```

## Step 4: After you send this message, you are prompted to fill out a survey.

Expand All @@ -68,11 +61,15 @@ Click **NEXT STEP** to continue.

Next, confirm your computer has `dfx` installed. Run this command to check the version of `dfx` on your computer:

dfx --version
```
dfx --version
```

If your `dfx` version is below 0.12.0, please run this command:

dfx upgrade
```
dfx upgrade
```

![Setup SDK](_attachments/faucet_step_4.png)

Expand All @@ -96,7 +93,7 @@ dfx identity use MyNewIdentity

## Step 10: Now, claim your cycles.

This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/getting-started/cycles/cycles-wallet).
This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/defi/cycles/cycles-wallet).

To use the cycles ledger, you will need [`dfx` version 0.19.0](/docs/current/developer-docs/getting-started/install/), and you will need to set the following environmental variable:

Expand Down Expand Up @@ -125,9 +122,18 @@ The last step is to verify the coupon was redeemed correctly by checking your ba
Now you are ready to deploy a canister on the mainnet!

## Resources

To further explore cycle management please see the following articles:
- **[Using a cycles wallet](/docs/current/developer-docs/getting-started/cycles/cycles-wallet)**.
- **[Getting free cycles from DFINITY cycles faucet](/docs/current/developer-docs/getting-started/cycles/cycles-faucet)**.
- **[Converting ICP tokens into cycles](/docs/current/developer-docs/getting-started/cycles/converting_icp_tokens_into_cycles)**.

- [Using a cycles wallet](/docs/current/developer-docs/defi/cycles/cycles-wallet).

- [Using the cycles ledger](/docs/current/developer-docs/defi/cycles/cycles-ledger).

- [Cost of resources in cycles](/docs/current/developer-docs/gas-cost).

- [Converting ICP tokens into cycles](/docs/current/developer-docs/defi/cycles/converting_icp_tokens_into_cycles).


## Next steps

- [Review the default project template](/docs/current/developer-docs/getting-started/default-template).
38 changes: 38 additions & 0 deletions docs/developer-docs/getting-started/cycles/overview.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
keywords: [beginner, tutorial, cycles, free cycles, cycles coupon]
---

import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";
import { GlossaryTooltip } from "/src/components/Tooltip/GlossaryTooltip";

# Getting started with free cycles

<MarkdownChipRow labels={["Beginner", "Tutorial"]} />

## What are ICP cycles?
The Internet Computer Protocol runs on a network of nodes owned and operated by a growing community of independent node providers (NPs) distributed across the globe. NPs spend money for running nodes, e.g. they purchase hardware and require electricity and network bandwidth. The Internet Computer Protocol compensates NPs on a monthly basis by minting and distributing rewards in the form of ICP tokens.

To make ICP sustainable, <GlossaryTooltip>canisters</GlossaryTooltip> are required to pay for the resources they consume, e.g. storage and compute. Resource consumption is not paid in ICP tokens but **cycles**. It’s typically the canister’s developer who charges the canister with cycles. As the canister is used, its cycles balance is continuously reduced. Eventually, the canister needs to be “topped up” with more cycles. The default way to get cycles is to convert ICP tokens to cycles. When doing so, the protocol burns the ICP tokens.

## Why are cycles different from ICP tokens?

While the value of an ICP token is volatile, cycles are not. They are pegged to [XDR](https://en.wikipedia.org/wiki/Special_drawing_rights), a basket of fiat currencies. This has the benefit that resource consumption, e.g. smart contract executions, on ICP has a somewhat stable price.

:::info
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.
:::

## Next steps

- [Obtaining free cycles from the cycles faucet](/docs/current/developer-docs/getting-started/cycles/cycles-faucet).

- [Converting ICP tokens into cycles](/docs/current/developer-docs/defi/cycles/converting_icp_tokens_into_cycles).

- [Using a cycles wallet](/docs/current/developer-docs/defi/cycles/cycles-wallet).

- [Using the cycles ledger](/docs/current/developer-docs/defi/cycles/cycles-ledger).

- [Cost of resources in cycles](/docs/current/developer-docs/gas-cost).



2 changes: 1 addition & 1 deletion docs/developer-docs/getting-started/deploy/mainnet.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Before you download and install this release of the IC SDK, verify the following
:::info
You must have **cycles** available to complete this guide. To get cycles, you must either convert ICP tokens to cycles or be provided cycles from another source, for example, from a canister controlled by another developer or from a third-party cycles provider. This guide assumes that you have an account with ICP tokens available and illustrates how to convert ICP tokens into cycles.

For information about how to get ICP tokens, see [how you can get ICP tokens](/docs/current/developer-docs/getting-started/cycles/converting_icp_tokens_into_cycles).
For information about how to get ICP tokens, see [how you can get ICP tokens](/docs/current/developer-docs/defi/cycles/converting_icp_tokens_into_cycles).

For an introduction to using the Network Nervous System application to manage ICP tokens, see [Network Nervous System dapp quick start](/docs/current/developer-docs/daos/nns/nns-app-quickstart).
:::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ keywords: [advanced, ethereum, addresses, eth address ]
import useBaseUrl from "@docusaurus/useBaseUrl";
import { MarkdownChipRow } from "/src/components/Chip/MarkdownChipRow";

# Generating addresses
# ICP ETH developer workflow

<MarkdownChipRow labels={["Advanced", "Ethereum" ]} />

Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/developer-journey/level-1/1.4-using-cycles.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ dfx start --clean --background
dfx identity use DevJourney
```

This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/getting-started/cycles/cycles-wallet).
This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/defi/cycles/cycles-wallet).

To use the cycles ledger, you will need [`dfx` version 0.19.0](/docs/current/developer-docs/getting-started/install/), and you will need to set the following environmental variable:

Expand Down Expand Up @@ -204,7 +204,7 @@ dfx cycles convert AMOUNT --network ic
```

:::info
This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/getting-started/cycles/cycles-wallet).
This workflow utilizes the **cycles ledger** feature. If you'd like to use the **cycles wallet** instead, [view the cycles wallet documentation](/docs/current/developer-docs/defi/cycles/cycles-wallet).

Please note that the cycles wallet will be removed from dfx in a future release.
:::
Expand All @@ -226,7 +226,7 @@ This should return your balance in cycles:
## Resources
To further explore cycle management please see the following articles:
- **[Getting free cycles from DFINITY cycles faucet](/docs/current/developer-docs/getting-started/cycles/cycles-faucet)**.
- **[Converting ICP tokens into cycles](/docs/current/developer-docs/getting-started/cycles/converting_icp_tokens_into_cycles)**.
- **[Converting ICP tokens into cycles](/docs/current/developer-docs/defi/cycles/converting_icp_tokens_into_cycles)**.

## Need help?

Expand Down
Loading

0 comments on commit 9751187

Please sign in to comment.