coinlib_flutter 2.2.0 copy "coinlib_flutter: ^2.2.0" to clipboard
coinlib_flutter: ^2.2.0 copied to clipboard

A flutter wrapper for coinlib, a straight-forward, modular library for Peercoin and other Satoshi-based UTXO blockchains

example/lib/main.dart

import 'dart:typed_data';
import 'package:flutter/material.dart';
import 'package:coinlib_flutter/coinlib_flutter.dart' as coinlib;

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  static String expPubkey =
    "0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798";

  @override
  Widget build(BuildContext context) => MaterialApp(
    home: Scaffold(
      appBar: AppBar(title: const Text("Coinlib Example")),
      body: SingleChildScrollView(
        child: Padding(
          padding: const EdgeInsets.all(10),
          child: _getCoinLibWidget(context)
        )
      )
    )
  );

  Widget _getCoinLibWidget(BuildContext context) => coinlib.CoinlibLoader(
    loadChild: const Text("Loading coinlib..."),
    errorBuilder: (context, error) => Text("Error $error"),
    builder: (context) {

      final privKey = coinlib.ECPrivateKey.fromHex(
        "0000000000000000000000000000000000000000000000000000000000000001",
      );

      final schnorrSignature = coinlib.SchnorrSignature.sign(
        privKey, Uint8List(32),
      );

      return Text(
        "Public key is ${privKey.pubkey.hex} and should equal $expPubkey."
        " An example Schnorr signature is"
        " ${coinlib.bytesToHex(schnorrSignature.data)}."
      );

    }
  );

}
2
likes
150
pub points
50%
popularity

Publisher

verified publisherpeercoin.net

A flutter wrapper for coinlib, a straight-forward, modular library for Peercoin and other Satoshi-based UTXO blockchains

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

coinlib, flutter, plugin_platform_interface

More

Packages that depend on coinlib_flutter