I have a motoko-based canister that I’d like to construct a self-authenticating principal for. I mean to retrieve the canister’s public key using the ecdsa_public_key
function that is present within the canister manager interface. After retrieving the public key, how do I go about manipulating that public key in order to get a self-authenticating principal from it?
You hash it and add the 0x02 byte to the hash
May I ask why?
And another question to anyone who can answer: will that principal be the same as the canister principle?
No, the canister principal is essentially like a serial number.
Thank you! some functions within the NNS’s governance canister are required to be called using a self-authenticating principal. So I’ve got to derive one in order to use them.
So how are you making the call, if not an inter canister call whereby the canister principal is the caller?
Do you need ecdsa_public_key
to call the NNS canister?
I might be missing something
I make the call via an HTTP outcall where the body is a request that has been signed by the canister and the sender of the call is the self-authenticating principal that I derive from the ecdsa_public_key
.
I see. So a HTTP out to icp-api.io?
Curious to learn what we gain from this compared to inter canister call to nns?