0 purchases
vkaxlib
Coinlib #
Coinlib is a straight-forward and modular library for Vkax 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
vkaxlib_flutter instead. Otherwise
you may add vkaxlib to your project via:
dart pub add vkaxlib
copied to clipboard
If you are using the library for web, the library is ready to use. If you are
using the library on Linux, macOS, or Windows, then please see
"Building for Linux",
"Building for macOS", or
"Building for Windows" below.
The library can be imported via:
import 'package:vkaxlib/vkaxlib.dart';
copied to clipboard
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);
copied to clipboard
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 vkaxlib: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 vkaxlib 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
copied to clipboard
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 vkaxlib:build_macos which will
place the library under a build directory.
Building for Windows #
Native Windows build #
Please note that native windows builds under this section can sometimes freeze
during the build process. If this happens please use the WSL build process
described in
"Cross-compiling for Windows using WSL".
Building on Windows requires CMake as a dependency.
The Windows shared library can be built using dart run vkaxlib:build_windows in
the root directory of your package which will produce a shared library into
build/libsecp256k1.dll. This can also be run in the vkaxlib root directory
via dart run bin/build_windows.dart.
Windows builds use the Visual Studio 17 2022 generator. Earlier Visual Studio
toolchains may work by editing bin/build_windows.dart.
Cross-compiling for Windows from Linux #
Cross-compile a secp256k1 DLL for Windows on an Ubuntu 20.04 host with
dart run vkaxlib:build_windows_crosscompile. This can also be run in the
vkaxlib root directory via dart run bin/build_windows_crosscompile.dart.
Cross-compiling for Windows using WSL #
Builds on Windows can be accomplished using WSL2 (Windows Subsystem for Linux).
First, install the following packages to the WSL(2) host:
autoconf
libtool
build-essential
git
cmake
mingw-w64
as in:
apt-get update -y
apt-get install -y autoconf libtool build-essential git cmake mingw-w64
copied to clipboard
Then, cross-compile a secp256k1 DLL for Windows on an Ubuntu 20.04 WSL2 instance
on a Windows host with dart run vkaxlib:build_wsl or
dart run bin/build_wsl.dart in the vkaxlib root directory, or complete the
above
"Cross-compiling for Windows on Linux"
after installing Docker or Podman in WSL. The build can also be completed
without installing Flutter to WSL by following
bitcoin-core/secp256k1's "Cross compiling" guide.
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 vkaxlib 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 vkaxlib root directory.
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.