# Ecdsa key generation

**URL:** <https://forum.dfinity.org/t/ecdsa-key-generation/31397>\
**Category:** Developers\
**Created:** [May 31, 2024, 9:20am UTC](https://forum.dfinity.org/t/ecdsa-key-generation/31397 "2024-05-31T09:20:51Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![asjn3e](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/asjn3e/32/22792_2.png) [@asjn3e](https://forum.dfinity.org/u/asjn3e)\
**Post date:** [May 31, 2024, 9:20am UTC](https://forum.dfinity.org/t/ecdsa-key-generation/31397/1 "2024-05-31T09:20:51Z")

</div>

Hey everyone, i was going through ecdsa publick key generation api and i found these types

```auto
#[derive(CandidType, Serialize, Debug)]
struct ECDSAPublicKey {
    pub canister_id: Option<CanisterId>,
    pub derivation_path: Vec<Vec<u8>>,
    pub key_id: EcdsaKeyId,
}

#[derive(CandidType, Deserialize, Debug)]
struct ECDSAPublicKeyReply {
    pub public_key: Vec<u8>,
    pub chain_code: Vec<u8>,
}

```

can someone explain more about **derivation\_path** and **chain\_code**?

---

<div class="post-metadata">

**Author:** ![Vivienne](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/vivienne/32/29170_2.png) [@Vivienne](https://forum.dfinity.org/u/Vivienne)\
**Post date:** [May 31, 2024, 9:25am UTC](https://forum.dfinity.org/t/ecdsa-key-generation/31397/2 "2024-05-31T09:25:54Z")

</div>

The derivation path is a way for a canister to have multiple keys. If you want a different key per user of your canister you can e.g. use the user’s principal as a derivation path. Think of it like this: Your canister has an infinite amount of keys it can use, and the derivation path is the identifier of the key you want to use

chain code is explained in the [spec](https://internetcomputer.org/docs/current/references/ic-interface-spec#ic-ecdsa_public_key):

> The return result is an extended public key consisting of an ECDSA `public_key` , encoded in [SEC1](https://www.secg.org/sec1-v2.pdf) compressed form, and a `chain_code` , which can be used to deterministically derive child keys of the `public_key` .
