Code Monkey home page Code Monkey logo

hdwallet's Introduction

HDWallet

Crates.io MIT licensed Docs

HD wallet(BIP-32) key derivation utilities.

This crate is build upon secp256k1 crate, this crate only provides BIP-32 related features, for signature features see the secp256k1 documentation.

  • [ChainPath] and [KeyChain] are used to derive HD wallet keys.
  • [Derivation] describes key derivation info.
  • [ExtendedPrivKey] and [ExtendedPubKey] represent extended keys according to BIP-32, which can derives child keys.
  • [KeyIndex] indicates child key's index and type(Normal key or Hardened key).
  • [Error] errors.

hdwallet itself is a key derivation framework. Check hdwallet-bitcoin if you want to derive bitcoin keys; you can find or submit other crypto currencies on hdwallet homepage.

Documentation

License

MIT

hdwallet's People

Contributors

jjyr avatar kouky avatar nuttycom avatar rodoufu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

hdwallet's Issues

bitcoin_hdwallet example error

The key should be changed to extended_key. Otherwise, it will fail to compile.
let (extended_key, derivation) = key_chain.derive_private_key("m/1H/0".into()).expect("derive ExtendedPrivKey");
let key = BitcoinPrivKey { network: BitcoinNetwork::MainNet, derivation, extended_key, };

Update secp256k1 to 0.23?

The secp256k1 crate updated and has some more developed features, including using a much newer version of the rand crate. It would be nice if we could switch to that to avoid duplicating dependencies.

Full derivation path support

I've been looking for a way to derive for paths like m/44'/9004'/0'/0 and I can't work out how to reach there using this lib.
Do you have an example on how to do it?

Update ring version due to vulnerability problem

The actual version of the project is pointing to ring = "0.14.0" which has a dependency to spin = "0.5.0" and this version has a vulnerability problem.
https://github.com/jjyr/hdwallet/blob/master/Cargo.toml#L20

It's possible to update the ring to ring = "0.16.9" which is using the spin = "0.5.2"
https://github.com/briansmith/ring/blob/master/Cargo.toml#L307

error: Vulnerable crates found!

ID:	 RUSTSEC-2019-0013
Crate:	 spin
Version: 0.5.0
Date:	 2019-08-27
URL:	 https://github.com/mvdnes/spin-rs/issues/65
Title:	 Wrong memory orderings in RwLock potentially violates mutual exclusion
Solution: upgrade to: >= 0.5.2

`random_with_seed_size` is producing an empty seed

seed in:

hdwallet/src/key.rs

Lines 46 to 55 in c86ed6a

/// Generate an ExtendedPrivKey which use 128 or 256 or 512 size random seed.
pub fn random_with_seed_size(seed_size: KeySeed) -> Result<ExtendedPrivKey, Error> {
let seed = {
let mut seed = Vec::with_capacity(seed_size as usize);
let mut rng = rand::thread_rng();
rng.fill(seed.as_mut_slice());
seed
};
Self::with_seed(&seed)
}

is a 0-lenght Vec, rng.fill(seed.as_mut_slice()); is a noop (you get a mutable 0-size slice).

Proper approach is to use a zero-ed vector (vec![0; len]) or after creating a Vec with capacity to use the unsafe set_len (although you have to make sure the bytes aren't being read, as it opens you up to potential memory exploits if they are).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.