Created
September 7, 2017 17:04
-
-
Save mflaxman/14e62e46bbc85068fa3d0fd2e00c8df5 to your computer and use it in GitHub Desktop.
Sweep funds from one BTC address to another
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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