| Crates.io | icx |
| lib.rs | icx |
| version | 0.44.1 |
| created_at | 2021-04-16 02:33:08.416761+00 |
| updated_at | 2025-09-15 14:20:55.607307+00 |
| description | CLI tool to call canisters on the Internet Computer. |
| homepage | https://docs.rs/icx |
| repository | https://github.com/dfinity/agent-rs |
| max_upload_size | |
| id | 385174 |
| size | 118,990 |
icxA command line tool to use the ic-agent crate directly. It allows simple communication with
the Internet Computer.
icxTo install icx you will have to build it locally, using cargo. Make a clone of this repository,
then in it simply run cargo build:
git clone https://github.com/dfinity/agent-rust.git
cd agent-rust
cargo build
The output executable will be in target/debug/icx.
icxTo get help, simply use icx --help.
To read a PEM file, you can pass it with the --pem argument. The PEM file must be a valid
key that can be used for the Internet Computer signing and validation.
For non-IC networks, pass --fetch-root-key to fetch the root key. When this argument is not present,
icx uses the hard-coded public key.
To call the management canister's create_canister function, you can use the following:
icx update aaaaa-aa create_canister
If you have a candid file, you can use it to validate arguments. Pass it in with the
--candid=path/to/the/file.did argument:
icx query 75hes-oqbaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q greet --candid=~/path/greet.did '("World")'
Pass --serialize when use icx update and icx query will serialize the signed canister call message as json.
The output will print to stdout. When use icx update, a corresponding request_status message is also generated and printed to stderr.
In the default IC project generated with dfx new and the local emulator has started with dfx start --background.
icx --fetch-root-key update --serialize rwlgt-iiaaa-aaaaa-aaaaa-cai greet '("everyone")' > output.txt
head -n 1 output.txt > update.json
tail -n 1 output.txt > request_status.json
rwlgt-iiaaa-aaaaa-aaaaa-caiis the ID of hello canister in the default project.
cat update.json | icx send
...
RequestID: 0x1234....
cat request_status.json | icx --fetch-root-key send
...
("Hello, everyone!")
When sending message to the IC main net, all --fech-root-key are not required. So the sign step can be executed on an air-gapped machine.