zkLink X Documentaion
HomeGitHubBlogExplorer
  • 🙂Welcome
    • Introduction
  • ⚖️Architecture
    • Overview
    • Settlement Layer
      • Working Principal of A Multi-Chain ZK-Rollup
      • Nexus: Settlement on ETH L2s
      • Origin: Settlement on ETH and Alt-L1s
      • Multi-Chain State Synchronization
        • In-Detail: Nexus Multi-Chain State Synchronization
      • Supported Networks of zkLink Nexus and Origin
      • Security Assumptions of zkLink Nexus and Origin
    • Execution Layer
      • TS-zkVM for App Rollup
    • Sequencing Layer
    • DA Layer
  • 🛠️Developer
    • Developer Overview
    • Get Started
    • Examples
      • Base Demo
    • JSON RPC & Websocket & Kafka
      • JSON-RPC API
      • JSON-RPC Errors
      • Websocket
      • Kafka
    • Transactions
      • Basic Types
      • State Update
      • Transaction
        • Deposit
        • FullExit
        • ChangePubKey
        • Withdraw
        • Transfer
        • ForcedExit
        • OrderMatching
        • AutoDeleveraging
        • ContractMatching
        • Funding
        • Liquidation
        • UpdateGlobalVar
      • Private Key & Signature
        • Algorithm
        • ChangePubKey
        • Withdraw
        • Transfer
        • ForcedExit
        • OrderMatching
        • ContractMatching
        • Funding
        • Liquidation
        • AutoDeleveraging
        • UpdateGlobalVar
    • SDK
      • Go
        • Types
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
      • Js
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
      • Dart
        • Signature
        • Utils
        • Transactions
          • ChangePubKey
          • Withdraw
          • Transfer
          • ForcedExit
          • OrderMatching
          • ContractMatching
          • AutoDeleveraging
          • Funding
          • Liquidation
          • UpdateGlobalVar
  • ⚙️Network Information
    • Connected Networks
      • Mainnet
      • Testnet
    • DApps & Deployment Addresses
      • Mainnet
      • Testnet
  • Wallet & User Fund Streamline
    • Withdraw
    • Wallet Integration & AA Wallet
    • Deposit
  • Integration Cases
    • Heavyweight Integration (Multi-Chain Derivatives & Spot Exchange)
    • Simple Integration (Multi-Chain Spot Exchange)
  • Appendix
    • Audits
    • FAQ
    • glossary
Powered by GitBook
On this page
  • Account PrivateKey
  • L3 signature

Was this helpful?

  1. Developer
  2. Transactions

Private Key & Signature

PreviousUpdateGlobalVarNextAlgorithm

Last updated 1 year ago

Was this helpful?

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 . 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.

🛠️
ZkLinkSignature