JavaScript wrapper of cfd libraries
This library is development kit for crypto finance application. Useful when developing applications for cryptocurrencies.
- Bitcoin
- Liquid Network
- Bitcoin
- Bitcoin Script (builder, viewer)
- Transaction
- Create, Parse, Decode
- Simple pubkey-hash sign / verify
- Estimate Fee
- Coin Selection (FundRawTransaction)
- PSBT (v0. v2 & taproot is not yet.)
- Create, Parse, Decode
- Simple pubkey-hash sign / verify
- Estimate Fee
- Coin Selection (FundRawTransaction)
- ECDSA Pubkey/Privkey (TweakAdd/Mul, Negate, Sign, Verify)
- BIP32, BIP39
- Output Descriptor (contains miniscript parser)
- Schnorr/Taproot
- Bitcoin Address (Segwit-v0, Segwit-v1, P2PKH/P2SH)
- Liquid Network
- Confidential Transaction
- Blind, Unblind
- Reissuance
- Confidential Address
- Confidential Transaction
- JavaScript : cfd-js
- C/C++ : cfd
- Extend the cfd-core library. Defines the C language API and extension classes.
- C++ : cfd-core
- Core library. Definition base class.
- C/C++ : cfd
- other language:
- WebAssembly : cfd-js-wasm
- Python : cfd-python
- C# : cfd-csharp
- Go : cfd-go
- Rust : cfd-rust
- C/C++ Compiler - can compile c++11
- CMake (3.14.3 or higher)
- node.js (stable version)
- Python 3.x
- for building libwally-core js wrapper
download and install files.
- node.js (by npm v7 or higher, or yarn.)
- Python 3.x
- CMake (3.14.3 or higher)
- MSVC
- Visual Studio (Verified version is 2017 or higher)
- Build Tools for Visual Studio (2017 or higher)
- (Using only) msvc redistribution package
# xcode cli tools
xcode-select --install
# install dependencies using Homebrew
brew install cmake python node
# install dependencies using APT package Manager
apt-get install -y build-essential cmake python nodejs
cmake version 3.14.2 or lower, download from website and install cmake. (https://cmake.org/download/)
Add cfd-js github on caller app's package.json.
ex)
"cfd-js": "cryptogarageinc/cfd-js#semver:^0.1.3",
If you use old npm or yarn, describe as follows.
ex)
"cfd-js": "git+https://github.com/cryptogarageinc/cfd-js#semver:^0.1.3",
When npm is installed, the cfd-js build is executed.
cfd-js uses the N-API. Therefore, the same binary can be used for both node.js and electron.
When using the cmake-js package and npm script, the options for compilation are already set.
npm install
npm run cmake_release_parallel
npm run test
npm run example
npm run elements_example
- cfd
- cfd-core
- libwally-core (forked from ElementsProject/libwally-core)
- univalue (for JSON encoding and decoding)
- cfd-core
- clang-format (using v10.0.0)
- eslint
- cpplint
- eslint
- Not Implemented yet
- Visual Studio (2017 or higher)
- Clang (7.x or higher)
- GCC (contains MinGW) (5.x or higher)
Git repository connections default to HTTPS.
However, depending on the connection settings of GitHub, you may only be able to connect via SSH.
As a countermeasure, forcibly establish SSH connection by setting CFD_CMAKE_GIT_SSH=1
in the environment variable.
-
Windows: (On the command line. Or set from the system setting screen.)
set CFD_CMAKE_GIT_SSH=1
-
MacOS & Linux(Ubuntu):
export CFD_CMAKE_GIT_SSH=1
If the shared library you downloaded cannot be referenced and the build fails, do a full build without downloading the shared library.
Prevents the download of the shared library by setting CFDJS_UNUSE_ASSET=1
in the environment variable.
-
Windows: (On the command line. Or set from the system setting screen.)
set CFDJS_UNUSE_ASSET=1
-
MacOS & Linux(Ubuntu):
export CFDJS_UNUSE_ASSET=1
Depending on your git environment, you may get the following error when checking out external:
Performing update step for 'libwally-core-download'
Current branch cmake_build is up to date.
No stash entries found.
No stash entries found.
No stash entries found.
CMake Error at /workspace/cfd-core/build/external/libwally-core/download/libwally-core-download-prefix/tmp/libwally-core-download-gitupdate.cmake:133 (message):
Failed to unstash changes in:
'/workspace/cfd-core/external/libwally-core/'.
You will have to resolve the conflicts manually
This phenomenon is due to the git update
related command.
Please set an environment variable that skips update processing.
-
Windows: (On the command line. Or set from the system setting screen.)
set CFD_CMAKE_GIT_SKIP_UPDATE=1
-
MacOS & Linux(Ubuntu):
export CFD_CMAKE_GIT_SKIP_UPDATE=1
Errors may occur during processing of CMake External project on Windows. This is a problem with the Windows environment, but you can work around it by using npm v7. If npm is less than v7, please try to cleanup&build after running the following command:
npm i -g npm@7
This error may occur on the Alpine Linux. The cause is that the related library can not referenced. Please add the installation location to LD_LIBRARY_PATH.
export LD_LIBRARY_PATH="./node_modules/cfd-js/build/Release:$LD_LIBRARY_PATH"
The cfd-js is using prebuild-install & own downloading asset. If you want to build directly from source code, you can do so by setting environment variables as follows:
-
Windows: (On the command line. Or set from the system setting screen.)
set npm_config_build_from_source=true set CFDJS_UNUSE_ASSET=1
-
MacOS & Linux(Ubuntu):
export npm_config_build_from_source=true export CFDJS_UNUSE_ASSET=1