register_command('createrawtransaction', 2, 2, False, True, False, 'similar to bitcoind\'s command')
register_command('deseed', 0, 0, False, True, False, 'Remove seed from wallet, creating a seedless, watching-only wallet.')
register_command('decoderawtransaction', 1, 1, False, False, False, 'similar to bitcoind\'s command')
-register_command('dumpprivkey', 1, 1, False, True, True, 'Dumps a specified private key for a given address', 'dumpprivkey <bitcoin address>')
-register_command('dumpprivkeys', 0, 0, False, True, True, 'dump all private keys')
+register_command('getprivatekeys', 1, 1, False, True, True, 'Get the private keys of a given address', 'getprivatekeys <bitcoin address>')
+register_command('dumpprivkeys', 0, 0, False, True, True, 'Dump all private keys in your wallet')
register_command('freeze', 1, 1, False, True, True, 'Freeze the funds at one of your wallet\'s addresses', 'freeze <address>')
register_command('getbalance', 0, 1, True, True, False, 'Return the balance of your wallet, or of one account in your wallet', 'getbalance [<account>]')
register_command('getservers', 0, 0, True, False, False, 'Return the list of available servers')
register_command('validateaddress', 1, 1, False, False, False, 'Check that the address is valid', 'validateaddress <address>')
register_command('verifymessage', 3,-1, False, False, False, 'Verifies a signature', verifymessage_syntax)
-#register_command('encrypt', 2,-1, False, False, False, 'encrypt a message with pubkey','encrypt <pubkey> <message>')
-#register_command('decrypt', 2,-1, False, True, True, 'decrypt a message encrypted with pubkey','decrypt <pubkey> <message>')
+register_command('encrypt', 2,-1, False, False, False, 'encrypt a message with pubkey','encrypt <pubkey> <message>')
+register_command('decrypt', 2,-1, False, True, True, 'decrypt a message encrypted with pubkey','decrypt <pubkey> <message>')
register_command('daemon', 1, 1, True, False, False, '<stop|status>')
register_command('getproof', 1, 1, True, False, False, 'get merkle proof', 'getproof <address>')
register_command('getutxoaddress', 2, 2, True, False, False, 'get the address of an unspent transaction output','getutxoaddress <txid> <pos>')
def createrawtransaction(self, inputs, outputs):
- inputs = map(lambda i: {'prevout_hash': i['txid'], 'prevout_n':i['vout']}, inputs )
+ for i in inputs:
+ i['prevout_hash'] = i['txid']
+ i['prevout_n'] = i['vout']
outputs = map(lambda x: (x[0],int(1e8*x[1])), outputs.items())
tx = Transaction.from_io(inputs, outputs)
return tx
def unfreeze(self,addr):
return self.wallet.unfreeze(addr)
- def dumpprivkey(self, addr):
+ def getprivatekeys(self, addr):
return self.wallet.get_private_key(addr, self.password)
def dumpprivkeys(self, addresses = None):
return electrum.ELECTRUM_VERSION
def getmpk(self):
- return self.wallet.get_master_public_keys()
+ return self.wallet.get_master_public_key()
def getseed(self):
mnemonic = self.wallet.get_mnemonic(self.password)
def sweep(self, privkey, to_address, fee = 0.0001):
- pubkey = public_key_from_private_key(privkey)
- address = address_from_private_key(privkey)
- pay_script = Transaction.pay_script(address)
- unspent = self.network.synchronous_get([ ('blockchain.address.listunspent',[address])])[0]
- if not unspent:
- return
- total = sum( map(lambda x:int(x.get('value')), unspent) ) - int(Decimal(fee)*100000000)
- inputs = map(lambda i: {'prevout_hash': i['tx_hash'], 'prevout_n':i['tx_pos'], 'scriptPubKey':pay_script, 'redeemPubkey':pubkey}, unspent)
- outputs = [(to_address, total)]
- tx = Transaction.from_io(inputs, outputs)
- tx.sign({ pubkey:privkey })
- return tx
+ fee = int(Decimal(fee)*100000000)
+ return Transaction.sweep([privkey], self.network, to_address, fee)
def signmessage(self, address, message):