Hello, I’m a beginner in dfinity and i’m learning it though the tutorial examples given in dfinity documentation. I’m trying to create a public key using secp256k1 hash given in canister_client’s Agent module:
But i’m unable to deploy the project. it shows me errors.
How can i create a public key and verify it from the canister ??
I’m sharing the screenshot of my code with you to understand my problem.
please help me on this.
However, using ic-cdk together with crates from the ic repo would lead to dependency conflicts. I’d advise you to use https://crates.io/crates/ic-agent instead of ic-canister-client. If for some reason you must use ic-canister-client, then you should not use ic-cdk.
If you use ic-agent, you should import it as:
use ic_agent::Agent;
The ic-agent documentation ic_agent - Rust has examples of how to use it.
As for secp256k1, you should use version 0.6.0, in your rust code import it as:
use libsecp256k1::*;
I don’t know what you are trying to build, but if you are trying to build a canister, you need to set compiler target to wasm32-unknown-unknown. Also, neither ic-agent or ic-canister-client are meant to be used by a canister, they (and their dependencies) won’t be able to compile to wasm target.
If you are trying to build a standalone client that communicates with IC, then you most likely don’t want to use crate-type=["cdylib"].
There are other syntax errors in your rust code. I am sorry you are having trouble, but I’m afraid this forum is not the right venue for learning Rust.