Closed elichai closed 6 years ago
@elichai Keys for secp256k1 are just random 32 bytes array. And in libsecp256k1 we have SecretKey::random(...)
that allows you to pass an Rng to it. So for example, you can do:
SecretKey::random(&mut OsRng::new().unwrap())
devp2p-rs (https://source.that.world/source/devp2p-rs) is one of the example where libsecp256k1 is used. Let me know if there's anything confusing!
Nope, nothing confusing.
If anyone is having problems understanding, you can also generate a key using your own randomness via:
let priv = SecretKey::parse(&random_32_slice).unwrap();
Hi, I couldn't find an example on how to use this library. There's no context/generate_keypair function like in the rust-secp256k1: https://github.com/rust-bitcoin/rust-secp256k1/blob/master/src/lib.rs#L484
Thanks, Elichai.