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