Questions tagged [opcodes]
52 questions
12
votes
1 answer
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.
Context:
I'd like to use OP_LEFT to implement a…
hrobeers
- 133
- 8
12
votes
3 answers
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 submit a transaction that will fail to verify to…
mulllhausen
- 1,713
- 2
- 14
- 33
11
votes
1 answer
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 July 30th-31st 2010, only the first and last commits…
arubi
- 1,834
- 7
- 21
8
votes
1 answer
What is op_eval?
I have been hearing a lot lately about "OP_EVAL", what is it?
Gavin has mentioned it here: http://sourceforge.net/mailarchive/forum.php?thread_name=201110130938.35014.luke%40dashjr.org&forum_name=bitcoin-development
AFAIK it's what the military…
Alex Waters
- 3,171
- 2
- 24
- 39
8
votes
2 answers
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).
Assuming these are considered for the next soft…
Michael Folkson
- 14,337
- 3
- 11
- 45
7
votes
2 answers
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 be either )
OP_IF
[HASHOP] …
arshbot
- 1,710
- 14
- 35
7
votes
2 answers
Was the addition of OP_NOP codes in Bitcoin 0.3.6 a hard or soft fork?
I'm doing some deeper research into historical consensus changes and it seems like most folks consider the addition of the OP_NOP codes to be a hard fork. Here's the diff for their addition:…
Jameson Lopp
- 161
- 7
6
votes
1 answer
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 the preceding OP_IF or OP_NOTIF or OP_ELSE was not…
orfeas
- 93
- 4
4
votes
2 answers
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 (separate from using data after OP_RETURN).
However in this unlocking script described by bip199, the timeout block and timeout op are before the OP_DROP, meaning they…
arshbot
- 1,710
- 14
- 35
4
votes
1 answer
How does OP_CHECKSIG work
Hi I am learning bitcoin and learning how scripting works and how to use P2PKH. I was wondering how does OP_CHECKSIG work. I want to understand what is the data that the private key signs to create the digital signature itself?
Is there a simple…
Shubham Saxena
- 119
- 8
4
votes
2 answers
Why do invalid signatures in OP_CHECKSIGADD not push to the stack?
I've been working through the static test vectors provided by bitcoin core to implement an interpreter.
Some surprising behavior I found was that in the case of OP_CHECKSIGADD, if an invalid signature is found, the interpreter fails execution rather…
Chris Stewart
- 1,114
- 1
- 9
- 19
4
votes
1 answer
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 can't find any answers online. Are there any good…
David A. Harding
- 11,626
- 2
- 44
- 71
3
votes
0 answers
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?
user2284570
- 286
- 2
- 14
3
votes
2 answers
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 program
Double SHA256 of the serialization of:
1.…
jumper
- 31
- 2
2
votes
1 answer
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 transactions to be relayed/mined:
I'm still unsure if this…
Brqoo
- 372
- 1
- 8