From 7b1310ca76270ad7efd63278fe898543ab4949eb Mon Sep 17 00:00:00 2001 From: Adithya Venkatesh Date: Mon, 13 Apr 2015 23:42:18 -0400 Subject: [PATCH 1/2] Add support for importaddress --- bitcoin/rpc.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/bitcoin/rpc.py b/bitcoin/rpc.py index f949d296..4f445084 100644 --- a/bitcoin/rpc.py +++ b/bitcoin/rpc.py @@ -385,6 +385,19 @@ def gettxout(self, outpoint, includemempool=True): r['bestblock'] = lx(r['bestblock']) return r + def importaddress(self, addr, label=None, rescan=True): + """Adds an address or pubkey to wallet without the associated privkey.""" + addr = str(addr) + + if label is not None: + if rescan: + r = self._call('importaddress', addr, label, True) + else: + r = self._call('importaddress', addr, label) + else: + r = self._call('importaddress', addr) + return r + def listunspent(self, minconf=0, maxconf=9999999, addrs=None): """Return unspent transaction outputs in wallet From b595fb1b30b6e7c5062b3fbe9135166f7c52d32c Mon Sep 17 00:00:00 2001 From: Adithya Venkatesh Date: Sun, 19 Apr 2015 20:10:22 -0400 Subject: [PATCH 2/2] Added createrawtransaction basic --- bitcoin/rpc.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bitcoin/rpc.py b/bitcoin/rpc.py index 4f445084..7ae1b22b 100644 --- a/bitcoin/rpc.py +++ b/bitcoin/rpc.py @@ -218,6 +218,16 @@ def __init__(self, service_url=None, timeout=timeout, **kwargs) + def createrawtransaction(self, *args): + """Get rawtransactions when provided vin and vout + + FIXME: Implement options and accept outpoints instead of user args + """ + r = self._call('createrawtransaction', *args) + r = str(r) + tx = CTransaction.deserialize(unhexlify(r)) + return tx + def dumpprivkey(self, addr): """Return the private key matching an address """