Skip to content

Commit

Permalink
update to v0.3.0 (#26)
Browse files Browse the repository at this point in the history
update from cryptogarageinc v0.3.9
  • Loading branch information
k-matsuzawa authored Mar 29, 2021
1 parent 6877d0c commit bcbf745
Show file tree
Hide file tree
Showing 82 changed files with 25,020 additions and 3,506 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/check_pre-merge_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-10.15, macos-11.0]
os: [macos-10.15]
# os: [macos-10.15, macos-11.0]

steps:
- uses: actions/checkout@v2
Expand Down
38 changes: 37 additions & 1 deletion .github/workflows/check_pre-merge_sprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-10.15, macos-11.0]
os: [macos-10.15]
#os: [macos-10.15, macos-11.0]

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -99,6 +100,41 @@ jobs:
name: output-lcov-cfd-${{ matrix.os }}
path: ./build/lcov_cfd_output.zip

ubuntu-valgrind:
name: valgrind-ubuntu
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-18.04]
shared: [on]

steps:
- uses: actions/checkout@v2
- name: dump version
run: |
cmake --version
gcc --version
- name: ubuntu-apt-install
run: |
cat /etc/os-release
sudo apt-get update
sudo apt-get install -y valgrind
- name: cmake-build
run: |
cmake --version
cmake -S . -B build -G "Unix Makefiles"
cmake -DENABLE_SHARED=${{ matrix.shared }} -DCMAKE_BUILD_TYPE=Debug -DTARGET_RPATH=./build/Debug --build build
cmake --build build --config Debug --parallel 4
- name: valgrind
run: |
# --valgrind-stacksize=1048576 --num-callers=12
valgrind -v --tool=memcheck --leak-check=full --valgrind-stacksize=10485760 --log-file=./valgrind.log --time-stamp=yes ./build/Debug/cfd_test
- name: upload coverage
uses: actions/upload-artifact@v1
with:
name: valgrind-log
path: ./valgrind.log

doxygen-ubuntu:
name: doxygen-check
runs-on: ubuntu-18.04
Expand Down
5 changes: 0 additions & 5 deletions .github/workflows/code_scanner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ on:
- '**.h'
- '**/code_scanner.yml'
- '**/external_project_local_setting.config'
pull_request:
branches:
- master
- develop
- features/sprint*

jobs:
analyze-CodeQL:
Expand Down
68 changes: 18 additions & 50 deletions .github/workflows/create_release-and-upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,14 @@ jobs:
asset_name: cfd-${{ steps.get_version.outputs.VERSION }}-ubuntu${{ matrix.os_ver }}04-${{ matrix.bin }}-x86_64.zip
asset_content_type: application/zip

upload-object-alpine-3-10:
name: upload-object-alpine-3.10
upload-object-alpine:
name: upload-object-alpine
needs: create_releases
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
alpine: ['3.10', '3.12', '3.13']

steps:
- name: checkout
Expand All @@ -181,57 +185,21 @@ jobs:
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: list
run: ls -a $GITHUB_WORKSPACE
- name: docker setup
- name: docker setup 3.10
if: matrix.alpine == '3.10'
uses: docker://alpine:3.10
with:
entrypoint: /github/workspace/.github/workflows/docker/alpine_build_entrypoint.sh
- name: create archive file
run: |
echo "---- dump output data ----"
ls -l $GITHUB_WORKSPACE/dist/usr/local/*
mkdir -p /tmp/cfd
sudo chmod 777 /tmp/cfd
sudo chown runner /tmp/cfd
sudo cp -r $GITHUB_WORKSPACE/dist/usr /tmp/cfd
cd /tmp/cfd
sudo zip -r /tmp/cfd/cfd.zip usr
sudo chmod 777 /tmp/cfd/cfd.zip
sudo chown runner /tmp/cfd/cfd.zip
sudo cp -rp /tmp/cfd/cfd.zip $GITHUB_WORKSPACE/dist/cfd.zip
echo "---- dump zip file ----"
sudo ls -l /tmp/cfd
- name: output url
id: get_url
run: echo "::set-output name=upload_url::${{ needs.create_releases.outputs.release_url }}"
- name: Upload Release Asset
id: upload-release-asset
# if: success()
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_url.outputs.upload_url }}
asset_path: /tmp/cfd/cfd.zip
asset_name: cfd-${{ steps.get_version.outputs.VERSION }}-alpine-3.10-x86_64.zip
asset_content_type: application/zip

upload-object-alpine-3-12:
name: upload-object-alpine-3.12
needs: create_releases
runs-on: ubuntu-18.04

steps:
- name: checkout
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
- name: list
run: ls -a $GITHUB_WORKSPACE
- name: docker setup
- name: docker setup 3.12
if: matrix.alpine == '3.12'
uses: docker://alpine:3.12
with:
entrypoint: /github/workspace/.github/workflows/docker/alpine_build_entrypoint.sh
- name: docker setup 3.13
if: matrix.alpine == '3.13'
uses: docker://alpine:3.13
with:
entrypoint: /github/workspace/.github/workflows/docker/alpine_build_entrypoint.sh
- name: create archive file
run: |
echo "---- dump output data ----"
Expand Down Expand Up @@ -259,7 +227,7 @@ jobs:
with:
upload_url: ${{ steps.get_url.outputs.upload_url }}
asset_path: /tmp/cfd/cfd.zip
asset_name: cfd-${{ steps.get_version.outputs.VERSION }}-alpine-3.12-x86_64.zip
asset_name: cfd-${{ steps.get_version.outputs.VERSION }}-alpine-${{ matrix.alpine }}-x86_64.zip
asset_content_type: application/zip

upload-object-macos:
Expand All @@ -269,7 +237,7 @@ jobs:
strategy:
fail-fast: false
matrix:
xcode: [10.3, 11.6]
xcode: [10.3, 11.7, 12.4]
shared: [on, off]
include:
- shared: on
Expand All @@ -279,7 +247,7 @@ jobs:

steps:
- name: checkout
uses: actions/checkout@v1
uses: actions/checkout@v2
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
Expand Down
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ option(CFD_SHARED "force shared build (ON or OFF. default:OFF)" OFF)
option(ENABLE_CAPI "enable c-api (ON or OFF. default:ON)" ON)
option(ENABLE_JSONAPI "enable json-api (ON or OFF. default:ON)" ON)

set(GENERATE_WALLY ON CACHE BOOL "" FORCE)
set(EXCLUDE_WALLYCORE_LIB ON CACHE BOOL "" FORCE)

####################
# common setting
####################
Expand Down
63 changes: 55 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,53 @@
# Crypto Finance Development Kit (CFD)

cfd library in C/C++

<!-- TODO: Write Summary and Overview
CFD library for C/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

- Estimate Fee
- Coin Selection (FundRawTransaction)
- Simple pubkey-hash sign / verify
- C language API (for reference from other languages)
- from cfd-core function:
- Bitcoin
- Bitcoin Script (builder, viewer)
- Transaction
- PSBT (v0)
- 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
- Issuance, Reissuance
- PegIn, PegOut
- Confidential Address

### Libraries for each language

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

## Dependencies

Expand All @@ -20,7 +61,8 @@ cfd library in C/C++

### Windows

download and install files.
download and install files:

- [CMake](https://cmake.org/) (3.14.3 or higher)
- Compiler or development environment (One of the following)
- MSVC
Expand Down Expand Up @@ -153,14 +195,14 @@ cmake version is 3.15 or higher: `cmake --install build`
sudo ./tools/cleanup_install_files.sh

(download)
wget https://github.com/p2pderivatives/cfd/releases/download/v0.1.5/cfd-v0.1.5-ubuntu1804-gcc-x86_64.zip
wget https://github.com/p2pderivatives/cfd/releases/download/v0.3.0/cfd-v0.3.0-ubuntu2004-gcc-x86_64.zip

(unzip)
sudo unzip -q cfd-v0.1.5-ubuntu1804-gcc-x86_64.zip -d /
sudo unzip -q cfd-v0.3.0-ubuntu2004-gcc-x86_64.zip -d /
```

- Windows
1. get releases asset. (ex. https://github.com/p2pderivatives/cfd/releases/download/v0.1.5/cfd-v0.1.5-win-vs2019-x86_64.zip )
1. get releases asset. (ex. https://github.com/p2pderivatives/cfd/releases/download/v0.3.0/cfd-v0.3.0-win-vs2019-x86_64.zip )
2. Expand to PATH

### uninstall
Expand Down Expand Up @@ -197,6 +239,7 @@ npm run ctest

- cfd-core
- [libwally-core](https://github.com/cryptogarageinc/libwally-core/tree/cfd-develop) (forked from [ElementsProject/libwally-core](https://github.com/ElementsProject/libwally-core))
- [secp256k1-zkp](https://github.com/cryptogarageinc/secp256k1-zkp/tree/cfd-develop) (forked from [ElementsProject/secp256k1-zkp](https://github.com/ElementsProject/secp256k1-zkp))
- [univalue](https://github.com/jgarzik/univalue) (for JSON encoding and decoding)
- [googletest](https://github.com/google/googletest) (for testing)

Expand Down Expand Up @@ -275,3 +318,7 @@ set CFD_CMAKE_GIT_SKIP_UPDATE=1
```
export CFD_CMAKE_GIT_SKIP_UPDATE=1
```

### Visula C++ & Debug build:

When debugging build with Visual C++, std::map related may not work properly.
1 change: 1 addition & 0 deletions cmake/CfdCommonOption.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ endif()
option(ENABLE_ELEMENTS "enable elements code (ON or OFF. default:ON)" ON)
option(ENABLE_TESTS "enable code tests (ON or OFF. default:ON)" ON)
option(ENABLE_EMSCRIPTEN "enable EMSCRIPTEN (ON or OFF. default:OFF)" OFF)
option(STD_CPP_VERSION "c++ version (11/14/17. default:11)" "11")

# use "cmake -DCMAKE_BUILD_TYPE=Debug" or "cmake-js -D"
# option(ENABLE_DEBUG "enable debugging (ON or OFF. default:OFF)" OFF)
Expand Down
3 changes: 2 additions & 1 deletion cmake/CfdWallyOption.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ option(ENABLE_JS_WRAPPER "enable the Javascript interface wrappers (ON or OFF. d
else()
set(ENABLE_JS_WRAPPER OFF)
endif()
set(GENERATE_WALLY ON)
option(GENERATE_WALLY "generate the wally.xxx library (ON or OFF. default:ON)" ON)
option(EXCLUDE_WALLYCORE_LIB "exclude wallycore lib (ON or OFF. default:OFF)" OFF)
5 changes: 5 additions & 0 deletions cmake/Cpp11Setting.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ if(${USE_EMSCRIPTEN})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -s DISABLE_EXCEPTION_CATCHING=0")
endif()

if(${STD_CPP_VERSION})
set(CMAKE_CXX_STANDARD ${STD_CPP_VERSION})
message(STATUS "[STD_CPP_VERSION] ${STD_CPP_VERSION}")
else()
set(CMAKE_CXX_STANDARD 11)
endif()
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
2 changes: 1 addition & 1 deletion external/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if(CFDCORE_TARGET_VERSION)
set(CFDCORE_TARGET_TAG ${CFDCORE_TARGET_VERSION})
message(STATUS "[external project local] cfd-core target=${CFDCORE_TARGET_VERSION}")
else()
set(CFDCORE_TARGET_TAG v0.2.2)
set(CFDCORE_TARGET_TAG v0.3.0)
endif()
if(CFDCORE_TARGET_URL)
set(CFDCORE_TARGET_REP ${CFDCORE_TARGET_URL})
Expand Down
Loading

0 comments on commit bcbf745

Please sign in to comment.