I've been using the bitcoin-python library for making payments from within Python. This worked pretty simple:
>>> import bitcoinrpc
>>> conn = bitcoinrpc.connect_to_local()
>>> conn.sendtoaddress('bitcoin_address_here', 0.5)
The Readme of that library now says that it is not maintained anymore and refers to the python-bitcoinlib as a successor. So now I'm trying to wrap my head around that lib, but it seems to be a bit more difficult than bitcoin-python used to be. I now understand I can connect to the running bitcoind using the following code:
>>> import bitcoin.rpc as rpc
>>> proxy = rpc.Proxy()
>>> proxy.getinfo()
{u'connections': 36, u'errors': u'', u'blocks': 295646, u'paytxfee': 0, u'keypoololdest': 1394108331, u'walletversion': 60000, u'difficulty': Decimal('6119726
089.12814713'), u'testnet': False, u'version': 90100, u'proxy': u'', u'protocolversion': 70002, u'timeoffset': -1, u'balance': 1856000, u'keypoolsize': 101}
So far so good. The problem is now that I have no idea how I can do a simple payment. I see there is a function called proxy.sendrawtransaction(self, tx)
, which apparently takes a raw transaction as an argument. I have no idea how to create a raw transaction though, plus I would expect that there is some kind of send_to_address(address, amount)
available, but I can't find it around the library.
So does anybody know how I can send a simple transaction to an address with the python-bitcoinlib? All tips are welcome!