bitcoin_bip32 0.1.0

  • Example
  • Installing
  • Versions
  • new54


pub package

An implementation of the BIP32 spec for Hierarchical Deterministic Bitcoin addresses. No superimposing wallet structure has been defined.


You can use this library in two ways; one with a serialized public or private HD key or with a hex encoded seed.

Look at the tests to see more elaborate uses.

With a seed

  Chain chain = Chain.seed(hex.encode(utf8.encode("some seed")));
  ExtendedPrivateKey key = chain.forPath("m/0/100");
  // => xprv9ww7sMFLzJN5LhdyGB9zfhm9MAVZ8P97iTWQtVeAg2rA9MPZfJUESWe6NaSu44zz44QBjWtwH9HNfJ4vFiUwfrTCvf7AGrgYpXe17bfh2Je

The key has a field called key which contains a BigInt. This is the actual key.

Importing a HD private key

  Chain chain = Chain.import("xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi");
  ExtendedPrivateKey childKey = chain.forPath("m/0/100");

Importing a HD public key

  Chain chain = Chain.import("xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8");
  ExtendedPublic childKey = chain.forPath("M/0/100");

The key has a field called q which contains a ECPoint. This is the actual key.

Please note that trying to generate a private key from a public key will throw an exception.


There is a tiny chance a child key derivation fails. Please catch the appropriate exceptions in your code.

These exceptions are:

  • KeyZero
  • KeyBiggerThanOrder
  • KeyInfinite


Add it to your pubspec.yaml:

  bip32: ^0.1.0


Without the guiding code of go-bip32 and money-tree projects this library would have been a significantly bigger struggle.


  • Initial release


import 'dart:convert';
import 'package:convert/convert.dart';
import "package:bitcoin_bip32/bitcoin_bip32.dart";

void main() {
  Chain chain = Chain.seed(hex.encode(utf8.encode("some seed")));
  ExtendedPrivateKey key = chain.forPath("m/0/100");

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  bitcoin_bip32: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:bitcoin_bip32/bitcoin_bip32.dart';
Version Uploaded Documentation Archive
0.1.0 Oct 30, 2018 Go to the documentation of bitcoin_bip32 0.1.0 Download bitcoin_bip32 0.1.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Nov 14, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0
  • pana: 0.12.6


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:bitcoin_bip32/bitcoin_bip32.dart.

Health suggestions

Format lib/src/crypto.dart.

Run dartfmt to format lib/src/crypto.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
base58check ^1.0.1 1.0.1
convert ^2.0.2 2.0.2
pointycastle ^1.0.0-rc4 1.0.0-rc4
Transitive dependencies
charcode 1.1.2
collection 1.14.11
crypto 2.0.6
typed_data 1.1.6
Dev dependencies
test ^1.3.4