<p>Each output in Bitcoin transactions has a <code>scriptPubKey</code> restricting how the UTXO can later be spent. For P2PK the <code>scriptPubKey</code> consists of <code>&lt;pubkey&gt; OP_CHECKSIG</code>, the output type associated with addresses starting on <code>1…</code>, Pay to Public Key Hash (P2PKH) corresponds to a <code>scriptPubKey</code> of shape <code>OP_DUP OP_HASH160 &lt;pubkeyhash&gt; OP_EQUALVERIFY OP_CHECKSIG</code> instead. Addresses starting with <code>3…</code> encode P2SH outputs, which use the <code>scriptPubKey</code> of <code>OP_HASH160 &lt;scripthash&gt; OP_EQUAL</code>.</p>
<p>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 <code>&lt;pubkey&gt; OP_CHECKSIG</code> script, the blockchain explorer shows the address of a <code>OP_DUP OP_HASH160 &lt;pubkeyhash&gt; OP_EQUALVERIFY OP_CHECKSIG</code> 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 <code>12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX</code>. 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).</p>
<blockquote>
<p>Will the browser hash every public key in the UTXO to the public key hash and then compare with my?</p>
</blockquote>
<p>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.</p>
<p>One could also expect that blockchain explorers index outputs on basis of the <code>scriptPubKey</code>, but testing both blockchain.info and blockstream.info, neither has an index on the full <code>scriptPubKey</code>. It seems that most blockchain explorers only index outputs that fit the standard address schemas.</p>
<blockquote>
<p>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?</p>
</blockquote>
<p>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 <code>scriptPubKey</code>.</p>

CC BY-SA 4.0
2022-01-29T02:31:07.957Z
in the last case , i have to give my redeem script to the browser, right?
KHJUAF403456ZS3K564WAEF
CC BY-SA 4.0
2022-01-29T12:12:18.533Z
No, just the address which encodes the scripthash, not the script.
Murch
CC BY-SA 4.0
2022-01-28T17:04:09.257Z
2022-01-29T12:28:52.717Z
2022-01-29T12:28:52.717Z
Murch
<p>Suppose someone sends bitcoins to me using P2PK, I only enter my address starting with 1 in the bitcoin browser, can i get results? my public key hash doesn't appear in either UTXO, only one UTXO has my public key.</p>
<ol>
<li>Will the browser hash every public key in the UTXO to the public key hash and then compare with my?</li>
<li>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?</li>
</ol>

<utxo><p2sh><p2pk>
How bitcoin browsers check P2PK and P2SH balance?
KHJUAF403456ZS3K564WAEF
# How bitcoin browsers check P2PK and P2SH balance?

(Asked by: username_0 on 2022-01-28)

Suppose someone sends bitcoins to me using P2PK, I only enter my address starting with 1 in the bitcoin browser, can i get results? my public key hash doesn't appear in either UTXO, only one UTXO has my public key.

1. Will the browser hash every public key in the UTXO to the public key hash and then compare with my?
2. 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?

**Tags:** utxo, p2sh, p2pk


---

## 1 answers

### Answer by username_1 on 2022-01-28. Score: 3

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`.

> **Comments:**
> **username_0**: in the last case , i have to give my redeem script to the browser, right?  
> **username_1**: No, just the address which encodes the scripthash, not the script.  

---

