-
Notifications
You must be signed in to change notification settings - Fork 39
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
Added mnemonic generation of keys and recover from mnemonic to keypair #24
Conversation
Will need to do some more work on this one regards of better error handling and adding tests, but is this something that would have interest to merge? |
Hi @schlunsen I'm sorry for the delay, this can be implemented without adding more complexity to Rana? I mean, with this functionality the program will keep working as is working now? |
Yes the current functionality will stay intact. This just adds the possibility of generating keys with a mnemonic and to convert a mnemonic into a keypair |
Great! go for it 😃 |
Ready to merge! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update nostr-sdk to 0.16.2 ?
I did this
But it ignored the |
When running the mnemonic with vanity n together I expected something like this:
|
mnemonics also for vanity key and difficulty * If mnemonic is set rana will work as before and search for a vanity key or difficulta etc.y * Added bip39 crate * Refactored helper functions into utils.rs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR decreases performance dramatically, here a test like the one above
cargo run -- -n epale,h0la
Finished dev [unoptimized + debuginfo] target(s) in 0.08s
Running `target/debug/rana -n epale,h0la`
Started mining process for vanity bech32 prefix[es]: 'npub1["epale", "h0la"]' (estimated pow: 20)
Benchmarking of cores disabled for vanity npub key upon proper calculation.
Mining using 16 cores...
==============================================
Vanity npub found: h0la
Found matching public key: bbffd6f976714c77722d252db886139b94f34787c86aee4192a06e2c16f0dc94
Nostr private key: a52749475a271280108ca11d79706a0548abe26314712a2eb05c01778ef466d0
Nostr public key (npub): npub1h0lad7tkw9x8wu3dy5km3psnnw20x3u8ep4wusvj5phzc9hsmj2ql57p4u
Nostr private key (nsec): nsec155n5j366yufgqyyv5ywhjur2q4y2hcnrz3cj5t4stsqh0rh5vmgqs87gdv
56253 iterations (about 5x10^4 hashes) in 0 seconds. Avg rate 56253 hashes/second
We need to keep performance, which is a very important feature of Rana, can you please fix it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm testing the passphrase this way but I don't have the same keys, am I doing it wrong?
target/release/rana -g 12 -p test01
Mnemonic: pumpkin rich boost involve wrist monster drum attend fat ask ill skin
Public key: npub15rz0dcdvpy4tjrfu68lfmzj5ts0a3tdnru0twk992nt4x96g5mnq8nv64a
Private key: nsec1njaaue55ey5m7pjeesn5nvj7968sfkgz6rxwvudpfe5ahmuf7gyqgq0sf0
target/release/rana -r "pumpkin rich boost involve wrist monster drum attend fat ask ill skin" -p test01
Public key: npub1a3nxq9hzylv9g2y5papgqjj69p283tf7srv5dyymmec3ygv93szqg7egl0
Private key: nsec173t9hwt20ekvsttzkc0a72m0cum4sf3qmzgjrghzks0ft526t4jqnjd8jc
There is a bug with passphrase not being passed on to the loop. Will look into fixing it, but I'm currently fighting the borrow checker |
New changes with vanity suffix and qr has been merged into this branch and passphrase combined with mnemonic bug has been fixed |
This should close #10 |
Using mnemonic for generation is much slower and I'm currently only processing with an Avg rate 279 hashes/second, but it works :). Performance should be intact if mnemonic is not used |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK
It works like a charm!!!
Thanks for this contribution
No description provided.