Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hdet-ec-key

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hdet-ec-key

  • 1.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

= HDetEcKey

HDetEcKey is a Ruby implement of https://en.bitcoin.it/wiki/Deterministic_Wallet[Hierachical Deterministic wallets] according to the specification https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki[BIP0032].

== What is use for ?

== How to get it !

[source, bash]

git clone https://gitlab.com/elionne/hdet-ec-key.git

Or in a neer future:

[source, bash]

gem install hdet-ec-key

=== Prerequistes

  • Ruby 2.5.0
  • Openssl (ruby included)

Support of other version of Ruby should be possible.

== Usage

For more details about how Herarchical Deterministic Wallet works, please see the https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki[BIP0032] specifications.

=== Generate master key

First you need to generate the first key. The point where all keys starts. The BIP32 standard specify simple method with HMAC512. The default key is Bitcoin seed and the seed is choosen by the user.

To generate a master key:

[source, ruby]

seed = ["000102030405060708090a0b0c0d0e0f"].pack("H*") master_key = HDetEc::Key.generate_master_key(seed)

No convertion of the given string is operated, the seed is used as is. The key can be change by setting the second parameter:

[source, ruby]

master_key = HDetEc::Key.generate_master_key(seed, "my special key")

=== Public key, private and public derivation

To get the public key from the a key:

[source, ruby]

pub = master_key.public_key

or a more verbose version

pub = master.public_key_from_private

Then you can derive, ether public or private key:

[source, ruby]

pub.derive([0, 1, 2000]) master_key.derive(0, 1.h, 2000)

The derivation path is determined by an array of index. the #h function for interger means harderned index, only available for private key derivation.

=== Serialization

Each keys can be serialized in BIP32 specified form:

[source,ruby]

pub.serialize # xpub..... master_key.serialize # xprv.....

FAQs

Package last updated on 13 Mar 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc