Skip to content

Instantly share code, notes, and snippets.

@mflaxman

mflaxman/sweep.py

Created Sep 7, 2017
Embed
What would you like to do?
Sweep funds from one BTC address to another
from pycoin.tx.tx_utils import create_signed_tx
from pycoin.services.blockcypher import BlockcypherProvider
# inspect your spendables
spendables = [x.as_text() for x in BlockcypherProvider().spendables_for_address(address=FROM_ADDRESS)]
# sign TX
signed_tx = create_signed_tx(
spendables=spendables,
payables=[TO_ADDRESS],
wifs=[WIF],
fee=FEE_IN_SATOSHIS,
)
# inspect signed TX and then use a pushtx service to broadcast
signed_tx.as_hex()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment