Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
Signed-off-by: Denis Varlakov <[email protected]>
  • Loading branch information
survived committed Sep 27, 2024
1 parent 8acb423 commit 93dd03b
Showing 1 changed file with 17 additions and 25 deletions.
42 changes: 17 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,32 @@
# SLIP-10: Deterministic key generation
# # HD wallets derivation

[SLIP10][slip10-spec] is a specification for implementing HD wallets. It aims at supporting many
curves while being compatible with [BIP32][bip32-spec].
This crate supports the following HD derivations:
* [SLIP10][slip10-spec] (compatible with [BIP32][bip32-spec]), see `Slip10`
* Non-standard `Edwards` derivation for ed25519 curve

The implementation is based on generic-ec library that provides generic
elliptic curve arithmetic. The crate is `no_std` and `no_alloc` friendly.
To perform HD derivation, use `HdWallet` trait.

### 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
### Example: SLIP10 derivation

Derive a master key from the seed, and then derive a child key m/1<sub>H</sub>/10:
```rust
use slip_10::supported_curves::Secp256k1;
use hd_wallet::{HdWallet, Slip10, 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 master_key = hd_wallet::slip10::derive_master_key::<Secp256k1>(seed)?;
let master_key_pair = hd_wallet::ExtendedKeyPair::from(master_key);

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

### Features
* `std`: enables std library support (mainly, it just implements `Error`
trait for the error types)
* `curve-secp256k1`, `curve-secp256r1`, `curve-ed25519` add curve implementation into the crate
curves module

[slip10-spec]: https://github.com/satoshilabs/slips/blob/master/slip-0010.md
[bip32-spec]: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki

0 comments on commit 93dd03b

Please sign in to comment.