In a world of pain at the moment. I downloaded Bitcoin Core, and before I realised I'd need the complete downloaded Blockchain, my friend transferred some coins to my address.

I did some research and am trying to import my Bitcoin core private keys to Blockchain, therefore having access to my coins. My problem is, I can't get my public address. I have tried using several commands in the console window, and are able to unlock and lock. I've used 'listaddressgroupings' - which works, but the return is "[" and then "]" directly below?

I've also used getaccountaddress and getaddressesbyaccount "Your Address" with no luck.

Many thanks

  • 1
    Listing my bitcoin addresses Listing the bitcoin addresses in your wallet is easily done via listreceivedbyaddress. It normally lists only addresses which already have received transactions, however you can list all the addresses by setting the first argument to 0, and the second one to true. *I've just seen this on a wiki page, I haven't received any transactions yet, because the blockchain hasn't downloaded fully. I don't understand how to enter the first argument to 0, and the second one to true. Additionally, what is my account name? Where would I find it? – Rhys Cole Jan 31 '16 at 22:38
  • You can't get your public address? If you need to move bitcoin from a bitcoin core wallet don't you need the private keys? – Mark S. Feb 1 '16 at 17:12
up vote 6 down vote accepted

Edit: Answer to the question: How to get private keys out of Bitcoin Core

After you found your addresses (by using the commands I listed below, for example) you can execute the folllowing command:

dumpprivatekey 1ofYourAddresses

If your wallet is password protected and locked run:

walletpassphrase "your password or passphrase" 600

And 'walletlock' when you're done to re-lock it.

You can easily recognize addresses from Private Keys because addresses start always with one (1), Private Keys instead start with 5, K or L. You don't need to manage public keys at all. Also you just need the Private key to export/import a "wallet", in fact a private key is a wallet, and from that ypthe software can find out the address(es) that correspond to it, so you need just to export that.


Answer to the original question: How to get public address in Bitcoin Core

Your main (first) bitcoin account in Bitcoin Core and bitcoin-qt is the <> account, '""'.

To get your bitcoin addresses via bitcoin-cli or via the bitcoin-qt console, for your main account, use:

getaccountaddress ""

That will return your first address of the main account, and:

getaddressesbyaccount ""

Will return (at first launch two addresses and in general) the list of all your addresses associated with your main account.


This is an example output of the getaddressesbyaccount call on a newly installed bitcoin-qt:

> bitcoin-cli getaddressesbyaccount ""

[
    "1AA37Akj16aj9nU4NYgx2cRwjgmuwpxR6Z",
    "1CbkkAbB7ootHHu9Fhbh8TtRR2iiCoNCZD"
]

This is the minimal ~/.bitcoin/bitcoin.conf you want to have to be able to run bitcoin-qt with the CLI enabled, this way you can understand which accounts and addresses you own and their balances etc. from the UI.

rpcuser=bitcoin
rpcpassword=TYPE_A_STRONG_PASS_HERE

# enables deamon in bitcoin-qt
server=1
  • These two commands give me my first receiving address, and then a list of all receiving addresses associated with my account. I can already access them through File->Receiving addresses. I'm trying to get my 'publicaddress' or public key. I need these when I enter the dumpprivkey "INSERT PUBLIC ADDRESS/PUBLIC KEY". Any idea how I could find this? – Rhys Cole Feb 1 '16 at 22:07
  • It seems you are trying to dump your private keys, not list your addresses, In that case I'll edit this answer – makevoid Feb 1 '16 at 23:10
  • @RhysCole: You need either your public address or your public key. These are related but not the same, and any of them will suffice. You already know your address - it's what your friend used to send coins to you. use it with the dumpprivkey command, e.g. dumpprivkey 1Jd6J5FaPiUYLHbqtybqaXuTUgvw65Us1R – Meni Rosenfeld Feb 2 '16 at 0:40
  • Hi, thanks again for all your help. I just did what you suggested, I used the original address my friend used which is also on the receiving addresses on my bitcoin core. However when I used the dumpprivkey "" command with that address, the reply was Invalid Bitcoin address (code -5). Do you have any other suggestions? If not is there any other way I can get access to the coins, or transfer them some other way? – Rhys Cole Feb 2 '16 at 5:28
  • As Mani and me told you, step 1: find your address, it starts with 1, getaccountaddress "" will return an address for example, step 2, use that address in the dump function: dumpprivatekey 1................, it will give a private key, you can recognize it because it starts with 5 – makevoid Feb 2 '16 at 7:08

@Rhyscole

Type

validateaddress "ADDRESS_BASE58_ENCODED" (i.e.address for which you want to know public key)

Thank you.

  • I think this the correct answer. "pubkey" field holds the public key. – Abhishek Sinha Aug 10 at 6:37

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.