Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: gpmn on February 07, 2014, 04:28:11 PM



Title: How to get the pubkey of other's address?
Post by: gpmn on February 07, 2014, 04:28:11 PM
Besides they tell me, Is it possible to get other's public key?

such as from the signed message?


Title: Re: How to get the pubkey of other's address?
Post by: gpmn on February 07, 2014, 05:16:03 PM
Oh, I just take a look in the code, the signed message do have  the public key;

but it seems that the code is not so easy to be reused. Is any document mentions about how does the message encode?

Besides they tell me, Is it possible to get other's public key?

such as from the signed message?



Title: Re: How to get the pubkey of other's address?
Post by: piotr_n on February 07, 2014, 10:46:29 PM
Quick answer: no, you can't get public key from an address.


Title: Re: How to get the pubkey of other's address?
Post by: gpmn on February 08, 2014, 03:18:06 AM
not from address, but from the signed message;

I saw the code,  the old version, 2 years ago, bitcoind feeded back the pubkey, while now it just feeds back ok or not;

I think the most fast way is to clone the code and add such output.

Quick answer: no, you can't get public key from an address.


Title: Re: How to get the pubkey of other's address?
Post by: Bitcoin-Monster on February 08, 2014, 03:19:58 AM
It is (quite) impossible to compute the public key of an address, as the address is computed from the hash of the public key


Title: This message was too old and has been purged
Post by: Evil-Knievel on February 08, 2014, 10:18:08 PM
This message was too old and has been purged


Title: Re: How to get the pubkey of other's address?
Post by: BurtW on February 08, 2014, 10:33:00 PM
If there has ever been a send transaction from the Bitcoin address then the public key is in the blockchain and you can just read it out.  But if there are no send transactions from the address then it is impossible to calculate the public key from the Bitcoin address.


Title: Re: How to get the pubkey of other's address?
Post by: DeathAndTaxes on February 08, 2014, 10:36:04 PM
In fact it is pretty easy.

- Go to the address in blockchain.info.
- Search for an outgoing transaction and click it
- Show Input/Output Scripts
- In the Input Scripts the value starting with 04.... is the public key.

What is the pubkey of this address?

112xBKNMa2Cj7g9DT8MJYYwUDoKFmYB3EM



Title: This message was too old and has been purged
Post by: Evil-Knievel on February 08, 2014, 10:39:53 PM
This message was too old and has been purged


Title: Re: How to get the pubkey of other's address?
Post by: BurtW on February 08, 2014, 10:45:23 PM
EK, just wondering if you have been able to crack any of the 200,000 public keys that Greg gave you.  How is that going?


Title: This message was too old and has been purged
Post by: Evil-Knievel on February 08, 2014, 10:58:02 PM
This message was too old and has been purged


Title: Re: How to get the pubkey of other's address?
Post by: gpmn on February 10, 2014, 12:47:41 PM
I changed the code of bitcoin src/rpcmisc.cpp then recompiled it
I ask for their signed messages, then I can get pubkey from the signed message

Value verifymessage(const Array& params, bool fHelp)
....
...
    CPubKey pubkey;
    Object obj;
    if (!pubkey.RecoverCompact(ss.GetHash(), vchSig)){
      obj.push_back(Pair("pubkey",  ""));
      obj.push_back(Pair("valid",   false));
    }else{
      obj.push_back(Pair("pubkey",  HexStr(pubkey.begin(), pubkey.end())));
      obj.push_back(Pair("valid",   pubkey.GetID() == keyID));
    }

    return obj;
    // return (pubkey.GetID() == keyID);
}

In fact it is pretty easy.

- Go to the address in blockchain.info.
- Search for an outgoing transaction and click it
- Show Input/Output Scripts
- In the Input Scripts the value starting with 04.... is the public key.

What is the pubkey of this address?

112xBKNMa2Cj7g9DT8MJYYwUDoKFmYB3EM



You can only determine the Public Key once an outgoing transaction has been made. As this address is "blank" it is impossible in this case.