Questions tagged [script]
A simple, stack-based, Forth-like programming language using "opcodes" to express spending conditions.
619
questions
1
vote
1
answer
31
views
Is it possible to use Bitcoin Script to implement a quantum-resistant locking script that would be safe to spend from?
Stewart, I., et. al. (2018). "Committing to quantum resistance: A slow defence for Bitcoin against a fast quantum computing attack" described a method by which funds could be safely moved ...
0
votes
1
answer
84
views
What is an "empty vector" in Bitcoin?
EDIT: Pieter Wuille gave an answer (look at the comments) to the last situation (with OP_CHECKSIG). OP_CHECKSIG is pushing 0x00.
E.g. OP_0 pushes the empty vector, which represents the number 0 (to
...
1
vote
1
answer
89
views
Is the signature check performed when the signature is the empty vector?
In this answer Vojtěch Strnad wrote the following:
OP_CHECKSIGADD always performs one check per signature, since unused
public keys are required to be paired with an empty witness item and
are ...
1
vote
1
answer
57
views
What are the all benefits/advantages of OP_CHECKSIGADD over OP_CHECKMULTISIG?
What are all the benefits of introducing OP_CHECKSIGADD in Taproot instead of OP_CHECKMULTISIG?
I assume the first benefit is the following.
For example, in pre-taproot approach, if we have 3-of-10 ...
2
votes
1
answer
102
views
What would happen if we provide to OP_CHECKMULTISIG more than threshold number (m) of signatures?
Asked here but still no answer.
What would happen if we provide to OP_CHECKMULTISIG opcode more than threshold number (m) of signatures?
For example, if the m = 3 and n = 6 and the output script is:
3 ...
2
votes
1
answer
45
views
non-mandatory-script-verify-flag (Invalid Schnorr signature) when trying to reveal a TR output
I'm building a Bitcoin wallet, and I'm trying to spend a Taproot output via a script spend path, but I keep running into this "Invalid Schnorr signature" error from my RPC node:
{
"...
-2
votes
1
answer
48
views
Question on the integer size [closed]
Is there any kind of boolean division with bitcoin? There has to be something before the decimal number. Kind of say it seems like end to end and it always should be the number that is largest.
4
votes
1
answer
225
views
How is this transaction valid?
Transaction in question: 16ac7736552c5791cff5643e6104c76c24018236b2193e014b308efea4f32f81
The P2SH input has a strange redeem script:
OP_DUP
OP_HASH160
OP_PUSHBYTES_20 ...
1
vote
1
answer
83
views
Verifying a zkSNARK on Bitcoin/Hope for a future with OP_MUL
I am trying to write a script that can verify a SNARK, but from what I understand OP_MUL is still disabled in TapScript.
Is anyone working on a BIP to provide OP_MUL or OP_MUL64?
It seems ...
0
votes
1
answer
124
views
processing input tx in bitcoin's block response and obtain transaction value of each input
so i was parsing the block #496 of bitcoin which contains two transactions, first tx in the list is the reward tx and the second tx contains three inputs and one output. i tried to parse each ...
5
votes
1
answer
209
views
Why does Miniscript add an extra size check for hash preimage comparisons?
When I input the following miniscript into https://bitcoin.sipa.be/miniscript/:
and(pk(claimant_pk),sha256(H))
I get the following Script:
<claimant_pk> OP_CHECKSIGVERIFY OP_SIZE <20> ...
3
votes
2
answers
565
views
Undefined opcodes in bitcoin core defined as "Synonyms for OP_RETURN" in rust-bitcoin
In rust-bitcoin, opcodes past the 0xba opcode are named as such: OP_RETURN_187, OP_RETURN_188, ..., OP_RETURN_254. Their description is all the same: Synonym for OP_RETURN. The definition for ...
2
votes
1
answer
138
views
Is OP_CODESEPARATOR disabled in Bitcoin and if so why?
OP_CODESEPARATOR is used in the Bitcoin script language to mark the beginning of signature-checked data. However, the given operator never found its real practical use case. So, is the given operator ...
8
votes
1
answer
224
views
Why are OP_MUL and OP_DIV disabled in Bitcoin?
What is the reason why OP_MUL and OP_DIV operators were removed from Bitcoin? Is this because someone could maliciously create a script that multiplies large numbers and thus blows the stack, or is ...
0
votes
1
answer
37
views
P2SH-P2WSH-P2PKH and P2SH-P2WPKH
What are the advantages and disadvantages of using P2WSH-wrapped P2PKH instead of P2WPKH?
What are the advantages and disadvantages of using P2SH-wrapped P2WSH-wrapped P2PKH instead of P2SH-wrapped ...
0
votes
0
answers
46
views
conditional spending from P2WSH address
What im doing wrong?
Sinse I found out that Bitcoin is programmable money Im trying to use it potential.
Using this site https://improvein.github.io/bitcoin-forge/?#/script/create I’ve created a ...
1
vote
0
answers
24
views
Scripting an escrow transaction where the arbitrator ALWAYS gets paid
I am trying to make an Escrow and Arbitration where the arbitrator always gets paid say 5% of the transaction.
As in the famous escrow example here:
Charlie-the-customer wants to buy a product from ...
2
votes
1
answer
64
views
Is it possible to create an output locked to a specific mining difficulty target?
When the network sees a block appear with enough difficulty nodes can detect this as potentially the longest valid chain allowing the blocks miner to officially claim the block reward via coinbase ...
4
votes
1
answer
150
views
Why is concatenating scriptPubKeys and scriptSigs unsafe?
Around the 5:00 timestamp in this talk, John Newbery states that running the concatenation of scriptPubKey and scriptSig is unsafe, since it can result in someone using a carefully crafted scriptSig ...
1
vote
1
answer
84
views
Bitcoin Script Puzzle
I found this script puzzle post by ValentinoZ:
https://twitter.com/vazertuche/status/1691814230129848473
I've tried solving it and can't seem to get it. I get stuck at the op_equalverify for the hash ...
1
vote
2
answers
36
views
Why is this P2WSH spend triggering a verification failure when broadcasting?
I'm experiment with building SegWit transactions manually, and I've written a non-standard simple script just for testing. No signing or anything, just your usual "add two numbers, check equality&...
2
votes
2
answers
175
views
Can the same set of private keys be used multiple times in a multisig wallet?
Is there any limitation to how many times the same set of private keys can exist within a multisig wallet? For example, could a 3 of 4 multisig wallet be created with two of the four keys being ...
0
votes
2
answers
88
views
When the validity of scriptPubKey is checked?
I have a couple of questions related to validation of script in transaction output (scriptPubKey).
I apologize for a little more text, but I tried to explain in detail what I don't understand.
Since ...
0
votes
1
answer
43
views
Is there any workaround exist to restrict spending output address from Bitcoin Script?
Hey folks,
I know this question is pretty much similar to the one, that was asked 5 years ago. I'd like to share my research and ask, if there are any movements in this fields since then? Or maybe ...
0
votes
2
answers
52
views
How can one make a transaction that any address can claim it just by solving the scriptPubKey?
I just learned that Mike Hearn created a Bitcoin Puzzle transaction where the first person to solve its scriptPubKey, could claim that transaction's amount as a reward.
The thing is... Aren't all the ...
0
votes
1
answer
60
views
How to get the hex for a tx input (for btcdeb tool)
I am trying to understand how btcdeb (Bitcoin script debugger from Bitcoin core) works.
In the usecase of btcdeb --tx=<tx hex> --txin=<txin hex>, how does one obtain the hex of the input ...
1
vote
1
answer
133
views
Is the Taproot upgrade really essential for BRC-20 tokens on Bitcoin?
BRC-20 currently relies on the Taproot upgrade. I'm wondering how blockchains such as Dogecoin, which have Bitcoin as their predecessor and did not upgrade to Taproot, manage to support BRC-20. More ...
2
votes
1
answer
102
views
What cryptographic guarantees apply to non-disjoint paths in basic MPP?
Imagine the following graph in the Lightning Network:
B D
/ \ / \
A C E
\ / \ /
F G
and node A wants to pay node E.
A chooses to pay with multi-path-payment composed of the routes: A-&...
4
votes
2
answers
194
views
Conditional MULTISIG transaction
I need a bitcoin lock script that will require my key and 1 of 4 other people.
For example, If my key is present and one of the 4 other keys are also present, transaction can be claimed. If my key is ...
2
votes
2
answers
323
views
bitcoin lock script simple math
I want to create a bitcoin locking script that takes 3 numbers, each of them are less than 8 and if sum of 3 numbers are 15 then script will return true. How can i do that?
The one who will redeem the ...
0
votes
0
answers
117
views
Interpreting descriptors from bitcoinrpc for python
I've been running through the Bitcoin blockchain like this and comparing the descriptors to https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md...
rpc_connection = AuthServiceProxy("...
2
votes
1
answer
446
views
What are Bitcoin's transaction and script limits?
What are the limits of different transactions and scripts (by consensus and standardness)?
Some stack exchange questions discuss some of them (but not all) and all these are scattered around.
What is ...
1
vote
1
answer
217
views
What is coinbase script (arbitrary data)?
According to this site, in the coinbase input part, What is the coinbase script and where did it come from?
It is said that this is a arbitrary data, but I don't know how this string is generated?
...
1
vote
1
answer
96
views
Is there a way to handle scalar multiplication with the Secp256k1 generator to finalize a Bitcoin script in an atomic swap?
I know that Bitcoin can do Schnorr which allows for one way to finalize an atomic swap but on the other side of the current swap implementation( that I am working with), the script needs to multiply a ...
2
votes
1
answer
232
views
Calculating addresses from Bitcoin transaction data
What would be the easiest way to retrieve addresses that are used in specific transaction? For instance, if you look at following transaction which is retrieved by getblock of JSON RPC with argument ...
2
votes
1
answer
85
views
Script for Success of HTLC in the Lightning Network
BOLT #3 specifies that an HTLC success transaction (the second-stage transaction that spends an HTLC by providing the preimage) has the witness script 0 <remotehtlcsig> <localhtlcsig> <...
2
votes
2
answers
136
views
What Policy does the Liana wallet use? Why would I use this Policy?
I was looking at Wizardsardine's Liana wallet repo (beta software).
What is the Policy and associated Miniscript that is used by this wallet?
Why would I use this Policy? What is fixed and what is ...
1
vote
1
answer
106
views
Why is it a bug that a Taproot tree allows a Tapleaf to be repeated on multiple levels of the tree?
On the bitcoin-dev mailing list Russell O'Connor stated:
There is a bug in Taproot that allows the same Tapleaf to be repeated
multiple times in the same Taproot, potentially at different Taplevels
...
2
votes
1
answer
113
views
How come an `OP_3` P2SH redeem script is spendable?
I completed a round trip transaction with the redeem script hash: 31vFvEkyAb2iusbPip36H9rVt6pxExuaVR, whose redeem script is OP_3 (0x53) (yes I know not secure).
I can understand OP_1 redeem script ...
4
votes
2
answers
844
views
Why CHECKMULTISIG bug can't be solved?
I was reading Mastering Bitcoin and I read about a bug in CHECKMULTISIG. If the starting ideas of this command should work like this
<Signature B><Signature C> M <Public key A><...
4
votes
1
answer
202
views
What is the asm section of scriptSig
I am trying to understand the output from bitcoin-cli. The sample transaction's txid is 061959f1a3360d3781a870b2d43f73f7105b194b22f3765fcb9b8f545f9c8317, from block 222,222.
The asm section of ...
0
votes
1
answer
139
views
What's the difference between decoderawtransaction and decodescript?
I'm looking for an explanation on the difference between the bitcoin CLI for decoderawtransaction and decodescript please.
From what I know, decodetransaction will undo the hash and ECDSA elliptic ...
2
votes
1
answer
85
views
Is it correct to use OP_PUSHDATA1 to encode data less than 76 bytes?
According to https://en.bitcoin.it/wiki/Script#Constants, for data between 1-75 bytes, the length byte is directly appended to the data, without any OP_PUSHDATA op-codes.
However, I noticed that in ...
2
votes
2
answers
71
views
Precedence of competing multisig spends
Imagine I want to create a multisig threshold (k-of-n) scheme where a spending transaction with more signatures takes precedence over other spending transactions with less signatures (but in both ...
1
vote
1
answer
68
views
Is there a particular order in which transaction inputs are checked for script validity?
When a transaction is being checked for validity, is there a particular order that the inputs are evaluated for script correctness?
This might be relevant when determining what consensus changes might ...
2
votes
1
answer
163
views
Error validating transaction: unexpected witness payload for non-witness script in a P2TR using script path
I am trying to create a raw transaction P2TR, spending a Taproot UTXO using the script path.
I did the following:
Create a random private key d and corresponding pubkey P (the internal pubkey)
...
2
votes
2
answers
190
views
What are the risks of OP_VAULT?
In the past it has been argued that some covenant schemes could be risky. However AFAIK OP_VAULT is a very specific and limited construction.
What are the risks associated with it, if any?
1
vote
1
answer
133
views
How to choose a nothing-up-my-sleeve (NUMS) point on secp256k1 for use in Taproot?
Per BIP-341, if you want to create a Taproot output that is only spendable via the script-path spend (and not a key-path spend), you must "pick as internal key a point with unknown discrete ...
2
votes
1
answer
110
views
What is OP_RETURN_252?
The first scriptsig opcode in this coinbase transaction is OP_RETURN_252, followed a bit later by a OP_RETURN_188.
These don't show in this list of opcodes.
Digging the internet, I found this rust lib ...
5
votes
1
answer
184
views
How do I set up a time-decay multisig?
I want to set up a multisig that requires fewer signatures as time goes by.
Let T be some time in the future (e.g. a year from now).
Before T, 2/3 signatures are required to unlock the UTXO (send ...