1
-
2
1
# A Python library for 'bitcoin cryptography'
3
2
4
3
<!-- markdownlint-disable MD013 -->
5
4
| | |
6
5
| --- | --- |
7
- | Package | [ ![ python] ( https://img.shields.io/pypi/pyversions/btclib.svg?logo=python )] ( https://pypi.python.org/pypi/btclib/ ) [ ![ calver: yyy.m.d] ( https://img.shields.io/badge/cal_ver-yyyy.m.d-1674b1.svg?logo=calver )] ( https://calver.org/ ) [ ![ pypi] ( https://img.shields.io/pypi/v/btclib.svg?logo=pypi )] ( https://pypi.python.org/pypi/btclib/ ) [ ![ downloads] ( https://static.pepy.tech/badge/btclib )] ( https://pepy.tech/project/btclib ) [ ![ status] ( https://img.shields.io/pypi/status/btclib.svg )] ( https://pypi.python.org/pypi/btclib/ ) [ ![ license] ( https://img.shields.io/github/license/btclib-org/btclib.svg )] ( https://github.com/btclib-org/btclib/blob/master/LICENSE ) |
6
+ | Project | [ ![ status] ( https://img.shields.io/pypi/status/btclib.svg )] ( https://pypi.python.org/pypi/btclib/ ) [ ![ license] ( https://img.shields.io/github/license/btclib-org/btclib.svg )] ( https://github.com/btclib-org/btclib/blob/master/LICENSE ) |
7
+ | Package | [ ![ calver: yyy.m.d] ( https://img.shields.io/badge/cal_ver-yyyy.m.d-1674b1.svg?logo=calver )] ( https://calver.org/ ) [ ![ pypi] ( https://img.shields.io/pypi/v/btclib.svg?logo=pypi )] ( https://pypi.python.org/pypi/btclib/ ) [ ![ downloads] ( https://static.pepy.tech/badge/btclib )] ( https://pepy.tech/project/btclib ) |
8
+ | Supported platforms | [ ![ python] ( https://img.shields.io/pypi/pyversions/btclib.svg?logo=python )] ( https://pypi.python.org/pypi/btclib/ ) |
8
9
| Formatting standards | [ ![ lint: isort] ( https://img.shields.io/badge/lint-isort-yellowgreen.svg?logo=isort )] ( https://github.com/PyCQA/isort ) [ ![ lint: black] ( https://img.shields.io/badge/lint-black-yellowgreen.svg?logo=black )] ( https://github.com/psf/black ) [ ![ lint: flake8] ( https://img.shields.io/badge/lint-flake8-yellowgreen.svg?logo=flake8 )] ( < https://github.com/PyCQA/flake8 > ) [ ![ lint: yesqa] ( https://img.shields.io/badge/lint-yesqa-yellowgreen.svg?logo=yesqa )] ( < https://github.com/asottile/yesqa > ) [ ![ lint: markdownlint-cli2] ( https://img.shields.io/badge/lint-markdownlint--cli2-yellowgreen.svg?logo=sourcery )] ( https://github.com/DavidAnson/markdownlint-cli2 ) |
9
- | Coding standards | [ ![ type check: mypy] ( https://img.shields.io/badge/type_check-mypy-yellowgreen.svg?logo=mypy )] ( http://mypy-lang.org/ ) [ ![ type check: pyright] ( https://img.shields.io/badge/type_check-pyright-yellowgreen.svg )] ( https://github.com/microsoft/pyright ) [ ![ lint: pylint] ( https://img.shields.io/badge/lint-pylint-yellowgreen.svg?logo=pylint )] ( https://github.com/PyCQA/pylint ) [ ![ lint: autoflake] ( https://img.shields.io/badge/lint-autoflake-yellowgreen.svg?logo=autoflake )] ( https://github.com/PyCQA/autoflake ) [ ![ lint: pyupgrade] ( https://img.shields.io/badge/lint-pyupgrade-yellowgreen.svg?logo=pyupgrade )] ( https://github.com/asottile/pyupgrade ) [ ![ lint: sourcery] ( https://img.shields.io/badge/lint-sourcery-yellowgreen.svg?logo=sourcery )] ( https://sourcery.ai ) [ ![ security: bandit] ( https://img.shields.io/badge/security-bandit-yellowgreen.svg?logo=bandit )] ( https://github.com/PyCQA/bandit ) |
10
- | Docs | [ ![ lint: docformatter] ( https://img.shields.io/badge/lint-docformatter-yellowgreen.svg?logo=docformatter )] ( https://github.com/PyCQA/docformatter ) [ ![ lint: pydocstringformatter] ( https://img.shields.io/badge/lint-pydocstringformatter-yellowgreen.svg?logo=pydocstringformatter )] ( https://github.com/DanielNoord/pydocstringformatter ) [ ![ lint: pydocstyle] ( https://img.shields.io/badge/lint-pydocstyle-yellowgreen.svg?logo=pydocstyle )] ( https://github.com/PyCQA/pydocstyle ) |
11
- | CI/CD | [ ![ pre-commit.ci status] ( https://results.pre-commit.ci/badge/github/btclib-org/btclib/master.svg )] ( https://results.pre-commit.ci/latest/github/btclib-org/btclib/master ) [ ![ lint] ( https://github.com/btclib-org/btclib/actions/workflows/lint.yml/badge.svg )] ( https://github.com/btclib-org/btclib/actions/workflows/lint.yml ) [ ![ test] ( https://github.com/btclib-org/btclib/actions/workflows/test.yml/badge.svg )] ( https://github.com/btclib-org/btclib/actions/workflows/test.yml ) [ ![ test-py312] ( https://github.com/btclib-org/btclib/actions/workflows/test-pydev.yml/badge.svg )] ( https://github.com/btclib-org/btclib/actions/workflows/test-pydev.yml ) [ ![ coverage] ( https://coveralls.io/repos/github/btclib-org/btclib/badge.svg?logo=coveralls )] ( https://coveralls.io/github/btclib-org/btclib ) [ ![ docs] ( https://img.shields.io/readthedocs/btclib.svg?logo=readthedocs )] ( https://btclib.readthedocs.io ) |
10
+ | Coding standards | [ ![ lint: pylint] ( https://img.shields.io/badge/lint-pylint-yellowgreen.svg?logo=pylint )] ( https://github.com/PyCQA/pylint ) [ ![ lint: autoflake] ( https://img.shields.io/badge/lint-autoflake-yellowgreen.svg?logo=autoflake )] ( https://github.com/PyCQA/autoflake ) [ ![ lint: pyupgrade] ( https://img.shields.io/badge/lint-pyupgrade-yellowgreen.svg?logo=pyupgrade )] ( https://github.com/asottile/pyupgrade ) [ ![ lint: sourcery] ( https://img.shields.io/badge/lint-sourcery-yellowgreen.svg?logo=sourcery )] ( https://sourcery.ai ) [ ![ security: bandit] ( https://img.shields.io/badge/security-bandit-yellowgreen.svg?logo=bandit )] ( https://github.com/PyCQA/bandit ) |
11
+ | Type checking | [ ![ type check: mypy] ( https://img.shields.io/badge/type_check-mypy-yellowgreen.svg?logo=mypy )] ( http://mypy-lang.org/ ) [ ![ type check: pyright] ( https://img.shields.io/badge/type_check-pyright-yellowgreen.svg )] ( https://github.com/microsoft/pyright ) |
12
+ | Documentation | [ ![ docs] ( https://readthedocs.org/projects/btclib/badge/?version=latest )] ( https://btclib.readthedocs.io ) [ ![ lint: docformatter] ( https://img.shields.io/badge/lint-docformatter-yellowgreen.svg?logo=docformatter )] ( https://github.com/PyCQA/docformatter ) [ ![ lint: pydocstringformatter] ( https://img.shields.io/badge/lint-pydocstringformatter-yellowgreen.svg?logo=pydocstringformatter )] ( https://github.com/DanielNoord/pydocstringformatter ) [ ![ lint: pydocstyle] ( https://img.shields.io/badge/lint-pydocstyle-yellowgreen.svg?logo=pydocstyle )] ( https://github.com/PyCQA/pydocstyle ) |
13
+ | CI/CD | [ ![ pre-commit] ( https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit )] ( https://github.com/pre-commit/pre-commit ) [ ![ pre-commit.ci status] ( https://results.pre-commit.ci/badge/github/btclib-org/btclib/master.svg )] ( https://results.pre-commit.ci/latest/github/btclib-org/btclib/master ) [ ![ lint] ( https://github.com/btclib-org/btclib/actions/workflows/lint.yml/badge.svg )] ( https://github.com/btclib-org/btclib/actions/workflows/lint.yml ) [ ![ test] ( https://github.com/btclib-org/btclib/actions/workflows/test.yml/badge.svg )] ( https://github.com/btclib-org/btclib/actions/workflows/test.yml ) [ ![ test-py312] ( https://github.com/btclib-org/btclib/actions/workflows/test-pydev.yml/badge.svg )] ( https://github.com/btclib-org/btclib/actions/workflows/test-pydev.yml ) [ ![ coverage] ( https://coveralls.io/repos/github/btclib-org/btclib/badge.svg?logo=coveralls )] ( https://coveralls.io/github/btclib-org/btclib ) |
12
14
| Conversations | [ ![ slack] ( https://img.shields.io/badge/slack-btclib_dev-white.svg?logo=slack )] ( https://bbt-training.slack.com/messages/C01CCJ85AES ) [ ![ Follow on Twitter] ( https://img.shields.io/twitter/follow/btclib?style=social&logo=twitter )] ( https://twitter.com/intent/follow?screen_name=btclib ) |
13
15
14
16
[ Browse GitHub Code Repository] ( https://github.com/btclib-org/btclib/ )
18
20
19
21
[ btclib] ( https://btclib.org ) is a
20
22
Python3 [ type annotated] ( https://docs.python.org/3/library/typing.html )
21
- library intended for teaching, learning, and using bitcoin,
22
- its blockchain, and the associated elliptic curve cryptography.
23
+ library intended for teaching, learning, and using bitcoin;
24
+ the focus is on elliptic curve cryptography and bitcoin's blockchain .
23
25
24
26
It is rigorously and extensively tested: the test suite
25
27
[ covers 100%] ( https://coveralls.io/github/btclib-org/btclib )
26
28
of the code base and reproduces results from both informal
27
29
and major reference sources.
28
30
29
31
Originally developed for the
30
- [ _ Bitcoin and Blockchain Technology _ ] ( https://www.ametrano.net/bbt/ )
32
+ _ [ Bitcoin and Blockchain Technology ] ( https://www.ametrano.net/bbt/ ) _
31
33
course at the University of Milano-Bicocca,
32
34
btclib is not intended for production environments:
33
35
it is often refactored for improved clarity,
34
36
without care for backward compatibility; moreover,
35
37
some of its algorithms could be broken using side-channel attacks.
36
38
39
+ The library is not limited to the bitcon elliptic curve secp256k1;
40
+ anyway, for this curve FFI bindings to
41
+ [ libsecp256k1] ( https://github.com/bitcoin-core/secp256k1 )
42
+ (the optimized C library used by Bitcoin Core)
43
+ are available and used by default.
44
+
37
45
Included features are:
38
46
39
47
- modulo algebra functions (gcd, inverse, legendre symbol, square root)
@@ -50,15 +58,15 @@ Included features are:
50
58
- ECDSA signature with (message) compact encoding: standard p2pkh and
51
59
[ BIP137] ( https://github.com/bitcoin/bips/blob/master/bip-0137.mediawiki ) /[ Electrum] ( https://electrum.org/#home )
52
60
extensions to p2wpkh and p2wpkh-p2sh
61
+ - [ RFC 6979] ( https://tools.ietf.org/html/rfc6979 ) for deterministic signature
62
+ schemes
53
63
- EC Schnorr signature (according to
54
64
[ BIP340] ( https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki )
55
65
bitcoin standardization)
56
66
- batch validation
57
67
- threshold signature (see test-suite)
58
68
- MuSig multi-signature (see test-suite)
59
69
- Borromean ring signature
60
- - [ RFC 6979] ( https://tools.ietf.org/html/rfc6979 ) to make signature
61
- schemes deterministic
62
70
- Sign-to-contract commitment
63
71
- Diffie-Hellman
64
72
- Pedersen committment
@@ -95,7 +103,7 @@ python -m pip install --upgrade btclib
95
103
You might want to install btclib into a
96
104
python virtual environment; e.g. from the root folder:
97
105
98
- Shell
106
+ Shell:
99
107
100
108
``` shell
101
109
python -m venv venv_btclib
@@ -105,7 +113,7 @@ python -m pip install --upgrade btclib
105
113
106
114
Windows CMD or PowerShell:
107
115
108
- ``` cmd
116
+ ``` powershell
109
117
python -m venv venv_btclib
110
118
.\venv_btclib\Scripts\activate
111
119
python -m pip install --upgrade btclib
0 commit comments