<blockquote>
<p>During parsing of Bitcoin data from blockchain, I found many transactions which has invalid script (example 37b828de0da38f0b3b9ec09f6f8b7883c3202a99a285b0b0087f19f9cbf526d9,f6502e80d8a8dc9e59bb518a62a6443479dd72cd153929272ac21bab26317226)</p>
</blockquote>
<blockquote>
<p>Is there a way to parse these scripts to pull out the output address?</p>
</blockquote>
<p>Addresses are human-readable shorthand ways of writing scriptPubKeys that follow a certain template. Not every script has a corresponding address. Only these are defined:</p>
<ul>
<li>P2PKH addresses (1...): <code>OP_DUP OP_HASH160 &lt;keyhash&gt; OP_EQUALVERIFY OP_CHECKSIG</code>.</li>
<li>P2SH addresses (3..., defined in BIP13): <code>OP_HASH160 &lt;scripthash&gt; OP_EQUAL</code> (defined in BIP16).</li>
<li>P2WPKH addresses (42-character bc1q..., defined in BIP173): <code>OP_0 &lt;pubkeyhash&gt;</code> (defined in BIP141).</li>
<li>P2WSH addresses (62-character bc1q..., defined in BIP173): <code>OP_0 &lt;scripthash&gt;</code> (defined in BIP141).</li>
<li>P2TR addresses (62-character bc1p..., defined in BIP350): <code>OP_1 &lt;tweaked key&gt;</code> (defined in BIP341).</li>
<li>Future native witness addresses (bc1..., defined in BIP350): <code>OP_n &lt;program&gt;</code>.</li>
</ul>
<p>Any scriptPubKey not matching any of the above templates doesn't have a corresponding script. Unparseable scripts are among those.</p>
<blockquote>
<p>If not, what happened to the BTC send to these invalid script?</p>
</blockquote>
<p>Those coins are lost. There is no way to spend them, because the script can't be executed if it can't be parsed, and without it executing successfully it can't be spent.</p>

CC BY-SA 4.0
2022-05-18T15:59:38.187Z
2022-05-18T15:59:38.187Z
Pieter Wuille
<p>During parsing of Bitcoin data from blockchain, I found many transactions which has invalid script (example <code>37b828de0da38f0b3b9ec09f6f8b7883c3202a99a285b0b0087f19f9cbf526d9</code>,<code>f6502e80d8a8dc9e59bb518a62a6443479dd72cd153929272ac21bab26317226</code>)</p>
<p>Is there a way to parse these scripts to pull out the output address? If not, what happened to the BTC send to these invalid script?</p>

CC BY-SA 4.0
2022-05-18T16:09:08.003Z
By the way, where (which block/transaction?) did you find these scripts?
Pieter Wuille
CC BY-SA 4.0
2022-05-19T19:59:47.790Z
Does this answer your question? [Non-standard transaction scripts broadcasting](https://bitcoin.stackexchange.com/questions/81623/non-standard-transaction-scripts-broadcasting)
Glorfindel
<address><script>
Transactions with invalid or non-parseable Script
Ankit
# Transactions with invalid or non-parseable Script

(Asked by: username_0 on 2022-05-13)

During parsing of Bitcoin data from blockchain, I found many transactions which has invalid script (example `37b828de0da38f0b3b9ec09f6f8b7883c3202a99a285b0b0087f19f9cbf526d9`,`f6502e80d8a8dc9e59bb518a62a6443479dd72cd153929272ac21bab26317226`)

Is there a way to parse these scripts to pull out the output address? If not, what happened to the BTC send to these invalid script?

**Tags:** address, script

> **Comments:**
> **username_1**: By the way, where (which block/transaction?) did you find these scripts?  
> **username_2**: Does this answer your question? [Non-standard transaction scripts broadcasting](https://bitcoin.stackexchange.com/questions/81623/non-standard-transaction-scripts-broadcasting)  

---

## 1 answers

### Answer by username_1 on 2022-05-18. Score: 2 | Accepted answer

> During parsing of Bitcoin data from blockchain, I found many transactions which has invalid script (example 37b828de0da38f0b3b9ec09f6f8b7883c3202a99a285b0b0087f19f9cbf526d9,f6502e80d8a8dc9e59bb518a62a6443479dd72cd153929272ac21bab26317226)

> Is there a way to parse these scripts to pull out the output address?

Addresses are human-readable shorthand ways of writing scriptPubKeys that follow a certain template. Not every script has a corresponding address. Only these are defined:

* P2PKH addresses (1...): `OP_DUP OP_HASH160 <keyhash> OP_EQUALVERIFY OP_CHECKSIG`.
* P2SH addresses (3..., defined in BIP13): `OP_HASH160 <scripthash> OP_EQUAL` (defined in BIP16).
* P2WPKH addresses (42-character bc1q..., defined in BIP173): `OP_0 <pubkeyhash>` (defined in BIP141).
* P2WSH addresses (62-character bc1q..., defined in BIP173): `OP_0 <scripthash>` (defined in BIP141).
* P2TR addresses (62-character bc1p..., defined in BIP350): `OP_1 <tweaked key>` (defined in BIP341).
* Future native witness addresses (bc1..., defined in BIP350): `OP_n <program>`.

Any scriptPubKey not matching any of the above templates doesn't have a corresponding script. Unparseable scripts are among those.

> If not, what happened to the BTC send to these invalid script?

Those coins are lost. There is no way to spend them, because the script can't be executed if it can't be parsed, and without it executing successfully it can't be spent.


---

