This Python3 module implements support for Elements transactions.
It builds on top, and is intended to be used along with python-bitcointx library.
Requirements
-
python-bitcointx (version >= 1.0.0)
-
Configure parameters for
secp256k1-zkp:
./configure --enable-experimental \
--enable-module-generator \
--enable-module-rangeproof \
--enable-module-surjectionproof \
--enable-module-ecdh \
--enable-module-recovery
Usage:
With contextual switch to Elements parameters:
import os
import elementstx
from bitcointx import ChainParams, get_current_chain_params
from bitcointx.wallet import CCoinKey, CCoinExtKey, CCoinAddress, P2PKHCoinAddress
with ChainParams('elements'):
k = CCoinExtKey.from_seed(os.urandom(32))
a = P2PKHCoinAddress.from_pubkey(k.derive_path("m/0'/0'/1").pub)
print('example {} address: {}'.format(get_current_chain_params().name, a))
assert CCoinAddress(str(a)) == a
With global switch to Elements parameters:
from elementstx import ElementsParams
from bitcointx import select_chain_params
select_chain_params('elements')
# or, using the chain params class directly
select_chain_params(ElementsParams)
# To switch to Liquid Network parameters:
select_chain_params('elements/liquidv1')
Without the switch of chain parameters:
from elementstx.core import CElementsTransaction
transaction_data = read_tx_data()
tx = CElementsTransaction.deserialze(transaction_data)
print("Number of txout witnesses:", len(tx.wit.vtxoutwit))
Example Code
See examples/ directory.
Metadata
Release files for python-elementstx 0.1.5.post0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_elementstx-0.1.5.post0-py3-none-any.whl | Python 3 | none | any | Details for python_elementstx-0.1.5.post0-py3-none-any.whl |
Release files / python_elementstx-0.1.5.post0-py3-none-any.whl
| Download URL | python_elementstx-0.1.5.post0-py3-none-any.whl |
|---|---|
| Size | 50.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f6018ad1ee19e1234215641b10a1a2278f67c60fbe15e80ed86038e0cc75799
|
|
BLAKE2b-256 checksum How to use checksums |
b1f3987fe103956eea68fc02b4da8d86a301c7ae80bc88223ef10a30bab65574
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.8
|
Security for python-elementstx 0.1.5.post0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.