Questions tagged [script]

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

Filter by
Sorted by
Tagged with
7 votes
2 answers
2k views

Is it correct to say that Bitcoin has a virtual machine in the same way as Ethereum does?

I always thought that between Bitcoin and Ethereum only the latter had a virtual machine. The answer to this thread opened my eyes to the fact that Bitcoin actual has a virtual machine. However, I ...
5 votes
1 answer
353 views

Any Innovations in altcoin tech for Bitcoin’s Script language? [closed]

Bitcoin’s Script is the forth-like, non-Turing complete language used for transactions. However, in practice, a very limited number of kinds of scripts are allowed, a number of opcodes have been ...
2 votes
2 answers
88 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
2 answers
208 views

Bitcoin library vs script to develop application

I'm curious about the development of application of Identity management in Blockchain platform, but I'm a bit confused about the technologies to use. In short words, when is more convenient to develop ...
2 votes
1 answer
122 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?
23 votes
10 answers
8k views

Online Bitcoin Script simulator or debugger?

Is there an online simulator that would allow me to step through, debug, or simulate the execution of a Bitcoin script?
0 votes
1 answer
584 views

Script to import multiple priv keys in Electrum

DuckDuckGo turns up nothing of interest. How to import multiple priv keys in Electrum from a file using Electrum console or shell script, for all derivable valid BTC addresses? (1,3,bc1) Eventually I ...
9 votes
1 answer
1k views

How are sigops calculated?

How are sigops calculated on a transaction? For example in the (randomly selected) following transaction: https://btc.com/bc9384919ad5d08b2c66e31f29e7c63572c398a87631c03a4ce9e94ff1cbe62f It says ...
4 votes
2 answers
162 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
304 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 ...
1 vote
1 answer
101 views

How transactions script work?

I am trying to learn Bitcoin in some technical details, but I don't really understand the process of locking and unlocking scripts. I know that for what they are using, but can someone explain me some ...
3 votes
1 answer
60 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 ...
3 votes
1 answer
46 views

How to use bitcoin multisig to prioritize one of the parties?

Normally when you use OP_CHECKMULTISIG you're basically setting up something like x-of-y, where any x of the y key holders can carry out a transaction. I want to know, if you can repurpose this ...
0 votes
0 answers
88 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
239 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 ...
0 votes
1 answer
103 views

Why does my hash not line up with the one in the scriptPubKey?

I got some btc in testnet, here are the outputs. this is the UTXO that i get my btc { "value": 17.24756333, "n": 1, "scriptPubKey": { "asm": "...
10 votes
2 answers
5k views

CHECKMULTISIG a worked out example

I was wondering if somebody could point me to or give me a worked out example of how OP_CHECKMULTISIG works behind the curtains? I expect that CHECKMULTISIG will call the CHECKSIG function and ...
1 vote
1 answer
133 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? ...
2 votes
1 answer
124 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 ...
1 vote
1 answer
54 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 ...
3 votes
2 answers
504 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 ...
2 votes
1 answer
42 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
1 answer
54 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 ...
0 votes
1 answer
75 views

How would new jets for Simplicity be soft forked in? What prevents a miner from mining a new jet?

What is the current thinking on how new jets for Simplicity would be soft forked into Bitcoin (in a speculative future where Simplicity was already itself soft forked into Bitcoin)? What would happen ...
2 votes
1 answer
192 views

Can someone explain this [outdated] BIP12 OP_EVAL exploit?

I understand that BIP12 was withdrawn, and probably because of this exploit below. Can someone explain how this attack would have worked and the effect it would have on the network? for (;;) { ...
8 votes
1 answer
792 views

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&...
2 votes
1 answer
97 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) ...
4 votes
2 answers
611 views

How can I store a redeem script in my wallet?

Imagine that I wrote a redeem script. I calculated the related P2SH address, and sent some bitcoins to that address. In order to spend that bitcoins, I need to remember two things: The private keys ...
2 votes
2 answers
173 views

Elements (/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. They are: OP_INSPECTCURRENTINPUT OP_INSPECTINPUT ...
1 vote
1 answer
71 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
73 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
1 answer
122 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 ...
2 votes
2 answers
58 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
105 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 ...
1 vote
1 answer
50 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 ...
3 votes
2 answers
788 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><...
0 votes
1 answer
76 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 ...
1 vote
1 answer
358 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 ...
1 vote
2 answers
132 views

In practice, are redeemScripts commonly reused?

In regards to P2SH-P2WSH transactions, are Txout-script values identical between transactions? Is it reasonable to expect a business or vendor that accepts bitcoin to be using the same redeemScript ...
1 vote
1 answer
386 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 ...
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 ...
7 votes
2 answers
5k views

How OP_EQUALVERIFY works in a standard transaction?

3 weeks ago I began learning about Bitcoins, and now I'm analyzing how it works internally. My problem is that I can't understand what two public key hashes are compare to use de OP_EQUALVERIFY, ...
9 votes
2 answers
8k views

What is Bitcoin locking and unlocking script?

The locking script on an UTXO and the unlocking script are written in bitcoin scripting language. When a transaction is validated, the unlocking script in each input is executed alongside the ...
3 votes
1 answer
84 views

How does one prove total turingness of the bitcoin script using the Ackermann Functions?

In this Medium Article (https://medium.com/@craig_10243/bitcoin-a-total-turing-machine-5a6c3c68f5a7#_ftn2), C. Wright states: "...It is known that all primitive recursive functions are total and ...
8 votes
1 answer
2k views

How does OP_RETURN burn coins?

What exactly causes the output containing OP_RETURN to be unspendable? And why do I have to use the byes after OP_RETURN for keeping data in the blockchain and I can't use bytes before OP_RETURN?
0 votes
1 answer
49 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
132 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 ...
1 vote
0 answers
177 views

Bitcoin script and unsecure ScriptPubKey

The following is taken from problem 3 in HW1 of CS 251 Stanford's course (https://cs251.stanford.edu/syllabus.html). Alice is on a backpacking trip and is worried about her devices containing private ...
7 votes
3 answers
420 views

Multisig where one of the keys specifically is required?

Is it possible to make a multisig wallet that requires one of the keys specifically and any of the other ones in order to sign a transaction? For example, let's say I have a 2-of-3 multisig that has ...
0 votes
0 answers
167 views

I can't find 3 words out of my 12 words recovery phrase that i saved. I hear i need to run a script I just need guidelines as a newbie on how to do it

So i can't find 3 words out of my 12 words recovery phrase that i saved. I just don't know how to go about the whole script thing. Really hoping someone could guide me step by step on it.

1
2 3 4 5
12