2

calling bitcoin-cli dumpwallet returns wallet private keys and addresses.

Example

L34D2hAS9KBJQzJkHtmNt1bdSJ18cQUvfSnJEqPKH2oUj6sBxvXt 2017-11-23T05:11:13Z reserve=1 # addr=1D2mnuj9qeRAzmw8mjLDciyvqzQiiYZCfE hdkeypath=m/0'/0'/1030'

Importing this private key to wallet using importprivkey command returns null on success.

How to get bitcoin address related to this private key? or is there's any way get this private key details like balance or addresses?

  • You could use an online wallet like blockchain.info/wallet/#. – Oliver Nov 28 '17 at 10:20
  • Thanks but i'm looking for a solution on bitcoin-core. if you got any idea how blockchain is getting these info it would be great. – Adam Nov 28 '17 at 11:20
2

the private key is a Private Key WIF Compressed, 52 characters base58, and can be used to convert into (compressed or uncompressed) public keys. These pub keys are usually hex codes, and can be converted into bitcoin addresses: 1D2mnuj9qeRAzmw8mjLDciyvqzQiiYZCfE and 1KWvNZB4Gf2Kars88aGR2cedUb81Q6gZKC. There is no easy way I am aware of to do this in bitcoin client.

Looking at the line you provided, the bitcoin address is behind the comment sign (#), and is part of a HD key, which complicates things even more, if I had to explain it. To understand the whole idea behind keys, you may want to read bitcoin.org or the book af Andreas "Mastering Bitcoin" (online available).

Looking then at e.g. blockchain.info, you can provide the addresses or the keys, and see that there is no value.

Hint: never ever (!) use this key again to transfer values. It has been disclosed, and people are only waiting to snipe the values from this address! - me too :-)

  • So is it possible to generate more than one address using same private key? – Adam Nov 28 '17 at 12:12
  • yes. A priv key alone can already generate two pubkeys (compressed and uncompressed). And HD wallets: just a short extract from the book: "HD wallets contain keys derived in a tree structure, such that a parent key can derive a sequence of children keys, each of which can derive a sequence of grandchildren keys, and so on, to an infinite depth". – pebwindkraft Nov 28 '17 at 12:17
  • Thanks for your answer, I would be happy to get this book! – Adam Nov 28 '17 at 12:20
  • here: chimera.labs.oreilly.com/books/1234000001802 and there is somewhere already the second edition (don't have the link ...) – pebwindkraft Nov 28 '17 at 12:20
0

using PHP and Bitcoin-PHP library, we can do the following to get Bitcoin address of any private key:

        try {
            $master = PrivateKeyFactory::fromWif($key);
        } catch (\Exception $e) {
            echo "Invalid Address";
        }

        $BitcoinAddress = $master->getPublicKey()->getAddress()->getAddress();

        echo $BitcoinAddress;

protected by Community Dec 25 '17 at 7:41

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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