Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for sr25519 accounts #35

Closed
matevz opened this issue Feb 27, 2023 · 3 comments
Closed

Add support for sr25519 accounts #35

matevz opened this issue Feb 27, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@matevz
Copy link
Member

matevz commented Feb 27, 2023

Oasis CLI currently supports ed25519 and secp256k1 wallets. Add suport for sr25519 as well. Also test, if signing with Ledger works (implemented in #11).

@matevz matevz added the enhancement New feature or request label Feb 27, 2023
@matevz
Copy link
Member Author

matevz commented May 22, 2023

I did some research today how Polkadot uses sr25519.

Key derivation:

  • they do not use standard bip32 derivation, but their own substrate derivation obtaining "soft" and "hard" keys.
  • I tested Enkrypt and Polkagate wallets and they derive the same substrate addresses for the given mnemonic.
  • Ledger's Polkadot nano app (developed by Zondax) do not implement substrate, but a bip44-like derivation using m/44'/354'/account'/0'/0' path. This gives incompatible addresses with Enkrypt and Polkagate.
  • Importing Polkadot accounts is done via .json files or the mnemonic. No "Enter private key:" fields exist in the wallets.

Addresses:

  • Polkadot addresses use Base58 encoding.
  • Three types of addresses based on the prefix: Polkadot (0), Kusama (2) and Generic Substrate (42).

For better interoperability with Polkadot, I suggest we split the sr25519 work into:

  • use Polkadot derivation path library (and add new account type sr25519-substrate?)
  • use the ledger's way of deriving the account (PR Add sr25519 support #76, sr25519-bip44?)
  • define Polkadot -> Oasis address mapping (similar to what we did for ethereum)
  • show sr25519 addresses in Polkadot's Base58 format
  • support importing Polkadot wallets from JSON-encoded export file (I think this eventually generates sr25519-substrate type then)

@kostko
Copy link
Member

kostko commented May 22, 2023

I wouldn't support any of the interoperability stuff for now as there does not seem to be a clear use case. Implementing only the simplest correct scheme (compatible with Ledger) for now makes the most sense.

@matevz
Copy link
Member Author

matevz commented Dec 12, 2023

Implemented in #119

@matevz matevz closed this as completed Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants