How to generate an address for bitcoin?

0

I installed bitcoin core and I am generating an address using getnewaddress. To get the private_key of the address I am using dumpprivkey. To get the unspents I am using listunspent. Till here everything is working perfectly. Now the problem is let's say If I created an address without using bitcoin core then can I get the unspents of the address? I tried using dumpprivkey and it is returning

unspent = host.call('listunspent',0,9999999,['msjK2Az65fzqzUDA6yB6QeNi42ssUAxG93'])

Error:

Exception: Error in RPC call: {'code': -4, 'message': 'Private key for address msjK2Az65fzqzUDA6yB6QeNi42ssUAxG93 is not known'}

I tried listunspent and it is returning empty list. How to get the unspent of the address created without using bitcoin core?

merklexy

Posted 2018-06-18T14:09:50.180

Reputation: 87

Answers

0

From my experience the bitcoin wallet can only use listunspend with known addresses and keys. One can import keys or addresses, addresses without keys will be watch-only addresses. I am not sure if txindex=1 is required though (with a rescan of the blockchain). See here and for txindex also here.

pebwindkraft

Posted 2018-06-18T14:09:50.180

Reputation: 4 568

0

If I created an address without using bitcoin core then can I get the unspents of the address?

No you cant see them using command listunspent

I tried using dumpprivkey and it is returning Error message

This is because your node doesnt identify the address that is not generated by it. It has inbuilt wallet configuration that allow you to send and recive fund in addresses generated by your full node . As It doesnt have any info about address created outside your full node it gives you error message when you call for private key. You cant even transfer fund from such addresses as you dont have private key to do so.

You can use bitcoin libraries to generate address, and store their pvt key to sign transaction . Full node has nothing to do in process.

cryptoKTM

Posted 2018-06-18T14:09:50.180

Reputation: 489