Is it possible with the standard client? How?
I am aware that the blockchain only contains the pubkey after a tx from that address.
Bitcoin Stack Exchange is a question and answer site for Bitcoin crypto-currency enthusiasts. It only takes a minute to sign up.Sign up to join this community
It is impossible to compute the public key of an address, as the address is computed from the hash of the public key. You can retrieve the public key from address with the reference client using the
validateaddress RPC call (or in the debug window of Bitcoin-Qt), but that simply fetches it from the wallet, and only works if the address is your.
What do you need the public key for, if it's not your address?
It is impossible. Given an ECDSA (compressed 65Bytes or not 33Bytes) public-key K, a Bitcoin address is generated using the cryptographic hash functions SHA-256 and RIPEMD-160. The public-key is hashed twice: HASH160 = RIPEMD-160(SHA-256(K)). The Bitcoin address is computed directly from this HASH160 value as
base58(0x00 || HASH160 || bSHA-256(SHA-256(0x00 || HASH160))/2224c). "||=concatenation"
so it is impossible to reverse the hash to get the public key.
To be honest, it IS possible, but you need a signature made by that address. From that point, you can get the public key.
See this piece of code: https://github.com/bitcoinjs/bitcoinjs-message/blob/master/index.js#L57