xrpl-dev-portal icon indicating copy to clipboard operation
xrpl-dev-portal copied to clipboard

Added key pair sample code

Open TusharPardhe opened this issue 2 years ago • 6 comments

XRPL bounty sample for DGE-94 Milestone 1


The goal of this bounty is to support JavaScript for all of the code samples. Milestone 1 is Cryptographic Key Derivation, previously available only in Python.

TusharPardhe avatar Sep 03 '22 11:09 TusharPardhe

Seems too high level for a sample code. I think you'd need to use a crypto lib to derive the keypairs from a seed in a low level manner.

wojake avatar Sep 03 '22 12:09 wojake

Can pull the implementation from xrpl.js or go more deeper but first want to know whether we need to be precise with the examples using ripple libs or have to write them from scratch.

TusharPardhe avatar Sep 03 '22 14:09 TusharPardhe

Using the implementation used on xrpl.js would be fine (i guess)

wojake avatar Sep 03 '22 15:09 wojake

Using the implementation used on xrpl.js would be fine (i guess)

As suggested, updated the code to derive ed25519 key pairs.

TusharPardhe avatar Sep 03 '22 17:09 TusharPardhe

Thanks for the info, that's exactly what I was looking for. I will update the code plus will suggest to make bounties more descriptive as we move ahead.

TusharPardhe avatar Sep 08 '22 10:09 TusharPardhe

I think we want this to have the same scope as the Python key derivation code sample. That means:

* No using Ripple or XRPLF libraries for seed derivation. It's OK to use them for base58 encoding since that's not the point of this sample. (Hint: all 16-byte UInts are valid seeds for Ed25519 keys, so you just need to generate a random number using a cryptographically-secure source of randomness.)

* Should cover both ed25519 and secp256k1 derivation. That's important because secp256k1 derivation is significantly more complicated.

This code sample accurately handles the easiest part (using an off-the-shelf crypto library to derive a Ed25519 key pair from seed) but doesn't cover some of the more challenging aspects of the code it's supposed to port, so this is incomplete thus far.

Thanks for the info, that's exactly what I was looking for. I will update the code plus will suggest to make bounties more descriptive as we move ahead.

I have updated the code as per your comments. @mDuo13 Please review.

TusharPardhe avatar Sep 08 '22 12:09 TusharPardhe

Here's the updated link to the bounty referred to in this PR: https://github.com/XRPLBounties/Proposals/blob/main/bounties/0031%20JavaScript%20Code%20Samples.md

JST5000 avatar Sep 27 '22 21:09 JST5000

@JST5000 @mDuo13 @mvadari Is this bounty complete? If not can you go through the current code, I think its now somewhat equivalent to the python code.

TusharPardhe avatar Oct 05 '22 22:10 TusharPardhe

@JST5000 @mDuo13 @mvadari Is this bounty complete? If not can you go through the current code, I think its now somewhat equivalent to the python code.

I'll check today. Sorry for the delay - didn't get a notification for this message for some reason :/

JST5000 avatar Oct 10 '22 20:10 JST5000

Thanks @jonathanlei and @JST5000. What do I have to do next to get the PR merged?

TusharPardhe avatar Oct 12 '22 21:10 TusharPardhe

Hey @TusharPardhe we have decided to accept your work for the bounty, but ended up merging a different submission (#1507).

I'm going to close this PR, but please submit to claim the bounty - you will receive the full amount for your the unique contribution

Here's the form to claim a bounty: https://xrpl.typeform.com/xrpl-bounties

JST5000 avatar Oct 13 '22 21:10 JST5000

Ahh I would suggest updating the bounty page so we don't have similar PRs (It'll get difficult for the reviewers as well). Also, thank you for considering my code as well its always a good experience to learn more about XRPL.

Looking forward for more contributions!

TusharPardhe avatar Oct 13 '22 22:10 TusharPardhe