Danny, you were so helpful figuring out that compressed public key, maybe you can help me out with this one too.
Take a look at this transaction:
https://blockchain.info/tx/195c96a25c4e63f641a2ddd920a9d00d2db947752f41c6be6d4cdd21e54f7ae8It has two output scripts, the second one contains a RIPEMD160 hash as follows:
OP_HASH160 49206c6f76652077697a6b6964303537203c3300 OP_EQUAL
When I run: "49206c6f76652077697a6b6964303537203c3300" through my code to produce the ASCII key, I get:
"17ffAqKkfMLF5QAYwFEDkRtF2mJMzrkmpi" as a result.
However, blockchain.info says the ASCII address is: "38Mg6NpCDFedAZrz4LtpB4FBBHb5WqwHaN"
This looks suspect to me, to begin with, because it doesn't start with '1'. I tend to think that my representation is correct and blockchain.info has a bug. Can you confirm?
Thanks,
John
Bitcoin addresses that start with a 1 are "pay to pubkey hash" scripts. The 1 is a version number that tells the wallet software that it should create/recognize a script in the format of:
OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG
Bitcoin addresses that start with a 3 are "pay to script hash" scripts. The 3 is a version number that tells the wallet software that it should create/recognize a script in the format of:
OP_HASH160 (20-byte-hash-value> OP_EQUAL
The representation of the pay-to-script-hash address is described in
BIP-0013base58-encode: [one-byte version][20-byte hash][4-byte checksum]
For more details on how to use Pay-to-script-hash you can take a look at
BIP-0016