4 releases (breaking)

0.4.0 Jun 20, 2024
0.3.0 May 17, 2024
0.2.0 Mar 1, 2024
0.1.0 Feb 16, 2024

#446 in Cryptography

Download history 105/week @ 2024-03-13 42/week @ 2024-03-20 146/week @ 2024-03-27 206/week @ 2024-04-03 154/week @ 2024-04-10 132/week @ 2024-04-17 90/week @ 2024-04-24 118/week @ 2024-05-01 102/week @ 2024-05-08 208/week @ 2024-05-15 105/week @ 2024-05-22 147/week @ 2024-05-29 118/week @ 2024-06-05 257/week @ 2024-06-12 226/week @ 2024-06-19 25/week @ 2024-06-26

652 downloads per month
Used in 3 crates

MIT/Apache

29KB
436 lines

SLIP-10: Deterministic key generation

SLIP10 is a specification for implementing HD wallets. It aims at supporting many curves while being compatible with BIP32.

The implementation is based on generic-ec library that provides generic elliptic curve arithmetic. The crate is no_std and no_alloc friendly.

Curves support

Implementation currently does not support ed25519 curve. All other curves are supported: both secp256k1 and secp256r1. In fact, implementation may work with any curve, but only those are covered by the SLIP10 specs.

The crate also re-exports supported curves in supported_curves module (requires enabling a feature), but any other curve implementation will work with the crate.

Features

  • std: enables std library support (mainly, it just implements Error trait for the error types)
  • curve-secp256k1 and curve-secp256r1 add curve implementation into the crate supported_curves module

Examples

Derive a master key from the seed, and then derive a child key m/1H/10:

use slip_10::supported_curves::Secp256k1;

let seed = b"16-64 bytes of high entropy".as_slice();
let master_key = slip_10::derive_master_key::<Secp256k1>(seed)?;
let master_key_pair = slip_10::ExtendedKeyPair::from(master_key);

let child_key_pair = slip_10::derive_child_key_pair_with_path(
    &master_key_pair,
    [1 + slip_10::H, 10],
);

Dependencies

~1.6–2.8MB
~54K SLoC