Skip to content

Commit cbd5c76

Browse files
authored
docs: protocol canisters reference (#72)
## Summary - Bitcoin canisters: mainnet (`ghsi2`) and testnet (`g4xu7`) with subnets, specs, key API endpoints; notes deprecation of management canister Bitcoin API - ckBTC: mainnet + testnet4 ledger/minter/index IDs, minter configuration parameters, all endpoints, deposit/withdrawal flow - ckETH: ledger/minter IDs, deposit/withdrawal flow - EVM RPC canister: supported chains, built-in RPC providers table, cycle cost formula, consensus strategy guidance - Exchange rate canister: data sources, rate aggregation, Candid interface, cycle costs table, `icp canister call` example - SNS-W canister: purpose and subnet - Quick reference table: all 10 canister IDs in one place ## Sync recommendation informed by `dfinity/portal` — chain fusion and protocol canister reference pages; informed by `dfinity/icskills` — `ckbtc`, `evm-rpc`
1 parent 69979da commit cbd5c76

1 file changed

Lines changed: 285 additions & 11 deletions

File tree

Lines changed: 285 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,294 @@
11
---
22
title: "Protocol Canisters"
3-
description: "Bitcoin canister, EVM RPC canister, exchange rate canister, and other protocol-level canisters"
3+
description: "Bitcoin canister, ckBTC minter, ckETH minter, EVM RPC canister, exchange rate canister, and other protocol-level canisters with their canister IDs and interfaces"
44
sidebar:
55
order: 3
66
---
77

8-
TODO: Write content for this page.
8+
Protocol canisters implement platform-level features on the Internet Computer. Unlike [system canisters](system-canisters.md), which govern the network itself, protocol canisters provide infrastructure that applications build on: Bitcoin integration, Ethereum integration, chain-key tokens, and exchange rates. They are controlled by the NNS and run on dedicated system subnets.
99

10-
<!-- Content Brief -->
11-
Inventory of protocol-level canisters that implement IC platform features. List the Bitcoin canister, ckBTC minter, ckETH minter, EVM RPC canister (7hfb6-caaaa-aaaar-qadga-cai), exchange rate canister, and SNS-W canister with their canister IDs, interfaces, and purpose.
10+
## Bitcoin canisters
1211

13-
<!-- Source Material -->
14-
- Portal: references/ (scattered protocol canister references)
15-
- icskills: ckbtc, evm-rpc
12+
The Bitcoin integration canisters connect ICP to the Bitcoin network. They track the Bitcoin UTXO set and expose an API that other canisters use to read Bitcoin state and submit transactions.
1613

17-
<!-- Cross-Links -->
18-
- guides/chain-fusion/bitcoin -- Bitcoin canister usage
19-
- guides/chain-fusion/ethereum -- EVM RPC canister usage
20-
- reference/system-canisters -- NNS-level canisters
14+
> Call the Bitcoin canisters directly using the canister IDs below for better performance and to avoid potential future changes to the management canister Bitcoin API.
15+
16+
### Bitcoin mainnet
17+
18+
| Field | Value |
19+
|---|---|
20+
| Canister ID | [`ghsi2-tqaaa-aaaan-aaaca-cai`](https://dashboard.internetcomputer.org/canister/ghsi2-tqaaa-aaaan-aaaca-cai) |
21+
| Subnet | [`w4rem-dv5e3-widiz-wbpea-kbttk-mnzfm-tzrc7-svcj3-kbxyb-zamch-hqe`](https://dashboard.internetcomputer.org/subnet/w4rem-dv5e3-widiz-wbpea-kbttk-mnzfm-tzrc7-svcj3-kbxyb-zamch-hqe) |
22+
| Specification | [Bitcoin canister interface spec](https://github.com/dfinity/bitcoin-canister/blob/master/INTERFACE_SPECIFICATION.md) |
23+
24+
### Bitcoin testnet (v4)
25+
26+
| Field | Value |
27+
|---|---|
28+
| Canister ID | [`g4xu7-jiaaa-aaaan-aaaaq-cai`](https://dashboard.internetcomputer.org/canister/g4xu7-jiaaa-aaaan-aaaaq-cai) |
29+
| Subnet | [`w4rem-dv5e3-widiz-wbpea-kbttk-mnzfm-tzrc7-svcj3-kbxyb-zamch-hqe`](https://dashboard.internetcomputer.org/subnet/w4rem-dv5e3-widiz-wbpea-kbttk-mnzfm-tzrc7-svcj3-kbxyb-zamch-hqe) |
30+
| Specification | [Bitcoin canister interface spec](https://github.com/dfinity/bitcoin-canister/blob/master/INTERFACE_SPECIFICATION.md) |
31+
32+
### Key endpoints
33+
34+
The Bitcoin canisters expose endpoints for reading UTXOs, balances, and block headers, and for submitting transactions. These mirror the management canister Bitcoin API:
35+
36+
- `bitcoin_get_utxos` — returns UTXOs for a Bitcoin address
37+
- `bitcoin_get_balance` — returns the balance of a Bitcoin address in satoshi
38+
- `bitcoin_send_transaction` — submits a signed Bitcoin transaction
39+
- `bitcoin_get_current_fee_percentiles` — returns fee percentiles in millisatoshi/vbyte
40+
- `bitcoin_get_block_headers` — returns block headers for a range of heights
41+
42+
For integration patterns, see the [Bitcoin guide](../guides/chain-fusion/bitcoin.md).
43+
44+
## ckBTC canisters
45+
46+
Chain-key Bitcoin (ckBTC) is a 1:1 BTC-backed ICRC-2 token native to ICP. The ckBTC minter holds real BTC and mints or burns ckBTC tokens. Transfers settle in seconds with a 10 satoshi fee.
47+
48+
### Mainnet canister IDs
49+
50+
| Canister | ID |
51+
|---|---|
52+
| ckBTC Ledger | [`mxzaz-hqaaa-aaaar-qaada-cai`](https://dashboard.internetcomputer.org/canister/mxzaz-hqaaa-aaaar-qaada-cai) |
53+
| ckBTC Minter | [`mqygn-kiaaa-aaaar-qaadq-cai`](https://dashboard.internetcomputer.org/canister/mqygn-kiaaa-aaaar-qaadq-cai) |
54+
| ckBTC Index | [`n5wcd-faaaa-aaaar-qaaea-cai`](https://dashboard.internetcomputer.org/canister/n5wcd-faaaa-aaaar-qaaea-cai) |
55+
56+
### Bitcoin Testnet4 canister IDs
57+
58+
| Canister | ID |
59+
|---|---|
60+
| ckBTC Ledger (testnet4) | [`mc6ru-gyaaa-aaaar-qaaaq-cai`](https://dashboard.internetcomputer.org/canister/mc6ru-gyaaa-aaaar-qaaaq-cai) |
61+
| ckBTC Minter (testnet4) | [`ml52i-qqaaa-aaaar-qaaba-cai`](https://dashboard.internetcomputer.org/canister/ml52i-qqaaa-aaaar-qaaba-cai) |
62+
| ckBTC Index (testnet4) | [`mm444-5iaaa-aaaar-qaabq-cai`](https://dashboard.internetcomputer.org/canister/mm444-5iaaa-aaaar-qaabq-cai) |
63+
64+
### ckBTC minter configuration
65+
66+
The ckBTC minter has the following key parameters:
67+
68+
| Parameter | Value | Description |
69+
|---|---|---|
70+
| `retrieve_btc_min_amount` | 50,000 satoshi (0.0005 BTC) | Minimum amount for BTC withdrawal |
71+
| `max_time_in_queue_nanos` | 10 minutes | Maximum time a retrieval request can wait in the queue |
72+
| `min_confirmations` | 6 | Bitcoin confirmations required before minting ckBTC |
73+
| `kyt_fee` | 100 satoshi | Fee for know-your-token (KYT) checks |
74+
75+
### ckBTC minter endpoints
76+
77+
- `get_btc_address(owner, subaccount)` — returns a unique Bitcoin deposit address for the given principal and subaccount
78+
- `get_known_utxos(owner, subaccount)` — returns UTXOs already processed by the minter for the given account
79+
- `update_balance(owner, subaccount)` — checks for new UTXOs and mints ckBTC for any newly confirmed deposits
80+
- `estimate_withdrawal_fee(amount)` — estimates the fee for retrieving a given BTC amount
81+
- `get_deposit_fee` — returns the current fee charged when minting ckBTC (currently the KYT fee)
82+
- `retrieve_btc_with_approval(address, amount, from_subaccount)` — burns ckBTC (using an ICRC-2 approval) and sends the equivalent BTC to the given Bitcoin address
83+
- `retrieve_btc(address, amount)` — alternative withdrawal flow that requires transferring ckBTC to the minter's withdrawal account first; prefer `retrieve_btc_with_approval` for new integrations
84+
- `get_withdrawal_account` — returns the caller's withdrawal account for use with `retrieve_btc`
85+
- `retrieve_btc_status_v2(block_index)` — returns the status of a previous withdrawal request
86+
- `retrieve_btc_status_v2_by_account(account)` — returns statuses for all recent withdrawal requests from the given account
87+
- `get_minter_info` — returns current minter parameters
88+
- `get_events(start, length)` — returns the minter's internal event log (for debugging)
89+
90+
### Deposit and withdrawal flows
91+
92+
**Deposit (BTC to ckBTC):**
93+
1. Call `get_btc_address` with the user's principal and subaccount to get a unique Bitcoin deposit address.
94+
2. The user sends BTC to that address.
95+
3. After 6 confirmations, call `update_balance` to trigger minting. The minter credits the ICRC-1 account corresponding to the provided principal and subaccount.
96+
97+
**Withdrawal (ckBTC to BTC):**
98+
1. Call `icrc2_approve` on the ckBTC ledger to grant the minter allowance.
99+
2. Call `retrieve_btc_with_approval` with the destination Bitcoin address and amount.
100+
3. The minter burns the ckBTC and submits a Bitcoin transaction. BTC arrives after Bitcoin confirmations.
101+
102+
For integration examples, see the [Bitcoin guide](../guides/chain-fusion/bitcoin.md).
103+
104+
## ckETH canisters
105+
106+
Chain-key Ethereum (ckETH) is an ICRC-2 token backed 1:1 by ETH. The ckETH minter bridges between ETH on Ethereum mainnet and ckETH on ICP using HTTPS outcalls and threshold ECDSA.
107+
108+
### Mainnet canister IDs
109+
110+
| Canister | ID |
111+
|---|---|
112+
| ckETH Ledger | [`ss2fx-dyaaa-aaaar-qacoq-cai`](https://dashboard.internetcomputer.org/canister/ss2fx-dyaaa-aaaar-qacoq-cai) |
113+
| ckETH Minter | [`sv3dd-oaaaa-aaaar-qacoa-cai`](https://dashboard.internetcomputer.org/canister/sv3dd-oaaaa-aaaar-qacoa-cai) |
114+
| ckETH Index | [`s3zol-vqaaa-aaaar-qacpa-cai`](https://dashboard.internetcomputer.org/canister/s3zol-vqaaa-aaaar-qacpa-cai) |
115+
116+
### How it works
117+
118+
**Deposit (ETH to ckETH):**
119+
1. The user calls the `deposit` function on the ckETH helper contract on Ethereum, with ETH attached and the destination ICP principal as an argument.
120+
2. The ckETH minter periodically fetches logs from the helper contract via multiple Ethereum JSON-RPC providers. For each `ReceivedEth` event, it mints the corresponding ckETH to the receiver's account on the ckETH ledger.
121+
122+
**Withdrawal (ckETH to ETH):**
123+
1. The user calls `icrc2_approve` on the ckETH ledger to grant the minter allowance.
124+
2. The user calls `withdraw_eth` on the ckETH minter with a destination Ethereum address.
125+
3. The minter burns the ckETH, creates an Ethereum transaction, and submits it to the Ethereum network.
126+
127+
The ckETH ledger follows the ICRC-1/ICRC-2 standard. Interact with it using the same patterns as any ICRC-1 ledger.
128+
129+
For integration examples, see the [Ethereum guide](../guides/chain-fusion/ethereum.md).
130+
131+
## EVM RPC canister
132+
133+
The EVM RPC canister proxies JSON-RPC calls to Ethereum and EVM-compatible chains via HTTPS outcalls. Your canister sends a request to the EVM RPC canister, which fans the request out to multiple RPC providers, compares responses for consensus, and returns the result. No API keys are required for the default providers.
134+
135+
| Field | Value |
136+
|---|---|
137+
| Canister ID | [`7hfb6-caaaa-aaaar-qadga-cai`](https://dashboard.internetcomputer.org/canister/7hfb6-caaaa-aaaar-qadga-cai) |
138+
| Subnet | 34-node fiduciary subnet |
139+
| Candid interface | [evm_rpc.did](https://github.com/dfinity/evm-rpc-canister/releases/latest/download/evm_rpc.did) |
140+
141+
### Supported chains
142+
143+
| Chain | Chain ID |
144+
|---|---|
145+
| Ethereum Mainnet | 1 |
146+
| Ethereum Sepolia | 11155111 |
147+
| Arbitrum One | 42161 |
148+
| Base Mainnet | 8453 |
149+
| Optimism Mainnet | 10 |
150+
| Custom EVM chain | any |
151+
152+
### Built-in RPC providers
153+
154+
The following providers are available without API keys:
155+
156+
| Provider | Ethereum | Sepolia | Arbitrum | Base | Optimism |
157+
|---|---|---|---|---|---|
158+
| Alchemy | yes | yes | yes | yes | yes |
159+
| Ankr | yes | — | yes | yes | yes |
160+
| BlockPi | yes | yes | yes | yes | yes |
161+
| Cloudflare | yes | — | — | — | — |
162+
| LlamaNodes | yes | — | yes | yes | yes |
163+
| PublicNode | yes | yes | yes | yes | yes |
164+
165+
### Cycle costs
166+
167+
Each call requires cycles attached. The cost formula is:
168+
169+
```
170+
(5_912_000 + 60_000 * nodes + 2400 * request_bytes + 800 * max_response_bytes) * nodes * rpc_count
171+
```
172+
173+
Where `nodes` = 34 (fiduciary subnet) and `rpc_count` = number of providers queried. For a practical starting budget, attach 10B cycles per call — unused cycles are refunded. Use the `requestCost` method to get an exact estimate before calling.
174+
175+
### Consensus
176+
177+
By default, the canister requires all providers to agree (`Equality` consensus). For calls like `eth_getBlockByNumber("latest")` where providers may be 1-2 blocks apart, use threshold consensus instead: 2-of-3 agreement. Multi-provider results are returned as `MultiRpcResult::Consistent(result)` or `MultiRpcResult::Inconsistent(results)` — always handle both variants.
178+
179+
For integration examples, see the [Ethereum guide](../guides/chain-fusion/ethereum.md).
180+
181+
## Exchange rate canister (XRC)
182+
183+
The exchange rate canister (XRC) uses HTTPS outcalls to fetch cryptocurrency and foreign exchange rates from major exchanges. It runs on the `uzr34` system subnet and is used by the cycles minting canister (CMC) to convert ICP to cycles at a stable XDR-pegged price.
184+
185+
| Field | Value |
186+
|---|---|
187+
| Canister ID | [`uf6dk-hyaaa-aaaaq-qaaaq-cai`](https://dashboard.internetcomputer.org/canister/uf6dk-hyaaa-aaaaq-qaaaq-cai) |
188+
| Subnet | [`uzr34-akd3s-xrdag-3ql62-ocgoh-ld2ao-tamcv-54e7j-krwgb-2gm4z-oqe`](https://dashboard.internetcomputer.org/subnet/uzr34-akd3s-xrdag-3ql62-ocgoh-ld2ao-tamcv-54e7j-krwgb-2gm4z-oqe) |
189+
| Specification | [XRC interface spec](https://github.com/dfinity/exchange-rate-canister/blob/main/INTERFACE_SPECIFICATION.md) |
190+
191+
### Data sources
192+
193+
The XRC pulls from the following exchanges: Coinbase, Kucoin, OKX, Gate.io, MEXC, Poloniex, Crypto.com, Bitget, and DigiFinex.
194+
195+
For forex rates, it queries public APIs from foreign exchange data providers worldwide on a periodic basis.
196+
197+
### Rate aggregation
198+
199+
The XRC calculates rates using candlestick chart data for specific one-minute intervals across exchanges. Rather than time-weighted or volume-weighted averages, it collects, combines, and filters rates from all sources and returns the median. This approach minimizes manipulation risk. The XRC can also derive rates for pairs not directly traded (e.g., A/B from A/C and B/C rates).
200+
201+
### Interface
202+
203+
The XRC exposes a single endpoint:
204+
205+
```
206+
get_exchange_rate : (GetExchangeRateRequest) -> (GetExchangeRateResult)
207+
```
208+
209+
**Request:**
210+
211+
```candid
212+
type GetExchangeRateRequest = record {
213+
base_asset : Asset;
214+
quote_asset : Asset;
215+
timestamp : opt nat64;
216+
};
217+
```
218+
219+
`Asset` is a record with a `symbol` (e.g., `"BTC"`) and `class` (`Cryptocurrency` or `FiatCurrency`). Any combination of crypto and fiat is supported (e.g., ICP/USD, BTC/ICP, USD/EUR). If `timestamp` is omitted, the current rate is returned.
220+
221+
**Response:**
222+
223+
```candid
224+
type GetExchangeRateResult = variant {
225+
Ok : ExchangeRate;
226+
Err : ExchangeRateError;
227+
};
228+
```
229+
230+
### Cycle costs
231+
232+
Each request requires 1B cycles attached. If insufficient cycles are provided, the canister returns `ExchangeRateError::NotEnoughCycles`. The actual cost depends on the asset types and cache state:
233+
234+
| Condition | Actual cost |
235+
|---|---|
236+
| Served from cache | 20M cycles |
237+
| Both assets are fiat currencies | 20M cycles |
238+
| One asset is fiat or USDT | 260M cycles |
239+
| Both assets are cryptocurrencies | 500M cycles |
240+
241+
Unused cycles are refunded. At least 1M cycles are charged even on error, to prevent denial-of-service attacks.
242+
243+
### Example call
244+
245+
Calling the XRC requires attaching cycles, which is only possible from canister-to-canister calls. The CLI cannot attach cycles to direct calls. Call the XRC from a canister using the Candid interface — pass the required cycles in the `ic_cdk::api::call::call_with_payment128` call or equivalent.
246+
247+
To query the current rate without attaching cycles (for inspection only, expect a `NotEnoughCycles` error on mainnet):
248+
249+
```bash
250+
icp canister call uf6dk-hyaaa-aaaaq-qaaaq-cai get_exchange_rate \
251+
'(record {
252+
base_asset = record { symbol = "BTC"; class = variant { Cryptocurrency } };
253+
quote_asset = record { symbol = "USD"; class = variant { FiatCurrency } };
254+
})' \
255+
-e ic
256+
```
257+
258+
## SNS-W canister
259+
260+
The SNS Wasm canister (SNS-W) manages the deployment and upgrade of Service Nervous System (SNS) instances. The NNS controls which SNS Wasm binaries are blessed for deployment.
261+
262+
| Field | Value |
263+
|---|---|
264+
| Canister ID | [`qaa6y-5yaaa-aaaaa-aaafa-cai`](https://dashboard.internetcomputer.org/canister/qaa6y-5yaaa-aaaaa-aaafa-cai) |
265+
| Subnet | [`tdb26-jop6k-aogll-7ltgs-eruif-6kk7m-qpktf-gdiqx-mxtrf-vb5e6-eqe`](https://dashboard.internetcomputer.org/subnet/tdb26-jop6k-aogll-7ltgs-eruif-6kk7m-qpktf-gdiqx-mxtrf-vb5e6-eqe) (NNS subnet) |
266+
267+
The SNS-W canister stores blessed SNS Wasm binaries, creates new SNS instances, and coordinates SNS upgrades. When the NNS passes an SNS upgrade proposal, it installs the new Wasms on each SNS canister via SNS-W.
268+
269+
For governance context, see the [SNS documentation](https://learn.internetcomputer.org/hc/en-us/articles/34084394684564-SNS-Service-Nervous-System).
270+
271+
## Quick reference
272+
273+
| Canister | ID | Purpose |
274+
|---|---|---|
275+
| Bitcoin mainnet | `ghsi2-tqaaa-aaaan-aaaca-cai` | Bitcoin mainnet UTXO tracking |
276+
| Bitcoin testnet (v4) | `g4xu7-jiaaa-aaaan-aaaaq-cai` | Bitcoin testnet UTXO tracking |
277+
| ckBTC Ledger | `mxzaz-hqaaa-aaaar-qaada-cai` | ckBTC ICRC-1/ICRC-2 token ledger |
278+
| ckBTC Minter | `mqygn-kiaaa-aaaar-qaadq-cai` | BTC ↔ ckBTC minting and burning |
279+
| ckBTC Index | `n5wcd-faaaa-aaaar-qaaea-cai` | ckBTC transaction index |
280+
| ckETH Ledger | `ss2fx-dyaaa-aaaar-qacoq-cai` | ckETH ICRC-1/ICRC-2 token ledger |
281+
| ckETH Minter | `sv3dd-oaaaa-aaaar-qacoa-cai` | ETH ↔ ckETH minting and burning |
282+
| ckETH Index | `s3zol-vqaaa-aaaar-qacpa-cai` | ckETH transaction index |
283+
| EVM RPC | `7hfb6-caaaa-aaaar-qadga-cai` | Ethereum JSON-RPC proxy |
284+
| Exchange Rate (XRC) | `uf6dk-hyaaa-aaaaq-qaaaq-cai` | Crypto and forex exchange rates |
285+
| SNS-W | `qaa6y-5yaaa-aaaaa-aaafa-cai` | SNS deployment and upgrades |
286+
287+
## Next steps
288+
289+
- [Bitcoin guide](../guides/chain-fusion/bitcoin.md) — integrating Bitcoin in canisters using the Bitcoin canister and ckBTC
290+
- [Ethereum guide](../guides/chain-fusion/ethereum.md) — integrating Ethereum in canisters using the EVM RPC canister and ckETH
291+
- [System canisters](system-canisters.md) — NNS canisters, Internet Identity, ICP ledger, and other network-level canisters
292+
- [Management canister](management-canister.md) — the virtual canister for canister lifecycle, signing, and platform APIs
293+
294+
<!-- Upstream: informed by dfinity/portal — docs/references/system-canisters/index.mdx, docs/references/system-canisters/xrc.mdx, docs/references/ckbtc-reference.mdx, docs/building-apps/chain-fusion/ethereum/evm-rpc/overview.mdx, docs/defi/chain-key-tokens/cketh/overview.mdx, docs/defi/chain-key-tokens/ckerc20/overview.mdx; dfinity/icskills — skills/ckbtc/SKILL.md, skills/evm-rpc/SKILL.md, skills/icrc-ledger/SKILL.md -->

0 commit comments

Comments
 (0)