rooch-network / rooch

VApp Container with Move Language
https://rooch.network
Apache License 2.0
157 stars 83 forks source link

[addresses] design and implementation of the Rooch address mapped keyring #558

Open feliciss opened 1 year ago

feliciss commented 1 year ago

I propose a new design implementation of Rooch address mapped keyring, implementing from current built-in schemes to an unanimous address generated from Ed25519 crypto scheme, i.e. Rooch address from the first key pair and auth key in Ed25519.

Design outlined as below:

Untitled-2023-07-22-0953-2

Implementation in an interactive language:

  1. Init an initial key pair and auth key from an Ed25519 crypto scheme.
    rooch init                                          
    Creating config file ["/Users/system/.rooch/rooch_config/rooch.yaml"] with default server and ed25519 crypto scheme.
    Generated new keypair for address with scheme "ed25519" [0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46]
    Secret Recovery Phrase : [claim sibling public noble banana change hip capable dwarf visa riot adult]
    StoreConfig init store dir "/Users/system/.rooch/roochdb/rooch_store" "/Users/system/.rooch/roochdb/moveos_store"
    "Rooch config file generated at /Users/system/.rooch/rooch_config/rooch.yaml"
{
  "0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46": {
    "Ed25519": "ABRggKyKpggqHJRxQq6UkRA6ym0zQ8YVs/HkhW0PfY7B"
  }
}
  1. Update the address with the same mnemonic phrase generated from step 1 and an ECDSA crypto scheme to add ECDSA key pair and auth key to the address.
    rooch account update -a 0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46 -s ecdsa "claim sibling public noble banana change hip capable dwarf visa riot adult"
    "claim sibling public noble banana change hip capable dwarf visa riot adult"
    0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46
    Generated a new keypair for an existing address on scheme "ecdsa" [0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46]
{
  "0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46": {
    "Ed25519": "ABRggKyKpggqHJRxQq6UkRA6ym0zQ8YVs/HkhW0PfY7B",
    "Ecdsa": "AnVj/O1nt0mZDirvD6XHyevFhrpiLlqt510RGhD5VZBt"
  }
}
  1. Update the address with the same mnemonic phrase generated from step 1 and a Schnorr crypto scheme to add Schnorr key pair and auth key to the address.
    rooch account update -a 0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46 -s schnorr "claim sibling public noble banana change hip capable dwarf visa riot adult"
    "claim sibling public noble banana change hip capable dwarf visa riot adult"
    0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46
    Generated a new keypair for an existing address on scheme "schnorr" [0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46]
{
  "0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46": {
    "Ed25519": "ABRggKyKpggqHJRxQq6UkRA6ym0zQ8YVs/HkhW0PfY7B",
    "Ecdsa": "AnVj/O1nt0mZDirvD6XHyevFhrpiLlqt510RGhD5VZBt",
    "Schnorr": "A8Zf9N/CnrvJ3BCpUvG/sazDrpv9oQ6KEDnGzZaFdozj"
  }
}

Final result of the accounts in a wallet:

rooch account list                                  
                     Rooch Address (Ed25519)                       |               Public Key (Base64)                | Scheme  | Active
----------------------------------------------------------------------------------------------------------------------------------------
0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46 |   ANnjC7DmK4jCp82Mx618TnZtFcR8+HWD4mC+jtyQ7q+Q   | ed25519 |  True 
0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46 | AgOHliFOMvoWvIrZvYs0yjLpX1W4FzSgc4HcIQHTT/1wRw== |  ecdsa  |  True 
0xcdae48e2a4cb5f0062a7467f8c6d244e102dc0adfc5736332b81e0354b24ca46 |   A6dn5PRBt6wLcGA/WOgKQca9OH0r0g/1YcOuEVCnE7zw   | schnorr |  True

Tha wallet contains 3 different crypto schemes: Ed25519, ECDSA and Schnorr.

Tasks divided to achieve the designed goal:

  1. 548

  2. 556

  3. 557

  4. 574

  5. 577

  6. 595

  7. 599

jolestar commented 7 months ago

We do not support multi-chain private keys in cli, make this TBD.