Links

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. 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"
private key

L3 signature

The Layer3 transactions need to attach the ZkLink signature, to encode the transactions, see more in the encode part.