https://github.com/dfinity/candid-extractor
A CLI tool to extract the Candid interface from a Canister WASM.
https://github.com/dfinity/candid-extractor
Last synced: 2 months ago
JSON representation
A CLI tool to extract the Candid interface from a Canister WASM.
- Host: GitHub
- URL: https://github.com/dfinity/candid-extractor
- Owner: dfinity
- License: apache-2.0
- Created: 2024-10-10T17:32:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-10-24T12:01:55.000Z (6 months ago)
- Last Synced: 2026-01-16T08:29:48.947Z (3 months ago)
- Language: Rust
- Size: 57.6 KB
- Stars: 5
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# candid-extractor
A CLI tool to extract the Candid interface from a Canister WASM.
## Installation
```
cargo install candid-extractor
```
You can also use `cargo-binstall` if it's available.
```
cargo binstall candid-extractor
```
## Usage
```
candid-extractor path/to/canister.wasm
```
The Candid interface will be printed to stdout.
## Prerequisites for Canisters
`candid-extractor` can extract the Candid interface if the Canister meets the following requirements:
* Exports a memory named "memory".
* Exports a function named "get_candid_pointer", which returns an index within the "memory".
* If "memory" is 32-bit, the function should return an `i32`.
* If "memory" is 64-bit, the function should return an `i64`.
* The Candid interface should be encoded in UTF-8 and stored in "memory" starting from the returned index.
* A "NUL terminator" (byte 0x00) should be added at the end of the data if additional content exists after it in "memory".