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

[Feature] Add Ed25519 key pair support #328

Closed
yxxyun opened this issue Apr 10, 2021 · 6 comments
Closed

[Feature] Add Ed25519 key pair support #328

yxxyun opened this issue Apr 10, 2021 · 6 comments

Comments

@yxxyun
Copy link

yxxyun commented Apr 10, 2021

XRPLF/xrpl-py#185

@yxxyun yxxyun changed the title [Feature] Add ED25519 key pair support [Feature] Add Ed25519 key pair support Apr 10, 2021
@WietseWind
Copy link
Member

WietseWind commented Apr 11, 2021

Ed25519 key pairs (both when imported from family seed or raw HEX private key entered in the family seed field) are already supported. I just double checked and I was able to import an ED family seed with no problems at all, and got the expected r-address from XUMM.

Even Tangem cards are supported with both ed and secp format.

Did you try it?

@yxxyun
Copy link
Author

yxxyun commented Apr 11, 2021

Forgot to mention, my ed25519 key is generated before XRPLF/rippled#2734
and is not generated by ripple-lib with "sEd" beginning string, so I guess it's a edge case.

@yxxyun yxxyun closed this as completed Apr 11, 2021
@WietseWind
Copy link
Member

WietseWind commented Apr 12, 2021

Did you try it, what happened?

@yxxyun
Copy link
Author

yxxyun commented Apr 12, 2021

eg:
seed: sarbwV6vkszxzHAYofms4L729UrMn
expect r-address: rLw7h2J9zRqtJMMCCxrp1zW4z1vJXbaBZp (ed25519)

shown r-address: rwNoP9mwDzsar1WiDNhur8BG7kvEdvd25Z (secp256k1)

@WietseWind
Copy link
Member

Ah, yeah, that one is pre ed prefix. Here's what we're going to do (for the upcoming version):

  • You'll have to get the HEX private key for the account
  • You can import the HEX private key into XUMM, using the Family Seed flow (but secretly importing the HEX private key)

Please note that this doesn't work yet, we'll have to implement something on our side as well.

To get the HEX private key:

  1. Create a node file (to execute later) (see below)
  2. Install npm install ripple-keypairs
  3. Modify ripple-keypairs in node_modules/ripple-keypairs/dist/index.js: change const algorithm = decoded.type === 'ed25519' ? 'ed25519' : 'ecdsa-secp256k1'; to const algorithm = options.algorithm === 'ed25519' ? 'ed25519' : 'ecdsa-secp256k1'; (so: decoded.type to options.algorithm)
const {deriveKeypair, deriveAddress} = require('ripple-keypairs')

const seed = 'sarbwV6vkszxzHAYofms4L729UrMn'
const keypair = deriveKeypair(seed, {algorithm: 'ed25519'})
const address = deriveAddress(keypair.publicKey)
console.log({keypair, address})

Then run (node ...js) and you'll get the HEX private key:
image

@WietseWind
Copy link
Member

@yxxyun Heads up: we added this and it'll be in our 2.0 release expected any day now. To do this (when you obtained the HEX private key), when importing an account: select full access - family seed. Then paste (QR scanner won't pick up on it) the full hex private key starting with ED in the family seed input and XUMM will recognize & handle it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants