CFD library for Python.
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
- Python : cfd-python
- 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:
- JavaScript : cfd-js
- WebAssembly : cfd-js-wasm
- C# : cfd-csharp
- Go : cfd-go
- Rust : cfd-rust
- Python(CPython) (3.6 or higher)
- C/C++ Compiler - can compile c++11
- CMake (3.14.3 or higher)
download and install files.
- Python
- 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
# install dependencies using APT package Manager
apt-get install -y build-essential cmake python3 python3-dev
(Ubuntu 20.04 or higher) apt-get install -y python-is-python3
cmake version 3.14.2 or lower, download from website and install cmake. (https://cmake.org/download/)
First update pip:
python -m pip install -U --user pip
or
python3 -m pip install -U --user pip
Then install the required packages:
pip install --user wheel pipenv
use pipenv (for developer):
pipenv install -d
attention: using python 3.7 or lower on windows
pip install --user git+https://github.com/p2pderivatives/cfd-python@master
Using unpack source code:
pip install --user .
- get releases asset. (ex. https://github.com/p2pderivatives/cfd-python/releases/download/v0.3.2/cfd-0.3.2-py3-none-win_amd64.whl )
- install pip
pip install --user cfd-0.3.2-py3-none-win_amd64.whl
pip uninstall -y cfd
use python:
python setup.py build
or
(ubuntu 18.04) python3 setup.py build
use pipenv:
pipenv run build
or
(ubuntu 18.04) pipenv run build3
rm -rf cmake_build
or
pipenv run cleanup
python ./setup.py sdist
pip wheel .
docker-compose build
docker-compose up
use python:
python -m unittest discover -v tests
or
(ubuntu 18.04) python3 -m unittest discover -v tests
use pipenv:
pipenv run test
or
(ubuntu 18.04) pipenv run test3
- cfd
- cfd-core
- libwally-core (forked from ElementsProject/libwally-core)
- univalue (for JSON encoding and decoding)
- cfd-core
- autopep8
use pipenv:
pipenv run format
- flake8
use pipenv:
pipenv run lint
- doxygen
- Visual Studio (2017 or higher)
- Clang (7.x or higher)
- GCC (5.x or higher)
When using Python 3.7 or lower on Windows, it is necessary to add the install destination to the environment variable PATH. (Must be persistent.)
The path to add must specify where to install cfd, as in the following example:
C:\Users\DummyUser\AppData\Local\Programs\Python\Python37\Lib\site-packages\cfd
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
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
(May not be needed if using pip wheel) If it does not work properly, discard the wheel on the python2 side and set PYTHONPATH:
export PYTHONPATH=$PYTHONPATH:~/.local/lib/python3.6/site-packages/wheel
If you are using WSL, you also need to set the access permissions on the Windows side. Check out the following issues: