Each output in Bitcoin transactions has a scriptPubKey
restricting how the UTXO can later be spent. For P2PK the scriptPubKey
consists of <pubkey> OP_CHECKSIG
, the output type associated with addresses starting on 1…
, Pay to Public Key Hash (P2PKH) corresponds to a scriptPubKey
of shape OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG
instead. Addresses starting with 3…
encode P2SH outputs, which use the scriptPubKey
of OP_HASH160 <scripthash> OP_EQUAL
.
Given that there is no address standard for P2PK, some blockchain explorers misleadingly show a P2PKH address instead. I.e. even while an output paid to a <pubkey> OP_CHECKSIG
script, the blockchain explorer shows the address of a OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG
script using the hash of the same public key. For example, the reward for block 1 was paid out to a P2PK output, but e.g. blockchain.info has indexed the output under the P2PKH address 12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX
. On the other hand, searching for the same address on another explorer such as blockstream.info, the search result will not include the coinbase transaction (as I would consider correct).
Will the browser hash every public key in the UTXO to the public key hash and then compare with my?
It seems to me that blockchain explorers do not maintain indexes of public keys at all. Therefore, searching for the public key corresponding to a P2PKH will never get a hit. As said before, some blockchain explorers have indexed all P2PK outputs to the related P2PKH addresses instead. You'd be able to search for P2PK outputs that way there.
One could also expect that blockchain explorers index outputs on basis of the scriptPubKey
, but testing both blockchain.info and blockstream.info, neither has an index on the full scriptPubKey
. It seems that most blockchain explorers only index outputs that fit the standard address schemas.
Going a step further, if someone creates a multi-signature script, hashes that script, and sends me bitcoins using P2SH. Can Bitcoin Browser Check Balance?
There is an address standard for P2SH outputs. All blockchain explorers should index P2SH outputs the same way using these addresses. A P2SH address corresponds to the script hash used in the scriptPubKey
.