Bitcoin

script – How to identify P2TR output type?

You can use only the scriptpubkey to identify the address type. However, I am debugging a library that is having difficulty distinguishing the next transaction/scriptpubkey from the p2tr transaction/scriptpubkey.

Incorrectly displayed p2tr:

Txid: 2b3733a39b87cef1f7c2ca8988583ec0c1a886651b040e3dbaf4c26be81d0f75:195

Scriptpubkey: 245a227ef640f3b1dc1815e6e39b482677f0f57b69de7775faec778c0950a8851805000000

p2tr displays correctly:

Txid: 83c8e0289fecf93b5a284705396f5a652d9886cbd26236b0d647655ad8a37d82:0

Scriptpubkey: 5120a457d0c0399b499ed2df571d612ba549ae7f199387edceac175999210f6aa39d

And honestly… I understand why libraries are a problem. The problematic scriptpubkey looks like p2tr(1, data). But one thing I noticed is that there is no witness on the tx with the problem (before segwit). Is this the only solution to check the watch stack for the correct pattern?

Related Articles

Back to top button