A Dart library that supports the Topl blockchain.

Topl logo Code of Conduct License Github build status bip-topl code coverage @topl_protocol on Twitter

Topl Bip Library

Library for building Topl blockchain wallet mobile apps in Flutter. Please read the documentation for more information.


This project is a Topl blockchain on-ramp for Flutter/Dart mobile app developers. Currently a work in progress.

It will power the live Ribn wallet currently in active development.

Current Features

  • CIP-1852 HD Wallet Compatibility
    • Topl Specific BIP32 Deterministic Key Generator
  • BIP39 Compatible for Mnemonic Phrases
  • BIP32-ED25519 Extended Keys (used for signing transactions)
  • Key Generator tool utilizing PBKDF2 (for additional security around mnemonics)

Features In Active Development

  • create, broadcast and track transactions and fees
  • sign and validate messages
  • manage private and public keys
  • list, create, update or remove wallets

Planned Features

  • utilities for staking accounts
  • custom asset transactions
  • smart contracts

BIP32 Usage

import 'package:bip_topl/bip_topl.dart';
import 'package:pinenacl/x25519.dart';

void main() {
  const coder = HexCoder.instance;
  const derivator = Bip32Ed25519KeyDerivation.instance;
  const keyPair = {
  const address_ix = 0;
  // generate master public and private key from encoded keyPair
  final masterPrivateKey =
      Bip32SigningKey.decode(keyPair['xprv']!, coder: coder);
  final masterPublicKey = Bip32VerifyKey.decode(keyPair['xpub']!, coder: coder);
      .rawKey)); //4rUU8Ee5K6h663ByMBLRjXgs9GYsFsTiUFujbfSvDpKjFuEfErc9QFfs4F1fej5jJ6gwavr2zU66c6ASagaqyZcb
      masterPublicKey.rawKey)); //AinUA7J1kBiyvDZ8nPL8BoCE9PBxPjKzUfoyhpXAGTXn
  //BIP-44 path: m / purpose' / coin_type' / account_ix' / change_chain / address_ix
  //You can iterate through a CIP-1852 path by deriving based on each index at a time. For this example, we will only use one idx.
  final derivedPrv = derivator.ckdPriv(masterPrivateKey, address_ix);
  final derivedPub = derivator.ckdPub(masterPublicKey, address_ix);
      .rawKey)); //2JAppvWBAgmd7B6s1XDcNPrxtSfT5MCcnhuVxeNKLYHyyqa3U9FE6BD85QPVtn6iWAisSq2WKyvbZFzmEA1rYbMP
      derivedPub.rawKey)); //AGj1p3atP5m2UVxXrBBtmniWQyV4HZGkVesii922zwj6

BIP39 Usage

// BIP39 Mnemonics

// Can be used to generate the root key of a given HDTree, an address, or simply convert bits to mnemonic for human friendly value

// For more details about the protocol, see
// [Bitcoin Improvement Proposal 39](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki)

import 'dart:math';

import 'package:bip_topl/bip_topl.dart';

void main() {
  const mnemonic =
      'legal winner thank year wave sausage worth useful legal winner thank yellow';

  // mnemonic to entropy
  final entropy = mnemonicToEntropy(mnemonic, 'english');
  print(entropy); // 7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f7f

  // mnemonic to seedHex
  // accepts an optional passphrase to strengthen the security of the mnemonic
  final seedHex = mnemonicToSeedHex(mnemonic, passphrase: 'TREZOR');
      seedHex); //2e8905819b8723fe2c1d161860e5ee1830318dbf49a83bd451cfb8440c28bd6fa457fe1296106559a3c80937a1c1069be3a3a5bd381ee6260e8d9739fce1f607

  //entropy to mnemonic
  final code = entropyToMnemonic(entropy);
      code); //legal winner thank year wave sausage worth useful legal winner thank yellow

  // validate Mnemonic
  final validation = validateMnemonic(code, 'english');
  print(validation); // true

  // generateMnemonic with 15 words
  final words = generateMnemonic(Random.secure(), strength: 160);
  print(words); // should be random 15 word mnemonic


Please follow the Contribution Guidelines


Similar libraries in other languages


SLIP-0023 BIP-0032 BIP-0044 CIP-1852


Support for doing something awesome.