MultiversX Tracker is Live!

What are the standard formats of transaction outputs?

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 147 Views

AFAIK there are 5 different standard non-SegWit transaction types, and 4 SegWit ones.

Non-SegWit:

Pay to public key (P2PK)

PUSH (1 byte) + <compressed/uncompressed_pk> (33/65 bytes) + OP_CHECKSIG (1 byte)

Pay to public key hash (P2PKH)

OP_DUP (1 byte) + OP_HASH160 (1 byte) + PUSH (1 byte) + <hash_160(PK)> (20 bytes) + OP_EQUALVERIFY (1 byte) + OP_CHECKSIG (1 byte)

Multisig (P2MS)

<number_of_PKs> (1 byte) PUSH (1 byte) <PK_0> (33/65 bytes) PUSH (1 byte) <PK_1> (33/65 bytes) ... PUSH (1 byte) <PK_n-1> (33/65 bytes) OP_CHECKMULTISIG (1 byte)

P2MS allow up to 15-15 scripts, however only up to 3-3 are standard.

Pay to script hash (P2SH)

OP_HASH160 (1 byte) + PUSH (1 byte) + <hash160(redeem_script)> (20 bytes) + OP_EQUAL (1 byte)

OP_Return

OP_RETURN (1 byte) PUSH (1 byte) <0 to 83 bytes of data>

SegWit:

Regarding segwit types, there are two non-native and two native ones.

Native Pay to witness public key hash (P2WPKH)

OP_0 (1 byte) PUSH (1 byte) <hash 160(PK*)> (20 bytes)

Native Pay to witness script hash (P2WSH)

OP_0 (1 byte) PUSH (1 byte) <script_hash> (32 bytes)

Pay to witness public key hash encapsulated in a pay to script hash (P2SH-P2WPKH)

The redeem script follows the same structure than native P2WPKH:

redeem_script = OP_0 (1 byte) PUSH (1 byte) <hash_160(PK*)> (20 bytes)

While the external structure of the script (scriptPubKey) is as any other P2SH:

OP_HASH160 (1 byte) + PUSH (1 byte) + <hash_160(redeeem_script)> (20 bytes) + OP_EQUAL (1 byte)

Pay to witness script hash encapsulated in a pay to script hash (P2SH-P2WSH)

The redeem script follows the same structure than native P2WSH:

redeem_script = OP_0 (1 byte) PUSH (1 byte) <script_hash> (32 bytes)

While the external structure of the script (scriptPubKey) is as any other P2SH:

OP_HASH160 (1 byte) + PUSH (1 byte) + <hash_160(redeeem_script)> (20 bytes) + OP_EQUAL (1 byte)

*In P2WPKH scripts the hash 160 should correspond to a compressed public key, otherwise the funds will be lost.


Get BONUS $200 for FREE!

You can get bonuses upto $100 FREE BONUS when you:
πŸ’° Install these recommended apps:
πŸ’² SocialGood - 100% Crypto Back on Everyday Shopping
πŸ’² xPortal - The DeFi For The Next Billion
πŸ’² CryptoTab Browser - Lightweight, fast, and ready to mine!
πŸ’° Register on these recommended exchanges:
🟑 Binance🟑 Bitfinex🟑 Bitmart🟑 Bittrex🟑 Bitget
🟑 CoinEx🟑 Crypto.com🟑 Gate.io🟑 Huobi🟑 Kucoin.



Comments