Skip to content

Commit

Permalink
update to v0.3.0 (#5)
Browse files Browse the repository at this point in the history
update from cryptogarageinc v0.3.2
  • Loading branch information
k-matsuzawa authored Mar 30, 2021
1 parent ad6a2c4 commit a57e499
Show file tree
Hide file tree
Showing 49 changed files with 10,876 additions and 478 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/check_pre-merge_develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@ on:
- test_ci
paths-ignore:
- '.github/workflows/create_release-and-upload.yml'
- '.github/workflows/code_scanner.yml'
- 'README.md'
pull_request:
branches:
- develop
- test_ci

env:
GITHUB_VERSION: v0.0.5
GITHUB_VERSION: v0.0.8
GITHUB_BITCOIN_VERSION: v0.0.8
DOCKER_PYTHON_VERSION: 3.7
GITHUB_DOCKER_IMAGE: docker.pkg.github.com/cryptogarageinc/elements-testing-dockerfile/elements-testing
ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_entrypoint.sh
BITCOIN_ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_bitcoin_entrypoint.sh

jobs:
build-and-test:
Expand Down Expand Up @@ -111,6 +114,29 @@ jobs:
docker pull ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_VERSION }}
docker run -v ${{ github.workspace }}:/github/workspace --entrypoint ${{ env.ENTRYPOINT_PATH }} ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_VERSION }}
bitcoin-e2e-test:
timeout-minutes: 20
name: bitcoin e2e test
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.DOCKER_PYTHON_VERSION }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: install pip
run: python -m pip install -U pip
- name: create wheel
run: pip wheel .
- name: e2e-test
run: |
docker login docker.pkg.github.com -u owner -p ${{ secrets.GITHUB_TOKEN }}
docker pull ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_BITCOIN_VERSION }}
docker run -v ${{ github.workspace }}:/github/workspace --entrypoint ${{ env.BITCOIN_ENTRYPOINT_PATH }} ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_BITCOIN_VERSION }}
doxygen-ubuntu:
name: doxygen-ubuntu
runs-on: ubuntu-20.04
Expand Down
35 changes: 31 additions & 4 deletions .github/workflows/check_pre-merge_master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ on:
- master
paths-ignore:
- '.github/workflows/create_release-and-upload.yml'
- '.github/workflows/code_scanner.yml'
- 'README.md'
pull_request:
branches:
- master

env:
GITHUB_VERSION: v0.0.5
GITHUB_VERSION: v0.0.8
GITHUB_BITCOIN_VERSION: v0.0.8
DOCKER_PYTHON_VERSION: 3.7
GITHUB_DOCKER_IMAGE: docker.pkg.github.com/cryptogarageinc/elements-testing-dockerfile/elements-testing
ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_entrypoint.sh
BITCOIN_ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_bitcoin_entrypoint.sh

jobs:
build-and-test:
Expand Down Expand Up @@ -57,7 +60,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [macos-10.15, macos-11.0, windows-2019, ubuntu-18.04, ubuntu-20.04]
# os: [macos-10.15, macos-11.0, windows-2019, ubuntu-18.04, ubuntu-20.04]
os: [macos-10.15, windows-2019, ubuntu-18.04, ubuntu-20.04]
py-ver: [3.6, 3.7, 3.8, 3.9, pypy3]
exclude:
- os: windows-2019
Expand All @@ -66,8 +70,8 @@ jobs:
py-ver: 3.7
- os: windows-2019
py-ver: pypy3
- os: macos-11.0
py-ver: pypy3
# - os: macos-11.0
# py-ver: pypy3

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -109,6 +113,29 @@ jobs:
docker pull ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_VERSION }}
docker run -v ${{ github.workspace }}:/github/workspace --entrypoint ${{ env.ENTRYPOINT_PATH }} ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_VERSION }}
bitcoin-e2e-test:
timeout-minutes: 20
name: bitcoin e2e test
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.DOCKER_PYTHON_VERSION }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: install pip
run: python -m pip install -U pip
- name: create wheel
run: pip wheel .
- name: e2e-test
run: |
docker login docker.pkg.github.com -u owner -p ${{ secrets.GITHUB_TOKEN }}
docker pull ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_BITCOIN_VERSION }}
docker run -v ${{ github.workspace }}:/github/workspace --entrypoint ${{ env.BITCOIN_ENTRYPOINT_PATH }} ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_BITCOIN_VERSION }}
doxygen-ubuntu:
name: doxygen-ubuntu
runs-on: ubuntu-20.04
Expand Down
32 changes: 29 additions & 3 deletions .github/workflows/check_pre-merge_sprint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,19 @@ on:
- features/sprint*
paths-ignore:
- '.github/workflows/create_release-and-upload.yml'
- '.github/workflows/code_scanner.yml'
- 'README.md'
pull_request:
branches:
- features/sprint*

env:
GITHUB_VERSION: v0.0.5
GITHUB_VERSION: v0.0.8
GITHUB_BITCOIN_VERSION: v0.0.8
DOCKER_PYTHON_VERSION: 3.7
GITHUB_DOCKER_IMAGE: docker.pkg.github.com/cryptogarageinc/elements-testing-dockerfile/elements-testing
ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_entrypoint.sh
BITCOIN_ENTRYPOINT_PATH: /github/workspace/.github/workflows/docker/test_bitcoin_entrypoint.sh

jobs:
build-and-test:
Expand Down Expand Up @@ -58,9 +61,9 @@ jobs:
- name: test
run: python -m unittest discover -v tests

e2e-test:
elements-e2e-test:
timeout-minutes: 20
name: e2e-test
name: elements e2e test
runs-on: ubuntu-18.04

steps:
Expand All @@ -81,6 +84,29 @@ jobs:
docker pull ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_VERSION }}
docker run -v ${{ github.workspace }}:/github/workspace --entrypoint ${{ env.ENTRYPOINT_PATH }} ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_VERSION }}
bitcoin-e2e-test:
timeout-minutes: 20
name: bitcoin e2e test
runs-on: ubuntu-18.04

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ env.DOCKER_PYTHON_VERSION }}
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: install pip
run: python -m pip install -U pip
- name: create wheel
run: pip wheel .
- name: e2e-test
run: |
docker login docker.pkg.github.com -u owner -p ${{ secrets.GITHUB_TOKEN }}
docker pull ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_BITCOIN_VERSION }}
docker run -v ${{ github.workspace }}:/github/workspace --entrypoint ${{ env.BITCOIN_ENTRYPOINT_PATH }} ${{ env.GITHUB_DOCKER_IMAGE }}:${{ env.GITHUB_BITCOIN_VERSION }}
doxygen-ubuntu:
name: doxygen-ubuntu
runs-on: ubuntu-20.04
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/code_scanner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ on:
- develop
- features/sprint*
- feature/code_scanning
paths:
- '**.py'
- '**.cpp'
- '**.h'
- '**/CMakeLists.txt'
- '**/code_scanner.yml'
- '**/external_project_local_setting.config'
pull_request:
branches:
- master
Expand Down
46 changes: 46 additions & 0 deletions .github/workflows/docker/test_bitcoin_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash -u

# while :; do sleep 10; done
export WORKDIR_ROOT=github
export WORK_DIR=workspace
export WORKDIR_PATH=/${WORKDIR_ROOT}/${WORK_DIR}

cd /${WORKDIR_ROOT}
if [ ! -d ${WORK_DIR} ]; then
mkdir ${WORK_DIR}
fi

cd ${WORKDIR_PATH}
rm -rf bitcoind_datadir

mkdir bitcoind_datadir
chmod 777 bitcoind_datadir
# cp /root/.bitcoin/bitcoin.conf bitcoind_datadir/
cp ./integration_test/bitcoin.conf bitcoind_datadir/

# boot daemon
bitcoind --regtest -datadir=${WORKDIR_PATH}/bitcoind_datadir
bitcoin-cli --regtest -datadir=${WORKDIR_PATH}/bitcoind_datadir ping > /dev/null 2>&1
while [ $? -ne 0 ]
do
bitcoin-cli --regtest -datadir=${WORKDIR_PATH}/bitcoind_datadir ping > /dev/null 2>&1
done
echo "start bitcoin node"

# load or create wallet
bitcoin-cli --regtest -datadir=${WORKDIR_PATH}/bitcoind_datadir createwallet wallet

set -e

python3 --version

pip3 install *.whl
pip3 install python-bitcoinrpc

cd integration_test

python3 tests/test_bitcoin.py -v
if [ $? -gt 0 ]; then
cd ../..
exit 1
fi
3 changes: 3 additions & 0 deletions .github/workflows/docker/test_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ do
done
echo "start elements node"

# load or create wallet
bitcoin-cli --regtest -datadir=${WORKDIR_PATH}/bitcoind_datadir createwallet wallet

set -e

python3 --version
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -145,3 +145,4 @@ cmake_build/
/integration_test/localdata
/integration_test/bitcoind_datadir
/integration_test/elementsd_datadir
/integration_test/local_test
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"python.testing.unittestArgs": [
"-v",
"-s",
"./tests",
"-p",
"test_*.py"
],
"python.testing.pytestEnabled": false,
"python.testing.nosetestsEnabled": false,
"python.testing.unittestEnabled": true
}
56 changes: 53 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
# Crypto Finance Development Kit for Python (CFD-PYTHON)

CFD library for Python.

## 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)
- 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

### Libraries for each language

- 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.
- other language:
- JavaScript : cfd-js
- WebAssembly : cfd-js-wasm
- C# : cfd-csharp
- Go : cfd-go
- Rust : cfd-rust

## Dependencies

- Python(CPython) (3.6 or higher)
Expand Down Expand Up @@ -35,7 +86,6 @@ 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
curl https://sh.rustup.rs -sSf | sh (select is 1)
```

cmake version 3.14.2 or lower, download from website and install cmake.
Expand Down Expand Up @@ -83,10 +133,10 @@ pip install --user .

### install from wheel

1. get releases asset. (ex. https://github.com/p2pderivatives/cfd-python/releases/download/v0.2.2/cfd-0.2.2-py3-none-win_amd64.whl )
1. get releases asset. (ex. https://github.com/p2pderivatives/cfd-python/releases/download/v0.3.0/cfd-0.3.0-py3-none-win_amd64.whl )
2. install pip
```
pip install --user cfd-0.2.2-py3-none-win_amd64.whl
pip install --user cfd-0.3.0-py3-none-win_amd64.whl
```

### uninstall
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.2.3
0.3.0
15 changes: 15 additions & 0 deletions cfd-python.code-workspace
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"folders": [
{
"path": "."
}
],
"settings": {
"editor.formatOnSave": true,
"editor.rulers": [
80
],
"python.linting.flake8Enabled": true,
"python.linting.mypyEnabled": true
}
}
3 changes: 3 additions & 0 deletions cfd/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,13 @@
'address',
'confidential_address',
'confidential_transaction',
'crypto',
'descriptor',
'hdwallet',
'key',
'psbt',
'script',
'transaction',
'taproot',
'util'
"""
Loading

0 comments on commit a57e499

Please sign in to comment.