0 purchases
wallet utils
wallet_utils #
A dart Ravencoin library, that is easily expandable for many utxo-based chains, based on bitcoin_flutter and inspired by bitcoinjs.
Released under the terms of the MIT LICENSE.
Examples #
import 'package:wallet_utils/wallet_utils.dart';
import 'package:bip39/bip39.dart' as bip39;
main() {
var seed = bip39.mnemonicToSeed(
'praise you muffin lion enable neck grocery crumble super myself license ghost');
var hdWallet = new HDWallet.fromSeed(seed);
print(hdWallet.address);
// => RAvfPKTnn4Ay7tjkhF1gW6d3cKNfcQgne8
print(hdWallet.pubKey);
// => 0360729fb3c4733e43bf91e5208b0d240f8d8de239cff3f2ebd616b94faa0007f4
print(hdWallet.privKey);
// => 01304181d699cd89db7de6337d597adf5f78dc1f0784c400e41a3bd829a5a226
print(hdWallet.wif);
// => KwG2BU1ERd3ndbFUrdpR7ymLZbsd7xZpPKxsgJzUf76A4q9CkBpY
var wallet =
Wallet.fromWIF('Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct');
print(wallet.address);
// => RHSMp6LmCFXyGNGh6AdwrKj5hz22KCGP8a
print(wallet.pubKey);
// => 03aea0dfd576151cb399347aa6732f8fdf027b9ea3ea2e65fb754803f776e0a509
print(wallet.privKey);
// => 3095cb26affefcaaa835ff968d60437c7c764da40cdd1a1b497406c7902a8ac9
print(wallet.wif);
// => Kxr9tQED9H44gCmp6HAdmemAzU3n84H3dGkuWTKvE23JgHMW8gct
}
copied to clipboard
The below examples are implemented as integration tests:
Generate a random address
Validating address
Generate an address from a SHA256 hash
Import an address via WIF
Generate a Testnet address
Generate a Litecoin address
Generate a native Segwit address
Create a 1-to-1 Transaction
Create a 2-to-2 Transaction
Create a Transaction with a SegWit P2WPKH input
Import a BIP32 testnet xpriv and export to WIF
Export a BIP32 xpriv, then import it
Export a BIP32 xpub
Create a BIP32, bitcoin, account 0, external address
Create a BIP44, bitcoin, account 0, external address
Use BIP39 to generate BIP32 addresses
TODO #
Add asset creation, transactions
Running the test suite #
pub run test
copied to clipboard
Complementing Libraries #
BIP39 - Mnemonic generation for deterministic keys
BIP32 - BIP32
Base58 Check - Base58 check encoding/decoding
LICENSE MIT #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.