Questions tagged [script]

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

Filter by
Sorted by
Tagged with
3 votes
2 answers
741 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><...
  • 108
4 votes
1 answer
67 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
33 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
36 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 ...
  • 71
2 votes
2 answers
49 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
44 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 ...
1 vote
1 answer
33 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) ...
1 vote
1 answer
92 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 ...
0 votes
1 answer
42 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 ...
  • 127
5 votes
1 answer
98 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 ...
  • 51
1 vote
0 answers
69 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 ...
1 vote
1 answer
270 views

I found a historical OP_HASH256 hashlock unspent output with 1 Bitcoin still in it, is it spendable?

The output: Block Height TXID Output Index Satoshi Amount Locking Script Status 211914 AF32BB06F12F2AE5FDB7FACE7CD272BE67C923E86B7A66A76DED02D954C2F94D 0 100000000 ...
0 votes
1 answer
46 views

Why wrapping P2PK inside P2SH didn't catch on?

Call it a pay-to-public-key-script-hash (P2PKSH), like so: Locking script: OP_HASH160 OP_DATA_20 redeem_script OP_EQUAL Redeem script: OP_DATA_20 pubkey OP_CHECKSIG Unlocking script: <push ...
0 votes
1 answer
46 views

OP_SHA256 - Hashing the string representation

I'm building my own Bitcoin script interpreter for learning purposes. I've compared my results with https://siminchen.github.io/bitcoinIDE/build/editor.html And the script OP_16 OP_SHA256 which ...
  • 37
-1 votes
1 answer
61 views

What are Known Bits in a bitcoin Transaction?

How do I know if my signatures has leak/weak signatures? Is there a website or script where I can input my signatures to check for weak/leak Nonce part?
1 vote
1 answer
43 views

Why has the Miniscript for this particular Policy changed over the past few months?

The "A 3-of-3 that turns into a 2-of-3 after 90 days" policy: thresh(3,pk(key_1),pk(key_2),pk(key_3),older(12960)) compiled to this Miniscript a few months ago: thresh(3,pk(key_1),s:pk(key_2)...
0 votes
1 answer
50 views

Why is there a OP_NUMEQUAL opcode? Does OP_NUMEQUAL offer a subset of the functionality of OP_EQUAL?

There is a OP_EQUAL opcode that returns (from the Bitcoin wiki): 1 if the inputs are exactly equal, 0 otherwise And a OP_NUMEQUAL opcode that returns: 1 if the numbers are equal, 0 otherwise In ...
2 votes
1 answer
53 views

Time delayed transactions as a solution for the inheritance problem?

Is it possible to construct a transaction which is delayed in time, more specifically blocks? The idea being that you have a device which has a signed transaction, which sends all of your Bitcoin to ...
  • 212
2 votes
2 answers
37 views

Divide unknown future input amount sent to a given address amongst known recipients in known proportions?

Is there a way to divide an unknown future input amount received by a given address amongst three recipients with proportions of, for example 0.2 , 0.3, 0.5? This would need to be done in such a way ...
  • 336
1 vote
1 answer
156 views

What OP_CODEs would push 254 bytes of data?

From BIP62 I would expect to use OP_PUSHDATA1 followed by uint8_t: Pushing 76 to 255 bytes must use OP_PUSHDATA1. But then from this answer, the link to variable-length integer makes it seem that a ...
  • 779
0 votes
2 answers
105 views

Meaning of SigScript in Satoshi Nakamoto's "Genesis" coinbase transaction

The Satoshi's coinbase transaction includes this following scriptSig: ...
  • 85
1 vote
1 answer
41 views

Optimistic Multisigs

I had an idea for an optimistic multisig scheme. In a 2/2 multisig where pubkey1 could spend any time and pubkey2 could only spend after a future block number, could you have a condition that allowed ...
  • 113
0 votes
1 answer
79 views

How does the CHECKSIGADD opcode work? How does it compare to its predecessor CHECKMULTISIG?

How does the CHECKSIGADD opcode (defined in the Tapscript BIP) BIP342 work? How does it compare to its predecessor CHECKMULTISIG? The design of CHECKSIGADD was discussed in this StackExchange question....
4 votes
2 answers
367 views

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 ...
0 votes
0 answers
123 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.
  • 11
2 votes
1 answer
80 views

Translating inputs (and outputs) to find addresses involved in transaction?

Is there a way for me to translate the input and output scripts in a bitcoin transaction? I am building an application that lets you query different stats from the Bitcoin-network, down the line I ...
  • 21
1 vote
1 answer
64 views

Can The Redeem Script Consist Of Only 1 Public Key In P2SH Transactions:

I have a few questions relating to Bitcoin Signatures And P2SH: Why is P2SH used as opposed to other forms? Is it still prevalent today - has SegWit made it redundant or less useful, if not, what is ...
  • 147
0 votes
1 answer
49 views

Where Is Signature Data Stored In Post-SegWit Transactions?

If i'm correct, i am pretty sure that signature data such as the scriptsigsize and scriptsig is stored outside the Tx_Data of a Bitcoin transaction. But then where is it stored? Is it in the block or ...
  • 147
2 votes
1 answer
118 views

Why does `OP_CHECKSIGADD` allow TAPROOT keyspends?

My understanding is this sig version is only for taproot keyspends, why is it allowed to be used in OP_CHECKSIGADD? https://github.com/bitcoin/bitcoin/blob/e826b22da252e0599c61d21c98ff89f366b3120f/src/...
3 votes
4 answers
1k views

Is bitcoin script necessary?

satoshi created bitcoin script which is the language that the bitcoin client uses to handle most of the operations such as sending or verifying transactions. was it necessary to have another language ...
  • 173
1 vote
1 answer
66 views

What is a sane Miniscript? How does it differ to a valid Miniscript?

What is a sane Miniscript? How does it differ to a valid Miniscript? This was asked during a Bitcoin Core PR review club on Miniscript hosted by stickies-v on May 18th 2022.
0 votes
0 answers
42 views

Is it possible to do OP_MOD with OP_GREATERTHAN and a few other opcodes?

Currently OP MOD is considered nonstandard in the Bitcoin protocol, but we can for example combine OP SHA1 and OP GREATERTHAN to gain a similar effect. https://www.cs.technion.ac.il/~idddo/...
1 vote
1 answer
42 views

Reasons not to rename scriptPubKey and scriptSig to something more intuitive?

I realize that this is how Satoshi named them and there was some reasoning behind these names, but even after years of using them, I find them weird and confusing, especially when e.g. explaining them ...
  • 271
1 vote
1 answer
73 views

Is weighed multi-sig wallet possible?

In a multi-sig wallet, each of the public keys is unique. Is it possible to create weighted multi-sig wallet, such that one private key has more power than the others? Case 1: typical Example (need 2 ...
1 vote
2 answers
110 views

How would one turn a Miniscript tree into a Taproot tree with Taproot'd Miniscript?

How would one turn a Miniscript "tree" into a Taproot tree with Taproot'd Miniscript? (To be clear unlike a Taproot tree a Miniscript tree likely would't be surfaced to the user. Breaking ...
0 votes
1 answer
46 views

Transactions with invalid or non-parseable Script

During parsing of Bitcoin data from blockchain, I found many transactions which has invalid script (example 37b828de0da38f0b3b9ec09f6f8b7883c3202a99a285b0b0087f19f9cbf526d9,...
  • 29
0 votes
0 answers
22 views

What is the script signature and PUSHDATA operation? [duplicate]

In bitcoin transactions, there is a part of the transaction known as the scriptSig. What does this mean? Also, what is the scriptSig (PUSHDATA opcode) operation.
  • 147
0 votes
1 answer
78 views

How to submit nonstandard scriptPubKey transaction to bitcoind in regtest mode?

I'm trying to replicate an algebraic puzzle I saw in the scriptPubKey of a testnet transaction: OP_2DUP OP_ADD 6e OP_EQUAL I think the intent was for this output to be spendable by a scriptSig of ...
  • 147
4 votes
1 answer
584 views

How did testnet transaction b6714e05dd014cc92de09271886e62d85e7d41dd44fad417c520eb51d57f94c0 validate?

Testnet transaction c474c67cabc13f74c65e7cf503db971d5ba176794bff7de36f46d51ca675cf3a locked 0.0005BTC with a simple math script: OP_2DUP OP_ADD 5102 OP_EQUALVERIFY OP_SUB 230d OP_EQUAL Transaction ...
  • 147
2 votes
0 answers
25 views

Simplicity vs Miniscript [duplicate]

It is clear that both simplicity and Miniscript aims to extend and improve upon the bitcoin script. However what are the differences between them and the pros and cons they both have against the other?...
0 votes
0 answers
27 views

Newbie, please help, I'm totally clueless about Bitcoin and the rest of them and I need help [duplicate]

I'm a beginner and I'm new to everything about Bitcoin, crypto and everything. Please, I need help,anyone??
1 vote
2 answers
104 views

Why does this not return TRUE?

scriptSig: <pubKey> scriptPubKey: <pubKey> OP_EQUALVERIFY The stack has <pubKey>, <pubKey> and then OP_EQUALVERIFY. So why, does it not return TRUE, even when the recent two ...
2 votes
1 answer
204 views

Are attempts to spend from a timelocked UTXO rejected?

Background I was reading a bit about Bitcoin time locked transactions within the context of the Lightning Network. One thing that was never explained is what happens when one tries to prematurely ...
0 votes
1 answer
66 views

Using EQUALVERIFY with different public keys, but generated from the same seed

I am building certain system that involves Bitcoin and therefore I need to understand well how it works under the hood. In order to receive funds, for every new transaction new public key and its hash ...
  • 57
1 vote
1 answer
285 views

How to regularly restart bitcoind after some period of time on Linux

If, like me you wish to automatically restart bitcoind after some period of time, or if it crashes at least it will restart sometime on it's own you know that it can take a long time on Linux before ...
  • 3,186
0 votes
1 answer
78 views

Q's about P2WPKH

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": "...
3 votes
1 answer
387 views

How can the genesis block contain arbitrary data on it if the script is invalid?

The coinbase transaction from the genesis block contains this script: ...
1 vote
1 answer
67 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 ...
  • 11
0 votes
1 answer
86 views

Is it possible to design a recursive covenant opcode that results in a full node stuck in an infinite verification loop?

Is it possible to design a new opcode enabling recursive covenants that could result in a full node stuck in an infinite loop of verifying transactions? (Obviously this would never be considered for a ...
1 vote
1 answer
39 views

Trying to understand a nonstandard transaction in bitcoin tests

I am trying to implement a bitcoin script interpreter and today I stumbled upon a nonstandard transaction in tx_valid.json which gave me a lot of headaches. The transaction in question has the ...

1
2 3 4 5
12