Questions tagged [script]

A simple, stack-based, Forth-like programming language using "opcodes" to express spending conditions.

Filter by
Sorted by
Tagged with
1
vote
1answer
18 views

What are the scriptPubKey, scriptSig, redeem script and witness for the various output types?

scriptPubKey, redeem script, witness script, witness program are defined in this StackExchange post. What are the scriptPubKey, scriptSig, redeem script and witness for the various output types (P2PKH,...
0
votes
1answer
84 views

Why OP_DUP instead of providing the PubKey twice in P2PKH?

We know that a P2PKH script looks as follows: scriptPubKey: OP_DUP OP_HASH160 <PubKeyHash> OP_EQUALVERIFY OP_CHECKSIG scriptSig: <Signature> <PubKey> Since full nodes are maintaing ...
5
votes
1answer
66 views

What is SIGHASH_ANYPREVOUTANYSCRIPT?

BIP 118 describes SIGHASH_ANYPREVOUT, but also mentions SIGHASH_ANYPREVOUTANYSCRIPT. What is the difference, and why is the later sighash flag needed?
1
vote
1answer
38 views

Is there a way to create a timelocked mulstisig wallet from bitcoin-cli [duplicate]

So, I read that with the new taproot upgrade, now there is a possibility to reduce the number of signatures necessary to create a valid transaction in a multisig wallet. For example, create a 3-5 ...
4
votes
1answer
194 views

Is it possible to build complex Apps with Bitcoin Script?

I am trying to understand what Bitcoin Script is for. Is it a programming language like Java which in principle also can be used for building complex applications like a decentral exchange or was it ...
1
vote
1answer
315 views

What happens if nSequence is set to 0x00000000?

I know setting nSequence 0x00000001 means the transaction is not valid until 1 block has elapsed since its's prevout confirms. At most one spend per two blocks. What happens if it's set to 0x00000000? ...
1
vote
1answer
64 views

signed raw transaction does not conform?

I have become fairly familiar with constructing raw transaction. One thing I can't understand is after a raw transaction comes back from a signing, it doesn't look like it conforms to the transaction ...
1
vote
0answers
45 views

complete bitcoin script example

I am trying to learn how to write my own script from scratch. I have seen about a dozen examples by googling but non of them are complete. I am aware of btcdeb as well. Is there a tutorial that covers ...
5
votes
2answers
171 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). ...
1
vote
0answers
31 views

Is there anything specific to the design of the Sapio language that makes it well suited to writing covenant scripts?

I think I understand at a high level the goals of both CheckTemplateVerify (CTV, BIP 119) and the Sapio language. Is there anything specific to the design of the Sapio language that makes it well ...
2
votes
3answers
2k views

Will BTC script be Turing complete in future?

I want to know if BTC script will have loops in it in the future?
5
votes
0answers
38 views

What prior work influenced the design of the Bitcoin instruction set?

The "Script" system used by Bitcoin transactions is commonly described as a Forth-like, stack-based language. What prior work influenced the design and layout of the Script instruction set? ...
3
votes
1answer
57 views

Why were OP_RESERVED, OP_RESERVED1, and OP_RESERVED2 originally reserved?

Since the earliest public release of Bitcoin, OP_RESERVED, OP_RESERVED1, and OP_RESERVED2 have been defined at 0x50 (80), 0x89 (137), and 0x8a (138), respectively. Why? The intended purpose of all the ...
2
votes
0answers
34 views

is there a way to write SCRIPTS that CONDITION OVER THE CURRENT TIME stamp?

I am very new to bitcoin scripts, and need to design some high level bitcoin protocols without enough time to really dive into the details of the language itself. Is there a way to write a script that ...
0
votes
0answers
24 views

How are reserved operations intended to work?

Bitcoin has reserved words like OP_RESERVED1 that are only valid in an unexecuted if branch. How are those words intended on being used in the future to perform some actual operation? I understand how ...
1
vote
0answers
117 views

Alt Stack is not working as expected

I have a scenario as follows: In a company, there is a manager and three employees. The multisig signature will be redeemed by the manager combined with one of the employees. However, only the ...
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 ...
1
vote
1answer
53 views

Bitcoin 2 of 4 Multisig script with one required

Hi I am to write a bitcoin locking script with property that 2 out of 4 signatures should be verified, but among those verified 2 there is a specific signature that should be verified. I.e only 1 ...
0
votes
1answer
85 views

ElectrumX method blockchain.address.get_balance removed, how to get the script hash of a public addres and get balance?

Reading the ElectrumX documentation, found that the method for getting balance of any public address was: blockchain.address.get_balance, but was removed. Now, I understand that blockchain.scripthash....
0
votes
1answer
42 views

Pay to script hash address transaction not accepted by miners

I have fixed my initial transactions and have been able to send coins to a p2sh address Now I want to spend those coins but when I try to broadcast my transactions either the website (blockcypher) ...
7
votes
1answer
592 views

Are these two scripts equivalent?

I wonder whether OP_DEPTH 0 OP_EQUAL has the exact same behavior as OP_DEPTH OP_NOT which is 1 if no items 0 if any number of items I'm asking because the first script is used and I'm not sure if ...
0
votes
1answer
68 views

Invalid p2sh transaction accepted by the network

I have try to build a 2 of 2 p2sh transaction from scratch using the book "programming bitcoin" by Jimmy Song, we are not directly guided to make one of those so I had to modify some of the ...
1
vote
0answers
43 views

How do i debug a bitcoin transaction

My main problem is understanding how to convert the response from bitcoin-cli "decoderawtransaction" to the script format i am supposed to put in the debugginng tool. i.e my problem is ...
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
48 views

OP_CHECKMULTISIG Signature must be zero for failed CHECK(MULTI)SIG operation

I am trying to spend a P2SH multi-signature output which I have created with rust-bitcoin as follows: let builder = Builder::new() .push_opcode(opcodes::all::OP_PUSHNUM_2) .push_key(&...
1
vote
1answer
92 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 ...
0
votes
1answer
41 views

What does this Pubkey mean?

I just started learning about Bitcoin, and am sorta familiar with p2pk and p2pkh. I just found this input on a Bitcoin blockchain explorer: It looks like the Pkscript can be "solved" (I'm ...
2
votes
1answer
83 views

p2pkh vs. p2pk keeping public key private

I just got into learning Bitcoin programming through Jimmy Song's Programming Bitcoin. Jimmy says that some of p2pkh's advantages over p2pk include: a smaller ScriptPubKey keeping one's public key ...
1
vote
1answer
51 views

Bitcoin Native Script Language

I am intrigued by this Bitcoin Script Language, I want to learn how to program Bitcoin with it. Any idea where I can, find some documentation to read/practice with ?
8
votes
1answer
410 views

Full list of “special cases” during Bitcoin Script execution (p2sh, p2wsh, etc.)?

When executing a Bitcoin Script, there are some "special cases" where the interpreter performs extra verification beyond just executing scriptSig and then scriptPubKey. For example, if the ...
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 ...
1
vote
1answer
137 views

WitnessScript vs. Script Witness

In BIP 174/PSBT, there is a PSBT Input key-value pair called "PSBT_IN_WITNESS_SCRIPT" (0x05) and another called "PSBT_IN_FINAL_SCRIPTWITNESS" (0x08). What is the difference between ...
1
vote
1answer
29 views

Read the “value” being redeemed in a Bitcoin P2SH Script

Is there any way for a Bitcoin P2SH Script to read the amount of Satoshis being redeemed?
2
votes
1answer
71 views

For a redeem script to satisfy the conditions of a script what must it leave on the stack post execution?

I was watching this Andreas Antonopoulos presentation on Advanced Bitcoin Scripting. It appears from Andreas' examples that for a redeem script to satisfy the conditions of the script it needs to ...
5
votes
1answer
162 views

What is the difference between policy and consensus when it comes to a Bitcoin Core node validating scripts?

What is the difference between policy and consensus when it comes to a Bitcoin Core node validating transaction scripts? Can you give some examples of checks that are considered policy and checks that ...
0
votes
1answer
36 views

Original default bitcoin script

Where can I read the original Bitcoin script for verifying the transactions? Also, who controls the GitHub profile of bitcoin? Thanks.
1
vote
0answers
43 views

Bitcoin Script - Beautify

My question is if something exists to do the job in the opposite direction of miniscript. Miniscript's intention is to help:     ...writing (a subset of) Bitcoin Scripts in a structured way, enabling ...
3
votes
3answers
774 views

A Bitcoin locking script to force a certain payment to the receiver?

Is there a way to use Bitcoin script to force payment for the receiver? I do not mind if it's a non-standard transaction, just curious if Bitcoin script itself allows expression of something like that....
0
votes
1answer
115 views

Bitcoin scriptSig with two transactions to unlock the scriptPubKey

For example, the bitcoin script of a scriptPubKey that consists of OP SUB < 100 > OP EQUAL, and is used to lock an output of a transaction. OP SUB pops the top two elements in the stacks, ...
0
votes
1answer
25 views

and(older(10),pk(A)) malleable if top-level, can it be top-level? EDIT: not malleable, was mistaken

$ ./miniscript and(older(10),pk(A)) X 110.0000000000 37 and_v(v:pk(A),older(10)) and(older(10),pk(A)) and_v(v:pk(A),older(10)) 1 scriptlen=37 maxops=2 type=B safe=yes nonmal=yes dissat=...
0
votes
2answers
64 views

What am I missing about this “guaranteed” money-making scheme that I didn't hear from anyone but just popped up in my head?

Let's suppose that I have already set up an account at Exchange A and Exchange B, loaded each up with a small buffer of BTC (much less than 1 BTC), and am able to make API requests to buy/sell from ...
1
vote
1answer
116 views

Taproot - Eliminating Key Path

I want to struct a transaction output the key-path of which I want to be eliminated, so enforcing only the script path. In order to eliminate key-path, in my opinion, I should set "Internal ...
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
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 ...
3
votes
1answer
52 views

How do I write a script such that my funds are locked in a 2-of-2 multisig that converts into a 1-of-2 multisig after 365 days?

I would like my Bitcoin to have the extra security that a 2-of-2 multisig provides. With a single sig I am worried that if a single key gets hacked I will lose my funds. However, with a 2-of-2 ...
1
vote
0answers
28 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 ...
2
votes
0answers
52 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
2answers
47 views

About Bitcoin Core

I have just downloaded the Bitcoin Core from https://bitcoin.org/en/download I would like to ask the following since I have read the following article: https://blockgeeks.com/guides/best-bitcoin-...
2
votes
1answer
64 views

What is the relationship between the Minsc language and Policy language?

Quoting from the Minsc website "Minsc is a high-level scripting language...based on the Miniscript Policy language with additional features and syntactic sugar sprinkled on top including ...
2
votes
1answer
212 views

What happens if a P2SH redeem script is lost?

Assume Bob creates a complicated Bitcoin Script and asks Alice to make a payment to a hash of this script. (Using a P2SH transaction) If Bob loses the script (i.e. the source code of the script), is ...

1
2 3 4 5
10