btclib-org / btclib Goto Github PK
View Code? Open in Web Editor NEWbtclib: a python3 library for 'bitcoin cryptography'
Home Page: https://btclib.org
License: MIT License
btclib: a python3 library for 'bitcoin cryptography'
Home Page: https://btclib.org
License: MIT License
I hope to create a detailed example document to help beginners learn BTC better.
For example, sending transactions, deriving wallets, etc.
Hello,
Your code looks useful. However, I've installed the btclib under the python 3.6.5 and all went well with installation but when I try to run some of the files I get errors that there is no btclib module.
see RELEASE.md
/Users/ferdi/.pyenv/versions/btclib_3.11.1/lib/python3.11/site-packages/setuptools/command/build_py.py:202: SetuptoolsDeprecationWarning: Installing 'btclib.mnemonic._data' as data is deprecated, please list it in `packages`.
!!
############################
# Package would be ignored #
############################
Python recognizes 'btclib.mnemonic._data' as an importable package,
but it is not listed in the `packages` configuration of setuptools.
'btclib.mnemonic._data' has been automatically added to the distribution only
because it may contain data files, but this behavior is likely to change
in future versions of setuptools (and therefore is considered deprecated).
Please make sure that 'btclib.mnemonic._data' is included as a package by using
the `packages` configuration field or the proper discovery methods
(for example by using `find_namespace_packages(...)`/`find_namespace:`
instead of `find_packages(...)`/`find:`).
You can read more about "package discovery" and "data files" on setuptools
documentation page.
!!
check.warn(importable)
copying btclib/py.typed -> build/lib/btclib
creating build/lib/btclib/_data
copying btclib/_data/mainnet.json -> build/lib/btclib/_data
copying btclib/_data/regtest.json -> build/lib/btclib/_data
copying btclib/_data/testnet.json -> build/lib/btclib/_data
creating build/lib/btclib/mnemonic/_data
copying btclib/mnemonic/_data/english.txt -> build/lib/btclib/mnemonic/_data
copying btclib/mnemonic/_data/italian.txt -> build/lib/btclib/mnemonic/_data
creating build/lib/btclib/ecc/_data
copying btclib/ecc/_data/ec_Brainpool.json -> build/lib/btclib/ecc/_data
copying btclib/ecc/_data/ec_NIST.json -> build/lib/btclib/ecc/_data
copying btclib/ecc/_data/ec_SEC2v1_insecure.json -> build/lib/btclib/ecc/_data
copying btclib/ecc/_data/ec_SEC2v2.json -> build/lib/btclib/ecc/_data
/Users/ferdi/.pyenv/versions/btclib_3.11.1/lib/python3.11/site-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
installing to build/bdist.macosx-13.1-x86_64/wheel
running install
It should be possible to write:
from btclib.tx import Tx, TxIn, TxOut
instead of manually importing each from btclib.tx.tx_whatever
.
Describe the bug
When I try to import Tx from btclib.tx, Import Error raised.
To Reproduce
Steps to reproduce the behavior:
1.py
from btclib.tx import Tx
In [1]: from btclib.tx import Tx
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-1-28f1196e232b> in <module>
----> 1 from btclib.tx import Tx
~/.local/lib/python3.8/site-packages/btclib/tx/__init__.py in <module>
12
13 from btclib.tx.out_point import OutPoint
---> 14 from btclib.tx.tx import Tx, join_txs
15 from btclib.tx.tx_in import TxIn
16 from btclib.tx.tx_out import TxOut
~/.local/lib/python3.8/site-packages/btclib/tx/tx.py in <module>
37 from btclib.exceptions import BTClibValueError
38 from btclib.hashes import hash256
---> 39 from btclib.script import Witness
40 from btclib.tx.tx_in import TX_IN_COMPARES_WITNESS, TxIn
41 from btclib.tx.tx_out import TxOut
~/.local/lib/python3.8/site-packages/btclib/script/__init__.py in <module>
12
13 from btclib.script.script import Command, Script, op_int, parse, serialize
---> 14 from btclib.script.script_pub_key import (
15 ScriptPubKey,
16 address,
~/.local/lib/python3.8/site-packages/btclib/script/script_pub_key.py in <module>
15 from typing import Callable, Sequence
16
---> 17 from btclib import b32, b58, var_bytes
18 from btclib.alias import Octets, String
19 from btclib.ec import point_from_octets
~/.local/lib/python3.8/site-packages/btclib/b32.py in <module>
52 from btclib.hashes import hash160, sha256
53 from btclib.network import NETWORKS, network_from_key_value
---> 54 from btclib.script import TaprootScriptTree, output_pubkey
55 from btclib.to_pub_key import Key, pub_keyinfo_from_key
56 from btclib.utils import bytes_from_octets
ImportError: cannot import name 'TaprootScriptTree' from partially initialized module 'btclib.script' (most likely due to a circular import) (/home/wanlin_wang_cobo_com/.local/lib/python3.8/site-packages/btclib/script/__init__.py)
Expected behavior
Successfully imported.
Screenshots
N/A
Environment (please complete the following information):
Additional context
I've tried 2023.1.17 version, still have this problem. I'm curious nobody else occur this problem?
Describe the bug
It seems not right to check signature of taproot is valid by assert length of it equals 64:
btclib/btclib/psbt/psbt_utils.py
Line 307 in da0cfc1
To Reproduce
There is an example on how to make a valid taproot signature which length is not 64:
bitcoinjs/bitcoinjs-lib#1934
Environment (please complete the following information):
There is a function address_from_xpub to generate the address from xpub.
Could we have a key_from_xprv to generate the private key from xprv in bip32.py as well?
Hey,
I'm just starting out with Python, so I'm not sure how to accomplish this:
For example, I would have string key = 'zpub6rLtzSoXnXKPXHroRKGCwuRVHjgA5YL6oUkdZnCfbDLdtAKNXb1FX1EmPUYR1uYMRBpngvkdJwxqhLvM46trRy5MRb7oYdSLbb4w5VC4i3z'
How would I make the btclib package return a list like this?
0: bc1qvqatyv2xynyanrej2fcutj6w5yugy0gc9jx2nn
1: bc1q360p67y3jvards9f2eud5rlu07q8ampfp35vp7
2: bc1qs4k3p9w4ke5np3lr3lgnma9jcaxedau8mpwawu
3: bc1qpk48z0s7gvyrupm2wmd7nr0fdzkxa42372ver2
Any help would be appreciated. Thanks! :-)
Hello, I installed the package via pip but when I want to use the b58 module like
from btclib import b58
I got the following error:
ImportError: cannot import name 'b58' from 'btclib' (/usr/local/lib/python3.9/site-packages/btclib/__init__.py)
Checking the packages shows that indeed it is not present
Any ideas what is wrong or how can I get that module installed?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.