MultiversX Tracker is Live!

Is there a difference between OP_PUSHBYTES and OP_PUSHDATA

Bitcoin Stack Exchange

Bitcoin News / Bitcoin Stack Exchange 155 Views

In what documentation? I believe you are talking about how rust-bitcoin refers to the OPs > OP_FALSE and < OP_PUSHDATA1 and will answer as such.

There are multiple OP codes pushing bytes to the stack, defined as integers.

Special case: pushing small integers

There are dedicating OP codes for pushing integers from -1 to 16 (named OP_1NEGATE, OP_0 and OP_1Β to OP_16 and valued 0x4f, Ox00 and 0x51 to 0x60).

They are used for instance for (smallish) multisigs as it saves you 1 byte per number pushed compared to using a "real" push opcode.

"PUSHBYTES": pushing small byte arrays

The (not named in the reference implementation) OP codes valued from 0x01 to 0x4b allow to push from 1 (0x01) to 75 (0x4b) bytes to the stack.

They are commonly used to push pubkeys and signatures.

PUSHDATA: pushing byte arrays

The PUSHDATA1, PUSHDATA2 andΒ PUSHDATA4 (0x4c, 0x4d and 0x4e) operands are used to push a byte array to the stack which size is defined as a variable-length integer .

Further: too many encodings!

This flexibility of encoding introduced malleability in the scriptSig, which was not protected by the signature (which it carries).
BIP62 proposed to restrict this encoding to avoid possible malleation.


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