1

I'm going to use ordinals as an example because they illustrate my question the most effectively. My understanding is that ordinals are created by writing opcodes into the transaction just like you would with a non-taproot transaction. If I did a typical P2PKH transaction I would put

"scriptPubKey": "OP_DUP OP_HASH160 HASH_OF_PUBKEY_IN_HEX OP_EQUALVERIFY OP_CHECKSIG"

as my locking script, but If I wanted to do an ordinal I believe I would just make my locking script

"scriptPubKey": "OP_DUP OP_HASH160 HASH_OF_PUBKEY_IN_HEX OP_EQUALVERIFY OP_CHECKSIG OP_FALSE OP_IF OP_PUSH "ord" OP_PUSH 1 OP_PUSH "text/plain;charset=utf-8" OP_PUSH 0 OP_PUSH "Hello, world!" OP_ENDIF"

It sounds like this means that I could do an ordinal in a non-taproot address bitcoin transaction. So I could mint an ordinal with a P2PKH address.

So what does tapscript actually do that P2PKH doesn't?

0

1 Answer 1

4

It sounds like this means that I could do an ordinal in a non-taproot address bitcoin transaction. So I could mint an ordinal with a P2PKH address.

Historically output types with address standards came in two flavors: pubkeyhash-based (P2PKH, P2SH-P2WPKH, P2WPKH) and scripthash-based (P2SH, P2SH-P2WSH, P2WSH). P2TR outputs combine both these flavors by providing both a keypath and a scriptpath spending option. While it seems to me that a modification of the P2PKH output script to incorporate an envelope should be consensus valid, there are two things to note here:

  1. P2PKH addresses pertain exactly to the output script¹ template OP_DUP OP_HASH160 <pubkeyhash> OP_EQUALVERIFY OP_CHECKSIG. Modifying the P2PKH output script in the proposed manner results in a bare script output, because it no longer matches the P2PKH template.
  2. The only bare scripts permitted in standard transactions are Pay to Pubkey (P2PK), Pay to Pubkey Hash (P2PKH), and bare multisig with up to three pubkeys.

So at first glance, I would expect your experiment to result in a consensus-valid non-standard transaction. It would also be more expensive than using the P2TR-based envelope.


¹ in Bitcoin Core’s codebase an output script is also knows as scriptPubKey

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.