Questions tagged [script]

This tag should be used for questions regarding Bitcoin transaction scripts or scripting languages used in transactions of altcoins such as Solidity. Scripts are a set of instructions on how to complete a transaction.

Filter by
Sorted by
Tagged with
0
votes
0answers
10 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
16 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
21 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 ...
5
votes
1answer
255 views

ScriptSig content during signature (quadratic hashing)

As far as I know, the quadratic hashing problem came from the fact that every time a transaction is verified (or signed), the "unsigned transaction" that is hashed and verified changes depending on ...
6
votes
2answers
3k 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, ...
0
votes
1answer
22 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 ...
1
vote
2answers
611 views

Non SegWit P2SH bytes structure

I'm working on a bitcoin block explorer in golang, in which I'd like to gather as much informations as possible about transactions. I am able to extract addresses from every type of output, and mostly ...
2
votes
1answer
28 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
2answers
154 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 ...
54
votes
4answers
28k views

Explanation of what an OP_RETURN transaction looks like

How is OP_RETURN used and why was it introduced in the first place?
1
vote
1answer
43 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 ?
2
votes
2answers
116 views

How to make a homomorphic preimage/payment hash with current lightning network / Bitcoin implementations?

If I remember / understand it correctly by using the mechanisms from the scriptless scripts paper we could easily create homomorphic preimages / paymenthashes. I think this would be a very desirable ...
5
votes
3answers
910 views

In which Block was Len Sassaman memorialised?

It has been mentioned a couple times here and there that Len Sassaman was memorialised somewhere in the Block Chain. I was able to find a dump of of the tribute to him, but I can't seem to find where ...
0
votes
1answer
84 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 ...
8
votes
1answer
286 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 ...
1
vote
1answer
91 views

Bitcoin multisig contract - to Lock coins with nTimeLock (BIP65)

I really need help. I am currently Developing a Bitcoin wallet and want to build in a SMS Based send function where the sender does not need to know the receiver publicKey. After the contract get ...
0
votes
1answer
291 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 ...
0
votes
2answers
1k views

P2sh redeem script hash [duplicate]

What are the contents of a redeem script hash in a p2sh transaction? From what i read it's similar to the pubkey script but does it only contain the receiver's address?
3
votes
1answer
634 views

How to create a p2sh transaction with a scriptsig of OP_true?

How can I create a p2sh transaction with a scriptsig containing OP_TRUE only, removing the need for a digital signature, which will be broadcasted and mined? Also could some one provide an example of ...
2
votes
1answer
32 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 ...
2
votes
2answers
2k views

List of current opcodes?

Anyone know how / where to run enum optypecode (or some other method) to get a list of current opcodes? Like this result... https://www.slideshare.net/gvrooyen/20140220-bitcoin/34-...
3
votes
2answers
147 views

How to let surplus go to fundraiser in ANYONECANPAY crowdfunding script?

ANYONECANPAY can be used for crowdfunding, where pledged donations cannot be spent unless funding goal/soft cap is reached. But since output is committed, when soft cap is exceed, all the surplus will ...
1
vote
1answer
53 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 ...
0
votes
1answer
40 views

Why can't P2PKH's scriptPubKey be shortened to only OP_CHECKSIG?

For P2PKH, the scripPubKey is OP_DUP OP_HASH160 <pubKeyHash> OP_EQUALVERIFY OP_CHECKSIG. Why can't it check the signature only? Why can't it be shortened to just one opcode — OP_CHECKSIG? Why ...
1
vote
1answer
21 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
135 views

How to spend a multisignature, CLTV time-locked UTXO?

I am using this locking script with libbitcoin explorer to create a bitcoin testnet transaction: bx script-to-address -v 196 "[efa716] checklocktimeverify drop 2 [...
2
votes
1answer
37 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 ...
7
votes
2answers
3k 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
1answer
132 views

How to split the funds and send X% to fee wallet and the remaining funds to another wallet?

Anybody have any idea about how to do it? User send the bitcoins X% goes to fee wallet remaining funds goes to service wallet I'm trying to use the "sendfrom" but it's not working because he only ...
0
votes
1answer
32 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.
3
votes
1answer
111 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 ...
1
vote
0answers
39 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
744 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
50 views

Bitcoin script verification fails after certain time period

So I want to write a bitcoin script so that after a certain time period (say for example after 30 mins), the verification fails and transaction is marked invalid even if it gets broadcasted. Time ...
0
votes
1answer
73 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
52 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
46 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
55 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
2answers
88 views

Given OP_VER was never used, is disabled and not considered useful can its meaning be stripped and it be made OP_SUCCESS?

Given OP_VER (0x62) was never used onchain, is disabled and is not considered useful can its meaning be stripped and it be made OP_SUCCESS for the purposes of introducing a new different opcode in ...
1
vote
1answer
588 views

ScriptSig - what am I signing exactly?

So the scriptsig field in the transaction, is created with the signature and public key. In order to create the signature, we need the R and S values of a ECDSA signature. I figured how to sign a ...
9
votes
1answer
413 views

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 ...
2
votes
1answer
30 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 ...
10
votes
2answers
3k views

How vulnerable is bitcoin to quantum algorithms? [duplicate]

Assuming that quantum computers are implemented some time in the near-ish future, how vulnerable is Bitcoin to decryption via quantum algorithms? For example, Shor's algorithm enables a quantum ...
4
votes
4answers
2k views

How to decode very huge (!) raw transactions?

I'm parsing the blockchain to extract certain information I need for a script. One thing I do is parsing transactions. What I do is: getrawtransaction <tx> decoderawtransaction <rawtx> ...
2
votes
1answer
46 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 ...
10
votes
1answer
1k views

What is the alt stack?

I noticed in the bitcoin wiki script page (https://en.bitcoin.it/wiki/Script) that there were two opcodes named: OP_TOALTSTACK OP_FROMALTSTACK It looks like there is another stack that can be used ...
1
vote
0answers
21 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 ...
6
votes
2answers
244 views

nLockTime in Bitcoin Core

Currently, the Bitcoin Wiki states: A part of the original Bitcoin implementation, nLockTime is a field that specifies the earliest time a transaction may be added to a valid block. A later Bitcoin ...
2
votes
0answers
32 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
2 3 4 5
10