Questions tagged [opcodes]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
12
votes
3answers
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 ...
11
votes
1answer
440 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 ...
9
votes
1answer
495 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. ...
7
votes
2answers
459 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 ...
5
votes
2answers
168 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). ...
3
votes
1answer
74 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 ...
2
votes
2answers
103 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 ...
2
votes
2answers
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-...
2
votes
1answer
46 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 ...
2
votes
1answer
71 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 ...
2
votes
2answers
274 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 ...
2
votes
1answer
744 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 ...
2
votes
1answer
52 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 ...
2
votes
0answers
51 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?
1
vote
1answer
86 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 ...
1
vote
1answer
27 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
1
vote
0answers
27 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 ...
0
votes
1answer
49 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 ...
0
votes
2answers
191 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 ...
0
votes
1answer
58 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 ...