7
5
Lets say I have a bitcoin address that has 10 BTC sent to it. I also have the private key for this address
Using Python (2 or 3) is there a way to create a signed transaction (which I believe is a long string of hex digits) that can then be sent to an external service (bockchain.info or whatever) for network propogation.
It seems all the python libraries for making transactions require a connection to the bitcoind rpc interface. In my application, there will be no locally ran bitcoind.
I'm thinking the code I'm looking for is like this:
address = '1ALis8zeW1XduXf98ZjoL4EKLen5mVA1q4'
private = '5KiUZd5as1TKsiwnt1KiPgiECtXiuF9BS1MxrAgedNrXcScm4d5'
from some_btc_library import make_transaction
tx_hex = make_transaction(
inputs=[[address, private]],
to='123rn4tNGhf1ZehQHLohYn8WRQYhjeGSCw',
amount=3,
miner_fee=0.0001
)
send_to_exteral_service(tx_hex)
print "transaction complete"
1Note that in addition to the destination address and the private key, the other piece of data you need is the utxo (id and output number from a previous transaction) which is to be spent. Unless you happen to know what is, you'll need a Bitcoin client (or access to a copy of the block chain) to find an appropriate utxo given the private key. – Nate Eldredge – 2014-09-17T06:58:05.013