Dash module for use with python-bitcointx
Project description
This Python3 library implements support for Dash transactions.
It builds on top, and is intended to be used along with python-bitcointx library.
Requirements
- python-bitcointx (version >= 1.0.0)
Usage:
With contextual switch to Dash parameters:
import os
import dashtx
from bitcointx import ChainParams, get_current_chain_params
from bitcointx.wallet import (
CCoinKey, CCoinExtKey, P2WPKHCoinAddress, CCoinAddress
)
with ChainParams('dash'):
k = CCoinExtKey.from_seed(os.urandom(32))
a = P2WPKHCoinAddress.from_pubkey(k.derive_path("m/0h/0h/1").pub)
print('example {} address: {}'.format(get_current_chain_params().NAME, a))
assert CCoinAddress(str(a)) == a
With global switch to Dash parameters:
from dashtx import DashMainnetParams
from bitcointx import select_chain_params
select_chain_params('dash')
# or, using the chain params class directly
select_chain_params(DashMainnetParams)
Without the switch of chain parameters:
from dashtx.wallet import P2SHDashAddress
p2sh_addr = P2SHDashAddress('7UHUEqN8EwpHFJjf7U83YAUhEinxYt1MAK')
p2sh_addr = P2SHDashAddress.from_scriptPubKey(p2sh_addr.to_scriptPubKey())
assert str(p2sh_addr) == '7UHUEqN8EwpHFJjf7U83YAUhEinxYt1MAK'
from bitcointx import select_chain_params
from bitcointx.wallet import CCoinAddress
from dashtx.wallet import P2SHDashAddress
select_chain_params('dash')
p2sh_addr = CCoinAddress('7UHUEqN8EwpHFJjf7U83YAUhEinxYt1MAK')
assert isinstance(p2sh_addr, P2SHDashAddress)
this also works with ChainParams context manager.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-dashtx-0.1.1.tar.gz
(7.0 kB
view details)
File details
Details for the file python-dashtx-0.1.1.tar.gz
.
File metadata
- Download URL: python-dashtx-0.1.1.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.7.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df36373164247af47c0d56fa187d13de8ab7866704061f43ca5188566e5f83d4 |
|
MD5 | d57ec61ad3fef3a059bbac18cb1303f2 |
|
BLAKE2b-256 | 83384f2e042c38d7ebbd1d138af90582866cc5b28bfe52c0f57634425c9bdfc3 |