What's the deal with Deno? We talk with a major contributor to find out. Listen now.

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
2
votes
1answer
26 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 ...
9
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
20 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 ...
1
vote
2answers
147 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 ...
6
votes
2answers
206 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
23 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?
2
votes
2answers
109 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 ...
0
votes
1answer
82 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
1answer
84 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
219 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

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?
1
vote
1answer
32 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 ...
10
votes
1answer
246 views

Can we construct a UTXO which is spendable only via proof of work?

Do the current Bitcoin opcodes and transaction size limit allow constructing a UTXO which is only spendable if a specified amount of work has been performed? So the spender, would provide a nonce as ...
1
vote
1answer
106 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 ...
2
votes
2answers
129 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 ...
0
votes
1answer
32 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
182 views

Do HTLC transactions work today or do they need a new soft-fork?

I thought that HTLCs were just a kind of a script construct that would allow to unlock funds for a period of time, which can be unlocked to anyone that provides the original string that matches the ...
50
votes
6answers
18k views

What is relation between scriptSig and scriptPubKey?

Scenario: A is sending 1 BTC to B. scriptSig appears in the Input Script. scriptSig = <sig> <pubKey> Here, public key is the Public Key of the sender, A. (this is the public key ...
1
vote
2answers
331 views

Differentiating Output Script (scriptPubKey) Types

I am working on a little script to breakdown the data inside coinbase transactions. This is largely to improve my understanding of legacy and SegWit transactions (Given coinbase transactions have less ...
1
vote
2answers
43 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
141 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 ...
2
votes
2answers
70 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
37 views

Could CHECKSIGADD be used on new ECDSA multisignatures instead of CHECKMULTISIG?

The proposed Taproot soft fork (BIP 342) defines the new opcode OP_CHECKSIGADD to verify Schnorr multisignatures whilst OP_CHECKMULTISIG (and OP_CHECKMULTISIGVERIFY) are disabled for Taproot spends (...
3
votes
1answer
48 views

Should the Policy to Miniscript compiler(s) be considered as deterministic and is this the end goal?

Should the Policy to Miniscript compiler(s) be considered as deterministic and is this the end goal? This question was asked by Jeremy Rubin on ##miniscript on IRC and has been paraphrased. For basic ...
0
votes
1answer
39 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
30 views

OP_LSHIFT & OP_RSHIFT purpose & functionality

What is the purpose & functionalities of the LSHIFT & RSHIFT Script OP codes ?
3
votes
2answers
408 views

Is it possible to do a 3-of-5 OR 1 multi-sig for backup purposes?

I'd like to create a multi-sig wallet where I can freely create transactions, but I want to give keys to trusted friends/family + a safety deposit box so that if I hit my head and forget my password, ...
3
votes
2answers
52 views

How does the sender know the receiver's public keys in a m-of-n transaction?

Assume that Alice is controlling an address that requires multisig to spend bitcoins. Someone wants to send Alice bitcoins and this sender needs to create a scriptPubKey as part of the output paying ...
0
votes
1answer
32 views

Could it be possible to secure transactions against double-spending with other utxos?

I'm new to Bitcoin Script, and I was wondering if it is possible to use funds from one utxo to "insure" that other utxo will not be double-spent (until the Lightning Network will save us all). Suppose ...
0
votes
0answers
31 views

Is who is richer game possible with bitcoin script?

With Bitcoin script, is it possible to construct a timelocked address X in such a way that: Players A and B (maybe more players) can send bitcoin to this address; When the timelock expires,the player ...
11
votes
2answers
2k views

What is OP_CODESEPARATOR used for?

Looking at the Bitcoin source (https://github.com/bitcoin/bitcoin/blob/v0.9.3/src/script.cpp#L843-L847, specifically), I ran into the use of the OP_CODESEPARATOR. Am I right in interpreting this code ...
8
votes
1answer
394 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 ...
0
votes
1answer
16 views

Can we determine which one of the referenced outputs corresponds to a cashback transaction in BTC transaction scripts?

let me quickly elaborate the question. The structure of a BTC transaction script looks somewhat like the following example "...
50
votes
3answers
27k 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
32 views

how to find p2sh/p2wsh in utxo set after wallet recovery

i'm trying to understand how wallets remember a redeem script for p2sh/p2wsh for spending, after recovering from their seed, because the utxo set only has the hash in it, right? there are a nearly ...
0
votes
3answers
421 views

Creating an OP_CSV transaction with bitcoinjs

I'm working on a tool for timelocked contract generation. My redeem script looks like so: OP_HASH160 <revocationHash> OP_EQUAL OP_IF <bobPubKey> OP_ELSE <timeDelay> ...
0
votes
0answers
35 views

creating macd script

this was a script I found for trading with macd. It is taken from trality.com: @schedule(interval="1h", symbol="BTCUSDT") def handler(state, data): macd_ind = data.macd(12,26,9).last if macd_ind ...
5
votes
2answers
643 views

Why don't P2PK scripts have their own address?

If I understand addresses correctly, different types of addresses are used to map to a particular locking script (scriptPubKey). So based on the leading character of an address, a wallet will decode ...
3
votes
1answer
48 views

With Miniscript why is it not possible to invert conditions with something like not()?

This question was asked by Luke Childs (@lukechilds) on Twitter. In Miniscript would it be possible to invert conditions with something like not()? Could you essentially create a younger() out of not(...
0
votes
1answer
20 views

Understanding assurance contract in bitcoin scripts

I'm having a bit of trouble understanding example 3, the bit coin assurance contract on the bitcoin wiki(https://en.bitcoin.it/wiki/Contract) where senders choose to donate money only if 1000BTC total ...
5
votes
3answers
299 views

Does the alternative stack make Script Turing complete?

The wiki documents the presence of an "alt stack" in Script: OP_TOALTSTACK Puts the input onto the top of the alt stack. Removes it from the main stack. OP_FROMALTSTACK Puts the input onto the top of ...
2
votes
0answers
47 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 ...
0
votes
1answer
44 views

Script_sig for coinbase transaction afbff1130b6fcbdceebbadfc48a842af1f03ee08a79e042b37fc467518b49a0f

I am currently developing a blockchain parser in Python, and it has been crashing in the file blk00006.dat for the coinbase transaction with the hash ...
6
votes
2answers
2k views

Bitcoin Script tutorial

Are there any tutorials with examples on Bitcoin Script: from basics to complex scripts?
3
votes
1answer
114 views

How is Simplicity better suited for static analysis compared to script?

Quoted from the whitepaper, one of the design goals of Simplicity is: Provide formal semantics that facilitate easy reasoning about programs using existing off-the-shelf proof-assistant ...
2
votes
2answers
162 views

What does script operation “OP_IFDUP” do?

According to the wiki page, OP_IFDUP will duplicate the top of the stack "if the input is true or false". It seems to me that everything is true or false when interpreted as a boolean. According to ...
0
votes
0answers
62 views

How to construct and redeem a bip199 htlc with python-bitcoinlib

Playing with this script, I'd like to understand how to construct a bip199 htlc and redeem it, however this script fails on the OP_EQUALVERIFY and I can't seem to understand why. I'd like an ...
0
votes
1answer
79 views

Standardness rules related to BIP 16 (P2SH)

I can read in BIP0016 wiki the P2SH Specification Transactions that redeem these pay-to-script outpoints are only considered standard if the serialized script - also referred to as the ...
3
votes
1answer
88 views

Where can I find the miniscript policy language specification?

I would like to understand how miniscript works by coding it myself. As I started studying it, I realized that miniscript is more or less a 1-for-1 abstraction of a subset of Script and that the ...
0
votes
1answer
36 views

What are the script size limitations according to consensus rules and are they enforced on TestNet?

I'm trying to figure out the limitations that scripts have regarding their size, limits that would make a script invalid (ignoring standardness). According to this question and also these lines of ...

1
2 3 4 5
9