/cfd-csharp

Crypto Finance Development Kit for C#

Primary LanguageC#MIT LicenseMIT

Crypto Finance Development Kit for C# (CFD-CSHARP)

CFD library for C#.

Overview

This library is development kit for crypto finance application. Useful when developing applications for cryptocurrencies.

Target Network

  • Bitcoin
  • Liquid Network

Support function by cfd

  • Bitcoin
    • Bitcoin Script (builder, viewer)
    • Transaction
      • 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

Libraries for each language

  • C# : cfd-csharp
    • C/C++ : cfd
      • Extend the cfd-core library. Defines the C language API and extension classes.
    • C++ : cfd-core
      • Core library. Definition base class.
  • other language:
    • JavaScript : cfd-js
    • WebAssembly : cfd-js-wasm
    • Python : cfd-python
    • Go : cfd-go
    • Rust : cfd-rust

Dependencies

  • C# (8.0 or higher)
    • .NET Core 3.0 or higher
  • C/C++ Compiler   - can compile c++11
  • CMake (3.14.3 or higher)

Windows

MacOS

  • C# (8.0 or higher)
    • .NET Core 3.0 or higher
  • Homebrew
# xcode cli tools
xcode-select --install

# install dependencies using Homebrew
brew install cmake cask
brew cask install dotnet-sdk

Linux(Ubuntu)

  • C# (8.0 or higher)
    • .NET Core 3.0 or higher
  • CMake (3.14.3 or higher)
# install dependencies using APT package Manager
apt-get install -y build-essential cmake

dotnet install is see manual. (ex. https://docs.microsoft.com/dotnet/core/install/linux-package-manager-ubuntu-1804)

cmake version 3.14.2 or lower, download from website and install cmake. (https://cmake.org/download/)


Build

Windows

# configure & build
.\tools\build.bat
  • (.NET only)
    .\tools\build_core3.bat

Linux & MacOSX

  • .NET 5.x
# configure & build
./tools/build.sh

Test and Example

Test

  • Windows
.\tools\test_core3.bat
  • Linux & MacOSX
echo ".NET 5.x"
./tools/test.sh

Example

  • Not Implemented yet

Information for developers

using library

formatter

  • dotnet format (5.1 or higher)

support compilers

  • .NET Core (3.x or higher)
  • for cfd build
    • Visual Studio (2017 or higher)
    • Clang (7.x or higher)
    • GCC (5.x or higher)

Note

Git connection:

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

Ignore git update for CMake External Project:

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