Skip to content

Instantly share code, notes, and snippets.

@charlieb
Last active January 23, 2018 16:59
Show Gist options
  • Save charlieb/55da9e2ecfbac1bd403d93ced78bcc8c to your computer and use it in GitHub Desktop.
Save charlieb/55da9e2ecfbac1bd403d93ced78bcc8c to your computer and use it in GitHub Desktop.
Pycoin Dash Transaction
#!/usr/bin/env python3
# Note: Requires https://github.com/charlieb/pycoin version until
# https://github.com/richardkiss/pycoin/pull/265 is merged
import pycoin.services.blockcypher as bc
import pycoin.tx.tx_utils as tx_utils
d = bc.BlockcypherProvider(netcode='DASH', api_key='my_free_blockcypher_api_key')
spendables = d.spendables_for_address('my_input_address_with_15000_duff')
payables = [('output_address_1', 5000), ('output_address_2', 5000), ('output_address_3', 5000)]
tx = tx_utils.create_tx(spendables, payables, fee=0) # this tx will not be accepted into a block with a zero fee.
print(tx)
tx_utils.sign_tx(tx, ['my WIF'])
print(tx)
rtx = d.broadcast_tx(tx)
print(rtx)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment