Skip to content

Commit 9a1dcb8

Browse files
authored
docs: expand cycle-costs reference with Threshold cryptography and External integrations sections (#272)
## Summary Expands `docs/references/cycle-costs.md` with four previously-stub cost entries and restructures the page into two named sections: - **Threshold cryptography**: threshold ECDSA/Schnorr signing, VetKeys - **External integrations**: HTTPS outcalls, EVM RPC, SOL RPC, Bitcoin, Dogecoin Applies a Diataxis pass to `concepts/cycles.md` (prose replaces the cost table, links to the new sections) and adds an XDR rate query subsection to `system-canisters.md`. ## Review guidance | File | What to check | |---|---| | `docs/references/cycle-costs.md` | New cost tables (Dogecoin, SOL RPC, VetKeys, threshold signing) — verify numbers; section structure; EVM RPC collateral description | | `docs/concepts/cycles.md` | Messaging table replaced with prose and links — does it still give a clear mental model? | | `docs/references/system-canisters.md` | New XDR rate subsection in the CMC section — Candid signature, `xdr_permyriad_per_icp` semantics, Prometheus table | | `docs/guides/chain-fusion/ethereum.mdx` | EVM RPC collateral correction — "consumed, not refunded" is the key factual change | **Key factual correction**: the original text said EVM RPC collateral cycles "are currently refunded in full" — that's wrong. Tracing through `canhttp/src/cycles/mod.rs` shows `msg_cycles_accept(request_cost + collateral)`, meaning collateral is consumed. A second pair of eyes on the corrected wording is welcome. ## Sync recommendation `docs/references/cycle-costs.md`: hand-written (informed by multiple upstream sources listed in the `Upstream` comment)
1 parent 8ac59c8 commit 9a1dcb8

11 files changed

Lines changed: 226 additions & 78 deletions

File tree

docs/concepts/chain-fusion/exchange-rate-canister.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The exchange rate canister (XRC) is a system canister that provides exchange rat
77

88
The canister ID is `uf6dk-hyaaa-aaaaq-qaaaq-cai`.
99

10-
The NNS cycle minting canister uses the XRC to convert ICP to cycles at the XDR-pegged rate. Application canisters can also call the XRC directly to build financial features such as decentralized exchanges, payment systems, and portfolio tools.
10+
The [Cycles Minting Canister (CMC)](../../references/system-canisters.md#cycles-minting-canister-cmc) is the XRC's primary consumer: it calls the XRC every 5 minutes for the current ICP/XDR rate to use when converting ICP tokens to cycles. Application canisters can also call the XRC directly to build financial features such as exchanges, payment systems, and portfolio tools.
1111

1212
## Supported rate types
1313

docs/concepts/chain-key-cryptography.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ The following master keys are deployed at the time of writing. The Network Nervo
9898

9999
Test keys are available for development and run on smaller subnets with lower signing costs. They should not be used for anything of value. Production keys run on high-replication subnets (34+ nodes) for stronger security guarantees. Each key is also reshared to a backup subnet for availability: if the signing subnet fails, the backup can take over without generating a new key.
100100

101-
For signing costs, see [Cycle costs](../references/cycle-costs.md).
101+
For signing costs, see [Cycle costs](../references/cycle-costs.md#threshold-ecdsa-and-schnorr-signing).
102102

103103
## Supported chains
104104

docs/concepts/cycles.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ Cycles cover four resource categories:
1212
- **Compute**: executing instructions (update calls, timers, heartbeats)
1313
- **Storage**: Wasm heap memory and stable memory, charged per byte per second
1414
- **Messaging**: ingress messages from users, inter-canister calls, responses
15-
- **Special features**: HTTPS outcalls, threshold signatures, Bitcoin integration, EVM RPC
15+
- **Threshold cryptography**: threshold ECDSA/Schnorr signing and VetKeys key derivation
16+
- **External integrations**: HTTPS outcalls, EVM RPC, SOL RPC, Bitcoin, Dogecoin
1617

1718
Query calls are free: they run on a single node, do not go through consensus, and are not charged.
1819

@@ -28,6 +29,8 @@ For step-by-step instructions, see [Acquiring cycles](../guides/canister-managem
2829

2930
Unlike ICP tokens, whose price fluctuates with markets, cycles are pegged to the [Special Drawing Right (XDR)](https://www.imf.org/external/np/fin/data/rms_sdrv.aspx): a basket of currencies maintained by the IMF. **1 trillion (T) cycles = 1 XDR** (approximately $1.30–$1.40 USD). This peg makes infrastructure costs predictable for developers regardless of ICP token price movements.
3031

32+
The [CMC](../references/system-canisters.md#cycles-minting-canister-cmc) samples the current ICP/XDR rate from the [exchange rate canister](../references/protocol-canisters.md#exchange-rate-canister-xrc) every 5 minutes. For how to look up the current XDR/USD rate programmatically or from a canister, see [Getting the current XDR/USD rate](../references/cycle-costs.md#getting-the-current-xdrusd-rate).
33+
3134
## Pricing
3235

3336
### Compute
@@ -44,18 +47,13 @@ Compute allocation costs 10M cycles per 1% per second. Best-effort scheduling (0
4447

4548
### Storage
4649

47-
Storage is charged per byte per second for both Wasm heap memory and stable memory. Storing 1 GiB for one year costs approximately 4T cycles (≈$5.40 USD, May 2025). The cost is the same whether the data is in heap or stable memory.
50+
Storage is charged per byte per second for both Wasm heap memory and stable memory. Storing 1 GiB for one year costs approximately 4T cycles. The cost is the same whether the data is in heap or stable memory.
4851

4952
When a canister allocates new storage bytes on a subnet that is more than 750 GiB full, the system moves cycles from the canister's main balance into a **reserved cycles balance** to cover future storage payments for those bytes. This reservation is non-transferable and grows linearly as the subnet fills toward its 2 TiB capacity.
5053

5154
### Messaging
5255

53-
| Message type | Cost |
54-
|---|---|
55-
| Query call | Free |
56-
| Ingress update (user → canister) | 1.2M base + 2K cycles/byte, paid by receiving canister |
57-
| Inter-canister call | 260K base + 1K cycles/byte, paid by sending canister |
58-
| Canister creation | 500B cycles (≈$0.68, May 2025) |
56+
Query calls are free. Update messages carry a base fee plus a per-byte variable cost; ingress messages (user to canister) are charged to the receiving canister, while inter-canister calls are charged to the sending canister. Canister creation carries a one-time fee. For exact cycle counts and USD equivalents, see [Cycle costs](../references/cycle-costs.md#cost-table).
5957

6058
### Replication factor
6159

@@ -71,7 +69,9 @@ Each resource category is metered and charged differently:
7169

7270
**Messaging** costs are charged to the sending canister. Ingress messages (user to canister) are charged to the receiving canister. Each inter-canister call has a fixed base cost plus a per-byte variable cost. The calling canister also prepays the maximum-size reply cost upfront; if the actual reply is smaller, the difference is refunded.
7371

74-
**Special features** (HTTPS outcalls, threshold signatures, Bitcoin API calls) charge the calling canister an additional amount on top of standard messaging costs. These features require extra protocol-level work and are priced accordingly.
72+
**Threshold cryptography** (threshold ECDSA/Schnorr signing, VetKeys key derivation) charges the calling canister an additional amount on top of standard messaging costs. The extra cost reflects the computationally intensive threshold cryptographic operations and cross-subnet coordination required to produce the result. For exact amounts, see [Threshold cryptography costs](../references/cycle-costs.md#threshold-cryptography).
73+
74+
**External integrations** (HTTPS outcalls, EVM RPC, SOL RPC, Bitcoin, Dogecoin) charge an additional amount because every node on the relevant subnet must participate in each outbound call to an external network. For exact amounts, see [External integration costs](../references/cycle-costs.md#external-integrations).
7575

7676
## Cycles ledger
7777

docs/concepts/vetkeys.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ The only supported curve is `bls12_381_g2`. Two key names are available:
7171
| `test_key_1` | Local + mainnet | Development and testing | 10,000,000,000 |
7272
| `key_1` | Mainnet only | Production | 26,153,846,153 |
7373

74-
`vetkd_public_key` carries no cycle cost. `vetkd_derive_key` consumes cycles at the rates above. If a canister may be blackholed or called by other canisters, send more cycles than the advertised cost: unused cycles are refunded, and this ensures calls succeed if the subnet grows in size.
74+
`vetkd_public_key` carries no cycle cost. `vetkd_derive_key` consumes cycles at the rates above. If a canister may be blackholed or called by other canisters, send more cycles than the advertised cost: unused cycles are refunded, and this ensures calls succeed if the subnet grows in size. See [Cycle costs](../references/cycle-costs.md#vetkd) for USD equivalents and full details.
7575

7676
## Use cases
7777

docs/guides/canister-management/cycles-management.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ icp canister status -e ic
339339
```
340340

341341
**Automated monitoring services**: Third-party services can monitor balances and alert or auto-top-up:
342-
- [CycleOps](https://cycleops.dev): Onchain monitoring with automated top-ups and email notifications
342+
- [CycleOps](https://cycleops.dev): Network-based monitoring with automated top-ups and email notifications
343343
- [Canistergeek](https://cusyh-iyaaa-aaaah-qcpba-cai.raw.icp0.io/): Cycles, memory, and log monitoring in one place
344344

345345
**Automated top-up libraries:**

docs/guides/chain-fusion/bitcoin.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1010,7 +1010,7 @@ fn select_one_utxo<'a>(
10101010

10111011
### Cycle costs
10121012

1013-
All Bitcoin API calls require cycles attached to the call. In Rust, the `ic-cdk-bitcoin-canister` crate handles this automatically. In Motoko, attach cycles explicitly with `(with cycles = amount)`.
1013+
All Bitcoin API calls require cycles attached to the call. In Rust, the `ic-cdk-bitcoin-canister` crate handles this automatically. In Motoko, attach cycles explicitly with `(with cycles = amount)`. The table below shows minimum cycles to attach; for base costs and USD values see [Cycle costs](../../references/cycle-costs.md#bitcoin-integration-api).
10141014

10151015
| API call | Testnet / Regtest | Mainnet |
10161016
|---|---|---|

docs/guides/chain-fusion/ethereum.mdx

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -572,15 +572,7 @@ let (result,): (Result<String, RpcError>,) =
572572

573573
## Cycle costs
574574

575-
Every EVM RPC call requires cycles. The cost depends on the request size, response size, subnet size, and number of providers queried.
576-
577-
**Formula:**
578-
579-
```text
580-
(5_912_000 + 60_000 * nodes + 2400 * request_bytes + 800 * max_response_bytes) * nodes * rpc_count
581-
```
582-
583-
Where `nodes` = 34 (fiduciary subnet) and `rpc_count` = number of providers queried.
575+
Every EVM RPC call requires cycles. The cost depends on the request size, response size, subnet size, and number of providers queried. For the full pricing formula, see [EVM RPC canister costs](../../references/cycle-costs.md#evm-rpc-canister).
584576

585577
**Practical guidance:**
586578

@@ -589,9 +581,7 @@ Where `nodes` = 34 (fiduciary subnet) and `rpc_count` = number of providers quer
589581
- Use `requestCost` to get an exact estimate before making a raw JSON-RPC call.
590582
- The Candid-RPC methods (like `eth_getBlockByNumber`) automatically retry with larger response sizes if needed, consuming more cycles from your budget.
591583

592-
### Collateral cycles
593-
594-
Callers must include at least 0.00028 TC of additional "collateral cycles" to account for possible future API price increases. These are currently fully refunded, but this may change.
584+
An additional `10_000_000 * nodes * rpc_services` collateral cycles must be attached per call; these are consumed by the EVM RPC canister as a reserve for future pricing changes and are not returned. Any cycles above the total minimum are returned, so it is safe to send more than needed.
595585

596586
## Development setup
597587

docs/guides/chain-fusion/solana.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ Every SOL RPC call requires cycles to cover HTTPS outcall costs. The `sign_with_
327327
| SOL RPC `request` (small response, 1–2 providers) | ~1–5B cycles |
328328
| `sign_with_schnorr` (Ed25519, Rust cdk auto-attached) | ~26.15B cycles |
329329

330-
Send 10B cycles per RPC call as a starting budget: unused cycles are refunded. Set `max_response_bytes` to the minimum needed; smaller values reduce costs.
330+
Send 10B cycles per RPC call as a starting budget: unused cycles are refunded. Set `max_response_bytes` to the minimum needed; smaller values reduce costs. For the full pricing formula, see [SOL RPC canister costs](../../references/cycle-costs.md#sol-rpc-canister).
331331

332332
## ckSOL
333333

0 commit comments

Comments
 (0)