coinlib 2.0.0-rc.3 copy "coinlib: ^2.0.0-rc.3" to clipboard
coinlib: ^2.0.0-rc.3 copied to clipboard

A straight-forward, modular library for Peercoin and other Satoshi-based UTXO blockchains

Coinlib

Peercoin Donate pub.dev

Coinlib #

Coinlib is a straight-forward and modular library for Peercoin and other similar cryptocoins including Taproot support. This library allows for the construction and signing of transactions and management of BIP32 wallets.

Installation and Usage #

If you are using flutter, please see coinlib_flutter instead. Otherwise you may add coinlib to your project via:

dart pub add coinlib

If you are using the library for web, the library is ready to use. If you are using the library on Linux or macOS then please see "Building for Linux" and "Building for macOS" below.

No script is included for building on Windows at the present time, however a secp256k1.dll may be built into your build/ directory separately.

The library can be imported via:

import 'package:coinlib/coinlib.dart';

The library must be asynchronously loaded by awaiting the loadCoinlib() function before any part of the library is used.

The library uses a functional-style of OOP. With some exceptions, objects are immutable. New modified objects are returned from methods. For example, signing a transaction returns a new signed transaction object:

final signedTx = unsignedTx.sign(inputN: 0, key: privateKey);

An example is found in the example/ directory.

Building for Linux #

Docker or Podman is required to build the library for Linux.

The linux shared library can be built using dart run coinlib:build_linux in the root directory of your package which will produce a shared library into build/libsecp256k1.so. This can also be run in the coinlib root directory via dart run bin/build_linux.dart.

This library can be in the build directory under the PWD, installed as a system library, or within $LD_LIBRARY_PATH.

Building for macOS #

Building for macOS requires autotools that may be installed using homebrew:

brew install autoconf automake libtool

The macOS dynamic library must either be provided as $PWD/build/libsecp256k1.dylib when running dart code, or provided as a system framework named secp256k1.framework.

To build the dynamic library, run dart run coinlib:build_macos which will place the library under a build directory.

Development #

This section is only relevant to developers of the library.

Bindings and WebAssembly #

The WebAssembly (WASM) module is pre-compiled and ready to use. FFI bindings are pre-generated. These only need to be updated when the underlying secp256k1 library is changed.

Bindings for the native libraries (excluding WebAssembly) are generated from the headers/secp256k1.h file using dart run ffigen within the coinlib package.

The WebAssembly module has been pre-built to lib/src/secp256k1/secp256k1.wasm.g.dart. It may be rebuilt using dart run bin/build_wasm.dart in the coinlib root directory.

1
likes
0
pub points
45%
popularity

Publisher

verified publisherpeercoin.net

A straight-forward, modular library for Peercoin and other Satoshi-based UTXO blockchains

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

collection, crypto, dart_base_x, ffi, hex, path, pointycastle, wasm_interop

More

Packages that depend on coinlib