dart_wif 1.0.0 copy "dart_wif: ^1.0.0" to clipboard
dart_wif: ^1.0.0 copied to clipboard

outdated

A starting point for Dart libraries or applications.

example/dart_wif_example.dart

import 'dart:typed_data';

import 'package:convert/convert.dart';
import 'package:dart_wif/dart_wif.dart';

void main() {
  Uint8List privateKey = Uint8List.fromList(hex.decode(
      '0000000000000000000000000000000000000000000000000000000000000001'));
  String key = Wif(version: 128, privateKey: privateKey, compressed: true)
      .encode(); // for the testnet use: Wif.encode(239, ...
  print(key);
  // => KwDiBf89QgGbjEhKnhXJuH7LrciVrZi3qYjgd9M7rFU73sVHnoWn

  var obj = Wif.decode(key);

  print(obj);
  // => {
  //	version: 128,
  //	privateKey: "0000000000000000000000000000000000000000000000000000000000000001",
  //	compressed: true
  //}

  Wif.decode(key, 0x09);
  // => Error: Invalid network version
}
0
likes
0
pub points
62%
popularity

Publisher

verified publishermahsumurebe.com

A starting point for Dart libraries or applications.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

convert, dart_bs58check

More

Packages that depend on dart_wif