# Private Key & Signature

ZkLink protocal requires two signature methods:

* ECDSA: Digital Signature Algorithm (DSA) which uses keys derived from elliptic curve cryptography (ECC)
* EdDSA: A digital signature scheme using a variant of Schnorr signature based on twisted Edwards curves. It is designed to be faster than existing digital signature schemes without sacrificing security.

## Account PrivateKey

The account private key is the EdDSA private key generated by the user through the Ethereum wallet private key signature, the signature signed by this private key also called [ZkLinkSignature](https://github.com/zkLinkProtocol/zklink-docs-gitbook/blob/main/developer/api-and-sdk/data_types.md#zklinksignature). The pseudocode method for private key generation is as follows:

```
msg = "Sign this message to create a key to interact with zkLink's layer3 services.\nNOTE: This application is powered by zkLink protocol.\n\nOnly sign this message for a trusted client!"
signature = eth_private_key.sign(msg)
seed = signature.serialize_packed()
eddsa_private_key = new_from_seed(seed)
```

for example

```
ecdsa_private_key = "0xbe725250b123a39dab5b7579334d5888987c72a58f4508062545fe6e08ca94f4"
seed = [26, 208, 188, 78, 155, 166, 203, 253, 121, 248, 112, 168, 98, 143, 117, 247, 223, 252, 97, 47, 9, 58, 70, 56, 185, 231, 144, 91, 43, 169, 89, 89, 117, 74, 199, 139, 225, 74, 115, 205, 214, 157, 63, 60, 214, 191, 152, 224, 193, 118, 235, 35, 36, 138, 7, 247, 152, 164, 128, 134, 71, 102, 193, 42, 27];
eddsa_private_key = new_from_seed(seed)
public_key = "0x7b173e25e484eed3461091430f81b2a5bd7ae792f69701dcb073cb903f812510"
msg = b"hello world"
zklink_signature = eddsa_private_key.sign(msg)
zlink_signature = "0xe396adddbd484e896d0eea6b248a339a0497f65d482112981d947fd71010c4022a40cc5a72b334e89a1601f71518dcaa05c56737e1647828fa822e94b1ff7501"
```

## L3 signature

The Layer3 transactions need to attach the ZkLink signature, to encode the transactions, see more in the [encode](https://github.com/zkLinkProtocol/zklink-docs-gitbook/blob/main/developer/api-and-sdk/private-key-and-signature/broken-reference/README.md) part.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zk.link/developer/api-and-sdk/private_key.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
