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
1answer
28 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
30 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 ...
0
votes
1answer
35 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 ...
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
367 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
15 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
26k 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
21 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
417 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
31 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 ...
1
vote
2answers
144 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 ...
4
votes
2answers
567 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 ...
2
votes
1answer
39 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(...
1
vote
1answer
82 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
198 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?
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
290 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 ...
1
vote
1answer
92 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
123 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 ...
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
33 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
1k views

Bitcoin Script tutorial

Are there any tutorials with examples on Bitcoin Script: from basics to complex scripts?
0
votes
1answer
27 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 ...
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 ...
3
votes
1answer
108 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
159 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 ...
2
votes
1answer
101 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
67 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 ...
0
votes
0answers
53 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 ...
9
votes
1answer
203 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 ...
0
votes
1answer
73 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 ...
2
votes
1answer
77 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
32 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 ...
2
votes
1answer
72 views

Create Custom Script with 2-3

I'm studying P2SH, and I want to create a custom script. I already created one tx but without OP_CHECKMULITISIG as you can check at this link https://tbtc.bitaps.com/...
0
votes
1answer
41 views

Is a multi script possible that requires relative time locks relative to each signature?

I've been wondering about cold storage multi sig security. Specifically, I was wondering how secure it is with respect to a kidnapper. If a kidnapper took X hostage, and threatened to kill him, X ...
10
votes
3answers
6k views

parsing bitcoin input and output addresses from scripts

can someone walk me through the process of combining script inputs and outputs to reveal the base58 encoded input and output addresses. take for example, block 728. this has two raw script inputs: ...
0
votes
1answer
72 views

OP_CHECKSIG NULLFAIL with btcdeb

I'm using btcdeb to understand script. I pick a old random P2PKH transaction form mainnet, and paste unlocking script e locking script inside. I know that this script is ok, because I can check on ...
0
votes
0answers
32 views

How does HASHSIG work?

I am reading an article about how HASHSIG works, but i don't understand this: Before the signature is computed, several temporary changes are made to the transaction: The signature script of the ...
4
votes
1answer
305 views

How is OP_CHECKTEMPLATEVERIFY a scaling solution

I was wondering about OP_CHECKTEMPLATEVERIFY or OP_SECURETHEBAG as it was previously called. As far as I understand it you can commit on how to spend the coins later this way. But it doesn't enable ...
3
votes
1answer
290 views

How is time encoded (BIP65) in scripts?

BIP65 has several examples where OP_CHECKLOCKTIMEVERIFY interprets the time value underneath it in the stack, for example: <expiry time> CHECKLOCKTIMEVERIFY DROP DUP HASH160 <pubKeyHash> ...
4
votes
4answers
366 views

Why doesn't address contain a full scriptPubKey?

This is a general question, but let's suppose a P2PKH transaction. P2PKH address starts with "1" and the sender incorporates it into the scriptPubKey as: OP_DUP OP_HASH160 <PublicKeyHash> ...
1
vote
3answers
369 views

Instant confirmations with pre-published, locked, transactions

(Clarification: This is not an attempt to solve the problem of a vendor taking the money and running without handing over the merchandise. Problems like that can't be solved without some third party. ...
1
vote
1answer
83 views

Bech32 Multisig error: Witness requires empty scriptSig (code 64)

I've been able to do multisig between two addresses from electrum and one from bitcoind. [root@test bin]# bitcoin-cli -testnet getnewaddress n3JewuY82cprdRvxHdRNG8C3iTkJBKeLbz [root@test bin]# ...
5
votes
2answers
1k views

Bitcoin contracts. Are there good examples in the blockchain?

I have been checking the Bitcoin wiki for script and Bitcoin contracts and I have some doubts about advanced contracts. For instance, I have seen in many places references to password controlled ...
1
vote
3answers
60 views

What are some good solutions for analyzing Bitcoin script patterns?

I'm interested in analyzing the Bitcoin blockchain for occurrences of particular scripts and spending patterns. What are some good solutions for this? An ideal solution would let me filter ...
1
vote
2answers
95 views

Can someone explain how an HTLC is redeemed?

I'm looking at Bolt 3 in the Lightning rfc. My question is about how a HTLC is redeemed. Example HTLC script for reference: # To remote node with revocation key OP_DUP OP_HASH160 <RIPEMD160(SHA256(...
0
votes
1answer
45 views

How to verify locking and unlocking scripts?

I've selected an arbitrary transaction id and retrieved its associated transaction details using the blockcypher explorer as follows: from blockcypher import get_transaction_details ...
0
votes
1answer
21 views

How does a constant opcode become negative in Script

I am doing some tutorial and in this chapter we are suppose to reproduce the Script scripting language I am struggling to understand one of the exercises, here it is: Create a ScriptSig that can ...
1
vote
1answer
54 views

Is a script spendable if multiple items are left on the stack?

Is a script spendable if the top item left on the stack evaluates to "TRUE", and that is the only item left in the stack? In other words, is it okay for multiple items to be left on the stack? For ...

1
2 3 4 5
9