defichain_bech32 0.1.0 copy "defichain_bech32: ^0.1.0" to clipboard
defichain_bech32: ^0.1.0 copied to clipboard

Library implementing Bitcoins BIP173 (Bech32 encoding) specification in a Flutter friendly fashion.

example/main.dart

import 'package:defichain_bech32/defichain_bech32.dart';

//ignore_for_file: avoid_print
void main() {
  var address = segwit.decode(SegwitInput('bc1', 'bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx'));
  print('scriptPubKey: ${address.scriptPubKey}');
  print('version: ${address.version}');
  print('program: ${address.program}');

  var otherAddress = Segwit('bc', 1, [0, 0]);
  print(segwit.encode(otherAddress));

  // Decode a lightning payment request
  var paymentRequest =
      'lnbc1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpl2pkx2ctnv5sxxmmwwd5kgetjypeh2ursdae8g6twvus8g6rfwvs8qun0dfjkxaq8rkx3yf5tcsyz3d73gafnh3cax9rn449d9p5uxz9ezhhypd0elx87sjle52x86fux2ypatgddc6k63n7erqz25le42c4u4ecky03ylcqca784w';
  var codec = Bech32Codec();
  var bech32 = codec.decode(
    paymentRequest,
    paymentRequest.length,
  );
  print('hrp: ${bech32.hrp}');
  print('data: ${bech32.data}');
}
0
likes
140
points
51
downloads

Publisher

unverified uploader

Weekly Downloads

Library implementing Bitcoins BIP173 (Bech32 encoding) specification in a Flutter friendly fashion.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

convert

More

Packages that depend on defichain_bech32