Questions tagged [opcodes]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
123 views

Why isn't `OP_CHECKMULTISIG` compatible with batch verification of schnorr signatures?

BIP342 defines OP_CHECKSIGADD as a replacement for OP_CHECKMULTISIG. In the footnote it's mentioned that OP_CHECKMULTISIG is not compatible with batch verification, but I can't understand why and I ...
user avatar
1 vote
2 answers
78 views

Why does this not return TRUE?

scriptSig: <pubKey> scriptPubKey: <pubKey> OP_EQUALVERIFY The stack has <pubKey>, <pubKey> and then OP_EQUALVERIFY. So why, does it not return TRUE, even when the recent two ...
user avatar
0 votes
1 answer
58 views

Is it possible to design a recursive covenant opcode that results in a full node stuck in an infinite verification loop?

Is it possible to design a new opcode enabling recursive covenants that could result in a full node stuck in an infinite loop of verifying transactions? (Obviously this would never be considered for a ...
user avatar
0 votes
1 answer
81 views

Why is OP_XOR disabled? Are there any forks on which it has been enabled? [duplicate]

Why is OP_XOR disabled? Are there any forks on which it has been enabled? Are there any plans to enable it? Perhaps this is the answer, still perhaps there is another reason for the bitwise logic ...
user avatar
  • 139
2 votes
1 answer
139 views

How to check OP_CHECKLOCKTIMEVERIFY?

I try to simply get into the OP_CHECKLOCKTIMEVERIFY opcode and test it. However I get the error error: Locktime requirement not satisfied no matter what unix- or blocktime I enter in my btcdeb. I ...
user avatar
  • 191
2 votes
1 answer
103 views

Meaning of "Drop the signature" comments in OP_CHECKSIG code (Bitcoin v0.1.0)

I'm doing my homework by reading the C++ code of the 0.1.0 release of Bitcoin available here. I'm interested in better understanding how to validate transaction 1 of block 170. This transaction has ...
user avatar
1 vote
1 answer
97 views

Liquid tapscript opcodes

Related question: What opcodes are supported on Liquid but not yet on Bitcoin? I had seen few opcodes in the slides shared by notgrubles on Twitter Opcodes: OP_INSPECTCURRENTINPUT OP_INSPECTINPUT ...
user avatar
1 vote
1 answer
82 views

What opcodes are supported on Liquid but not yet on Bitcoin?

What opcodes are supported in Liquid as of today (September 2021) but not (yet) on Bitcoin? What is the rationale for including these particular opcodes but not others?
user avatar
1 vote
1 answer
266 views

What prevents OP_SUCCESS from being used nefariously?

If a script is automatically valid when an OP_SUCCESS opcode is called, what mechanism prevents a malicious actor from taking a random UTXO and creating a fake scriptsig with an OP_SUCCESS included?
user avatar
8 votes
2 answers
1k views

What are the downsides to enabling potentially suboptimal or unused opcodes in a future soft fork?

It appears to me that there are various ways to build covenants and vaults with opcodes and sighash flags that are not yet enabled in Bitcoin (e.g. OP_CHECKTEMPLATEVERIFY, SIGHASH_ANYPREVOUT, OP_CAT). ...
user avatar
3 votes
1 answer
222 views

Inner working of OP_IF and OP_ELSE

How does OP_ELSE work exactly? Is there an else if in Script? According to https://en.bitcoin.it/wiki/Script#Flow_control, the statements after an OP_ELSE are executed in three cases. It says: If ...
user avatar
  • 63
1 vote
1 answer
36 views

Script: How to check if the top item on the main stack is numeric or not?

I'm looking for the clearest way to check whether the top element of the stack is numeric or not. Thank you in advance
user avatar
  • 41
1 vote
1 answer
164 views

Is there a difference between OP_PUSHBYTES and OP_PUSHDATA

In some documentation about Script we sometimes have to use OP_PUSHBYTESx or OP_PUSHDATAx to indicate that some number of bytes will be an element to read. They seem to do the same thing so is there a ...
user avatar
  • 2,361
2 votes
1 answer
76 views

In what year and in which Bitcoin improvement proposal Opcodes such as OP_MODE have been disabled?

On Bitcoin wiki several opcodes are listed as "disabled". My question is simple: which Bitcoin improvement proposal proposed to disable them, and when they have effectively been disabled in ...
user avatar
  • 41
0 votes
1 answer
58 views

The bitcoin opcode seems to have a flat rate

The bitcoin opcode seems to have a flat rate, is that correct? Or, if bitcoin has a price per opcode, please give me the link. If it is a flat rate, please tell me why bitcoin does not have a ...
user avatar
2 votes
1 answer
91 views

Are P2SH transactions with disabled opcodes relayed/mined?

Many OPCODES like OP_AND, OP_CAT, OP_SUBSTR are disabled as described in https://en.bitcoin.it/wiki/Script. Although, with Bitcoin Core 0.10.0 Gavin Andresen proposed "any Script" in P2SH ...
user avatar
  • 362
2 votes
1 answer
61 views

How is a locking script reliably detected as a P2PKH script?

I've taken this example from a p2pkh guide: 1976a9145fb0e9755a3424efd2ba0587d20b1e98ee29814a88ac This is broken down into: 19 - byte length of the following unlocking script 76 - OP_DUP: Duplicates ...
user avatar
1 vote
0 answers
36 views

Why does printing a scriptPubKey have an extra OP_PUSHBYTES_20? [duplicate]

I am building a P2PKH script pubkey in code, and the standard format is: OP_DUP OP_HASH160 <PUBKEYHASH> OP_EQUALVERIFY OP_CHECKSIG However, when I print it (I'm using the bitcoin Rust crate) it ...
user avatar
  • 167
2 votes
0 answers
86 views

Which opcodes where disabled by Satoshi Nakamoto for cve 2010 5137

Lot of opcodes where disabled over the years. But which opcodes where disabled Satoshi himself and specifically for the any one can spend any coin bug?
user avatar
2 votes
2 answers
179 views

Given OP_VER was never used, is disabled and not considered useful can its meaning be stripped and it be made OP_SUCCESS?

Given OP_VER (0x62) was never used onchain, is disabled and is not considered useful can its meaning be stripped and it be made OP_SUCCESS for the purposes of introducing a new different opcode in ...
user avatar
1 vote
1 answer
114 views

Bitcoin script verification fails after certain time period

So I want to write a bitcoin script so that after a certain time period (say for example after 30 mins), the verification fails and transaction is marked invalid even if it gets broadcasted. Time ...
user avatar
0 votes
2 answers
254 views

Creating a custom transactions

I am currently learning how to create raw transactions. I can already create standard using bitcoin core (0.19.1), but when I wanted to create with custom opcode like this: asm: OP_HASH160 ...
user avatar
  • 69
3 votes
2 answers
572 views

What is the purpose of OP_DROP

From what I can tell OP_DROP is a method of storing non validation data in a tx ( seperate from using data after OP_RETURN ). However in this unlocking script described by bip199, the timeout block ...
user avatar
  • 1,359
7 votes
2 answers
690 views

OP_HASH160 vs OP_SHA256

Why would I use OP_HASH160 over OP_SHA256 and vice versa? Why are there two options? In what situations should I use one over the other? Example unlocking scripts: From BIP199: ( where HASHOP could ...
user avatar
  • 1,359
3 votes
2 answers
427 views

How to calculate P2WSH signatures with OP_CODESEPARATOR?

I read the bip143, but didn't understand how to calculate the scriptCode of p2wsh. bip143 told us: A new transaction digest algorithm is defined, but only applicable to sigops in version 0 witness ...
user avatar
  • 31
11 votes
1 answer
493 views

Did the introduction of VerifyScript cause a backwards incompatible change to consensus?

My question is about the changes to bitcoin done by commit range [a75560d8, 6ff5f718], and their effect on consensus. Out of this range of four commits (all attributed to satoshi) during the dates ...
user avatar
  • 1,794
2 votes
1 answer
851 views

How to create a p2sh transaction with a scriptsig of OP_true?

How can I create a p2sh transaction with a scriptsig containing OP_TRUE only, removing the need for a digital signature, which will be broadcasted and mined? Also could some one provide an example of ...
user avatar
  • 117
2 votes
2 answers
3k views

List of current opcodes?

Anyone know how / where to run enum optypecode (or some other method) to get a list of current opcodes? Like this result... https://www.slideshare.net/gvrooyen/20140220-bitcoin/34-...
user avatar
12 votes
1 answer
639 views

Why is OP_SUBSTR disabled? (and OP_LEFT, OP_RIGHT)

Why are the substring opcodes disabled? I understand that OP_CAT is disabled because it can blow up the stack easily (in combination with OP_DUP). But the substring opcodes reduce the stack size. ...
user avatar
  • 133
12 votes
3 answers
3k views

Why is OP_CHECKLOCKTIMEVERIFY disabled by maximum sequence number?

In the code for OP_CHECKLOCKTIMEVERIFY i noticed that if the txin sequence number is maxxed out then the script will fail to validate. I'm wondering what the point of this is? Why would anybody ever ...
user avatar
  • 1,693