<p><a href="https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki" rel="nofollow noreferrer">BIP-0016</a> stated:</p>
<blockquote>
<p>These new rules should only be applied when validating transactions in blocks with timestamps &gt;= 1333238400 (Apr 1 2012) <a href="https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki" rel="nofollow noreferrer">1</a>.</p>
</blockquote>
<p>The first block enforcing these new rules was block 173805, because it has timestamp 1333240980.</p>
<p>The first P2SH <strong>spend</strong> happened in block 174719 (TXO was created in block 174718), which the other answer correctly states.</p>
<p>I would like to add that there exist some TXOs that match P2SH output bytecode pattern that were created before P2SH had activated.</p>
<p>Before P2SH activation, they could be spent as just hashlock contracts.
After P2SH activation, they could only be spent if the hash preimage also happened to be a redeem script that would pass execution.</p>
<p>The TXO created in block 170052 was actually spent in block 170060 as hashlock, not P2SH, because P2SH rules weren't active at the time.</p>
<p>The other 5 hashlock TXOs were not spent before activation, and so P2SH likely made them forever unspendable, more details here: <a href="https://bitcoin.stackexchange.com/a/115804/137501">https://bitcoin.stackexchange.com/a/115804/137501</a></p>

CC BY-SA 4.0
2024-11-20T10:16:40.167Z
2024-11-20T10:16:40.167Z
bca-0353f40e
<p>I used Blockchair to only <a href="https://blockchair.com/bitcoin/outputs?s=block_id(asc)&amp;q=type(scripthash),time(2012-03-11..),block_id(173805..)#f=transaction_hash,index,value,value_usd,recipient,is_spent,spending_transaction_hash,spending_time,spending_value_usd,cdd,type,block_id,time" rel="nofollow noreferrer">search for transaction outputs of type P2SH</a>, and restricted results to blocks after the activation height of block 173 805. I also checked against any time after March 11th and got the same result.</p>
<p>The first transaction that sent funds to a P2SH output appears to be
<a href="https://blockchair.com/bitcoin/transaction/2597f4819e1902750b9e1fa1515df22bbf14f3a78a2b82aa7d62a8109d83289d" rel="nofollow noreferrer">2597f4819e1902750b9e1fa1515df22bbf14f3a78a2b82aa7d62a8109d83289d</a> in block 174 717 on 2012-04-08 (UTC).</p>
<p>Then, I further restricted the search to only permit <a href="https://blockchair.com/bitcoin/outputs?s=spending_block_id(asc)&amp;q=type(scripthash),time(2012-03-11..),block_id(173805..),is_spent(true),spending_block_id(173805..)#f=transaction_hash,index,value,value_usd,recipient,is_spent,spending_transaction_hash,spending_time,spending_value_usd,cdd,type,block_id,time,spending_block_id" rel="nofollow noreferrer"><em>spent</em> outputs of type P2SH sorted by ascending spending block height after 173 805</a> to find the first P2SH output that was spent in transaction <a href="https://blockchair.com/bitcoin/transaction/e5779b9e78f9650debc2893fd9636d827b26b4ddfa6a8172fe8708c924f5c39d" rel="nofollow noreferrer">e5779b9e78f9650debc2893fd9636d827b26b4ddfa6a8172fe8708c924f5c39d</a> at block height 174 719.</p>

CC BY-SA 4.0
2023-02-22T22:58:14.893Z
Ah I was unaware of the Blockchair tool. Thank you so much!
Tom
CC BY-SA 4.0
2024-06-16T04:49:58.593Z
Interestingly, `37paP4uTjmA4Pi85LG6CF9huift3Dw1kFT` from the first spending tx is an atypical address. It requires no signature, and leaves a non-standard non-empty stack. In theory, those are "free" coins, provided you can get a miner to include the tx
Raghav Sood
CC BY-SA 4.0
2023-02-22T22:53:20.820Z
2023-02-22T22:53:20.820Z
Murch
<p>I'm having a very difficult time finding the first-ever P2SH transaction on the blockchain. I do not have a query tool to answer this question myself, sadly.</p>
<p>All internet searches result in this answer:</p>
<p><a href="https://mempool.space/tx/9c08a4d78931342b37fd5f72900fb9983087e6f46c4a097d8a1f52c74e28eaf6" rel="nofollow noreferrer">9c08a4d78931342b37fd5f72900fb9983087e6f46c4a097d8a1f52c74e28eaf6</a></p>
<p>(Block 170,052 | March 3, 2012)</p>
<p>But as <a href="https://en.bitcoin.it/wiki/Pay_to_script_hash#:%7E:text=342ftSRCvFHfCeFFBuz4xwbeqnDw6BGUey%20is%20a%20Bitcoin%20address,good%20example%20to%20understand%20P2SH." rel="nofollow noreferrer">bitcoin wiki points out</a>, this is the first BIP 13 transaction (first address beginning with a &quot;3&quot;) and the P2SH soft-fork was not yet active, since it occurred on April 1st 2012.</p>
<p>I think this means the first legitimate P2SH transaction would be the first &quot;3&quot; address occurring on or after April 1st, 2012. Using vague tools I am under the impression that such a transaction occurred around April 7 or 8, 2012. However I am unable to dig deeper without manually searching every block on those dates.</p>
<p>I'm surprised this information is so hard to find since it seems like such an important moment in bitcoin's history. Maybe I'm misunderstanding something. Help greatly appreciated!!!</p>

<p2sh><blockchain-explorer>
What was the first ever BIP 16 transaction? (Read: Not BIP 13)
Tom
# What was the first ever BIP 16 transaction? (Read: Not BIP 13)

(Asked by: username_0 on 2023-02-22)

I'm having a very difficult time finding the first-ever P2SH transaction on the blockchain. I do not have a query tool to answer this question myself, sadly.

All internet searches result in this answer:

[9c08a4d78931342b37fd5f72900fb9983087e6f46c4a097d8a1f52c74e28eaf6](https://mempool.space/tx/9c08a4d78931342b37fd5f72900fb9983087e6f46c4a097d8a1f52c74e28eaf6)

(Block 170,052 | March 3, 2012)

But as [bitcoin wiki points out](https://en.bitcoin.it/wiki/Pay_to_script_hash#:%7E:text=342ftSRCvFHfCeFFBuz4xwbeqnDw6BGUey%20is%20a%20Bitcoin%20address,good%20example%20to%20understand%20P2SH.), this is the first BIP 13 transaction (first address beginning with a "3") and the P2SH soft-fork was not yet active, since it occurred on April 1st 2012.

I think this means the first legitimate P2SH transaction would be the first "3" address occurring on or after April 1st, 2012. Using vague tools I am under the impression that such a transaction occurred around April 7 or 8, 2012. However I am unable to dig deeper without manually searching every block on those dates.

I'm surprised this information is so hard to find since it seems like such an important moment in bitcoin's history. Maybe I'm misunderstanding something. Help greatly appreciated!!!

**Tags:** p2sh, blockchain-explorer


---

## 2 answers

### Answer by username_2 on 2023-02-22. Score: 4 | Accepted answer

I used Blockchair to only [search for transaction outputs of type P2SH](https://blockchair.com/bitcoin/outputs?s=block_id(asc)&q=type(scripthash),time(2012-03-11..),block_id(173805..)#f=transaction_hash,index,value,value_usd,recipient,is_spent,spending_transaction_hash,spending_time,spending_value_usd,cdd,type,block_id,time), and restricted results to blocks after the activation height of block 173 805. I also checked against any time after March 11th and got the same result.

The first transaction that sent funds to a P2SH output appears to be
[2597f4819e1902750b9e1fa1515df22bbf14f3a78a2b82aa7d62a8109d83289d](https://blockchair.com/bitcoin/transaction/2597f4819e1902750b9e1fa1515df22bbf14f3a78a2b82aa7d62a8109d83289d) in block 174 717 on 2012-04-08 (UTC).

Then, I further restricted the search to only permit [*spent* outputs of type P2SH sorted by ascending spending block height after 173 805](https://blockchair.com/bitcoin/outputs?s=spending_block_id(asc)&q=type(scripthash),time(2012-03-11..),block_id(173805..),is_spent(true),spending_block_id(173805..)#f=transaction_hash,index,value,value_usd,recipient,is_spent,spending_transaction_hash,spending_time,spending_value_usd,cdd,type,block_id,time,spending_block_id) to find the first P2SH output that was spent in transaction [e5779b9e78f9650debc2893fd9636d827b26b4ddfa6a8172fe8708c924f5c39d](https://blockchair.com/bitcoin/transaction/e5779b9e78f9650debc2893fd9636d827b26b4ddfa6a8172fe8708c924f5c39d) at block height 174 719.

> **Comments:**
> **username_0**: Ah I was unaware of the Blockchair tool. Thank you so much!  
> **username_3**: Interestingly, `37paP4uTjmA4Pi85LG6CF9huift3Dw1kFT` from the first spending tx is an atypical address. It requires no signature, and leaves a non-standard non-empty stack. In theory, those are "free" coins, provided you can get a miner to include the tx  

---

### Answer by username_1 on 2024-11-20. Score: 0

[BIP-0016](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki) stated:

> These new rules should only be applied when validating transactions in blocks with timestamps >= 1333238400 (Apr 1 2012) [1](https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki).

The first block enforcing these new rules was block 173805, because it has timestamp 1333240980.

The first P2SH **spend** happened in block 174719 (TXO was created in block 174718), which the other answer correctly states.

I would like to add that there exist some TXOs that match P2SH output bytecode pattern that were created before P2SH had activated.

Before P2SH activation, they could be spent as just hashlock contracts.
After P2SH activation, they could only be spent if the hash preimage also happened to be a redeem script that would pass execution.

The TXO created in block 170052 was actually spent in block 170060 as hashlock, not P2SH, because P2SH rules weren't active at the time.

The other 5 hashlock TXOs were not spent before activation, and so P2SH likely made them forever unspendable, more details here: <https://bitcoin.stackexchange.com/a/115804/137501>


---

