sui icon indicating copy to clipboard operation
sui copied to clipboard

crypto: use SLIP10 for ed25519 key derivation for ts and cli

Open joyqvq opened this issue 3 years ago • 1 comments

https://github.com/MystenLabs/sui/issues/4431 https://github.com/MystenLabs/sui/issues/4374

/// Ed25519 follows SLIP-0010 using hardened path with purpose = 44: m/44'/784'/{account_index}'/{change_index}'/{address_index}' /// Secp256k1 follows BIP-32 using path where the first 3 levels are hardened with purpose = 54: m/54'/784'/{account_index}'/{change_index}/{address_index}

  • added test cases such that ts and cli are in parity for both schemes.

  • verified importing the generated phrase is the same

target/debug/sui client                                                                                                                                                                                                                                                                                           Config file ["/Users/joy/.sui/sui_config/client.yaml"] doesn't exist, do you want to connect to a Sui RPC server [yN]?y
Sui RPC server Url (Default to Sui DevNet if not specified) :
Select key scheme to generate keypair (0 for ed25519, 1 for secp256k1):
0
Generated new keypair for address with scheme "ed25519" [0x98421d59a34f458b224cc86a4b4684ada2018dde]
Secret Recovery Phrase : [sick pact rapid trial chaos tube remain fringe actual clog machine bulb]

target/debug/sui keytool import "sick pact rapid trial chaos tube remain fringe actual clog machine bulb" ed25519 "m/44'/784'/0'/0'/0'" 
2022-09-13T20:34:31.672453Z  INFO sui::keytool: Key imported for address [0x98421d59a34f458b224cc86a4b4684ada2018dde]

target/debug/sui client new-address secp256k1 "m/54'/784'/0'/0/1"
Created new keypair for address with scheme Secp256k1: [0x713f7b94802d829c920a1c4c9ccbac8669205eb5]
Secret Recovery Phrase : [reveal confirm foot shock vacant adult melody category shy deposit hard pig]

target/debug/sui keytool import "reveal confirm foot shock vacant adult melody category shy deposit hard pig" secp256k1 "m/54'/784'/0'/0/1"
2022-09-13T20:37:06.849647Z  INFO sui::keytool: Key imported for address [0x713f7b94802d829c920a1c4c9ccbac8669205eb5]

joyqvq avatar Sep 08 '22 15:09 joyqvq

💳 Wallet Extension has been built, you can download the packaged extension here: https://github.com/MystenLabs/sui/actions/runs/3079216656#artifacts

github-actions[bot] avatar Sep 13 '22 20:09 github-actions[bot]