bitcoin_bip44 0.1.1

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new49

BIP44

pub package

An implementation of the BIP44 spec for organizing Hierarchical Deterministic Bitcoin addresses. Based on the BIP32 spec.

Examples

var bip44 = Bip44("<some hex seed>");
List<Account> accounts = bip44.coins[0].accounts // coin 0 is bitcoin

Discovery

The specification mandates that accounts, and ultimately addressess, are discoverable. Currently only two remote sources can be queried: Blockchair and Blockstream. The Scanner interface should make it easier to add sources.

Supported coins

It is trivial to add more iff the coin appears in SLIP44.

  • Bitcoin
  • Testnets
  • Litecoin

Installing

Add it to your pubspec.yaml:

dependencies:
  bitcoin_bip44: ^0.1.0

TODO

  • Make the scanners robust versus exceptions thrown by the remotes
  • Add Scanner for locally run Bitcoin node
  • Only the first scanner is ever used
  • Only traditional Bitcoin addresses (starting with a '1') are scanned for, add segwit
  • Add 'Address gap limit'
  • Cache address scanning

Licence overview

All files in this repository fall under the license specified in COPYING. The project is licensed as AGPL with a lesser clause. It may be used within a proprietary project, but the core library and any changes to it must be published online. Source code for this library must always remain free for everybody to access.

v0.1.1

  • Add Future imports to satify dartanalyzer v0.1.0
  • Initial release

example/main.dart

import "package:bitcoin_bip44/bitcoin_bip44.dart";

void main() {
  Bip44 bip44 = Bip44(toHexString("some seed"));
  Coin bitcoin = bip44.coins[0];
  account = Account(bitcoin, 0, changeExternal);
  Address unUsed = account.nextUnusedAddress();

  // Add a scanner of your own:
  scanners = [MyOwnScanner()];
}

class MyOwnScanner {
  Future<bool> present(String address) {
    // Total nonsense!
    if (address.endsWith('b')) {
      return Future.value(false);
    }
    return Future.value(true);
  }
}

String toHexString(String original) {
  return original.codeUnits
      .map((c) => c.toRadixString(16).padLeft(2, "0"))
      .toList()
      .join("");
}

Use this package as a library

1. Depend on it

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


dependencies:
  bitcoin_bip44: ^0.1.1

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_bip44/bitcoin_bip44.dart';
  
Version Uploaded Documentation Archive
0.1.1 Nov 22, 2018 Go to the documentation of bitcoin_bip44 0.1.1 Download bitcoin_bip44 0.1.1 archive
0.1.0 Nov 22, 2018 Go to the documentation of bitcoin_bip44 0.1.0 Download bitcoin_bip44 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
4
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
49
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.7

Platforms

Detected platforms: Flutter, web, other

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

Health issues and suggestions

Document public APIs (-9.56 points)

43 out of 45 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
bech32 ^0.1.0 0.1.1
bitcoin_bip32 ^0.1.0 0.1.0
http ^0.12.0 0.12.0
pointycastle ^1.0.0-rc4 1.0.0-rc4
Transitive dependencies
async 2.0.8
base58check 1.0.1
charcode 1.1.2
collection 1.14.11
convert 2.0.2
crypto 2.0.6
http_parser 3.1.3
meta 1.1.6
path 1.6.2
source_span 1.4.1
string_scanner 1.0.4
typed_data 1.1.6
Dev dependencies
hex ^0.1.2
mock_web_server
test ^1.3.4