Skip to main content

Questions tagged [script]

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

Filter by
Sorted by
Tagged with
1 vote
1 answer
100 views

Is it possible to "label" Segwit spendable output ScriptPubKeys with arbitrary bytes?

If one created a Redeem Script for a transaction output following a P2SH-P2WPKH pattern but with bytes prepended, something like: OP_PUSHBYTES_8 41206c6162656c2e OP_DROP OP_0 OP_PUSHBYTES_20 <20 ...
Lee's user avatar
  • 958
2 votes
1 answer
239 views

Is there an economic incentive to use p2wsh over p2tr?

As I understand, p2pkh and p2sh are nothing better than p2wpkh and p2wsh, other than compatibilty. After taproot, p2wpkh is also nothing better than p2tr, other than compatibilty(no economic incentive ...
Hyunhum's user avatar
  • 165
0 votes
1 answer
33 views

Can a Second Signer Add Data to a Bitcoin PSBT Transaction?

I'm working with Partially Signed Bitcoin Transactions (PSBTs) and have a question about the capabilities of secondary signers in the signing process. I understand that in a multi-signature scenario, ...
Nerses Asaturyan's user avatar
1 vote
1 answer
51 views

Implementing Conditional Fund Locking in Bitcoin Similar to Ethereum's Smart Contracts

I'm familiar with how Ethereum allows users to lock funds in smart contracts, which can then be released under specific conditions using mechanisms like the Hashed TimeLock Contract (HTLC) protocol. I'...
Nerses Asaturyan's user avatar
3 votes
4 answers
222 views

Is the OP_PUSHBYTES_X opcode always required after OP_RETURN?

Is the OP_PUSHBYTES opcode always expected after OP_RETURN? For instance, the 2nd output of transaction 6dfb16dd580698242bcfd8e433d557ed8c642272a368894de27292a8844a4e75 is: OP_RETURN OP_PUSHBYTES_11 ...
Lee's user avatar
  • 958
0 votes
1 answer
59 views

modified Hash Time Locked Contracts

I'm currently working on implementing a modified version of Hash Time Locked Contracts (HTLC) in Bitcoin and would greatly appreciate any guidance or best practices from the community. Objective: I ...
Nerses Asaturyan's user avatar
2 votes
1 answer
295 views

Why doesn't bitcoin script number follow two's complement?

Bitcoin script number encoding follows sign-magnitude according to BIP62, while most of programming language uses two's complement for signed integer(i.e. Rust format hex representation of signed ...
Hyunhum's user avatar
  • 165
1 vote
1 answer
66 views

Does a OP_CHECKSIGADD and OP_EQUAL script for a threshold signature fail if you provide too many valid signatures in the unlocking script?

For this CHECKSIGADD script for a 2-of-3 multisig: <pk1> OP_CHECKSIG <pk2> OP_CHECKSIGADD <pk3> OP_CHECKSIGADD OP_2 OP_EQUAL What happens if you provide more than the 2 required ...
Michael Folkson's user avatar
3 votes
1 answer
78 views

Help! About how to spend OP_checksigadd Multi-sig

I write a simple taproot-based script in bitcoinjs, like: <pk1> OP_CHECKSIG <pk2> OP_CHECKSIGADD <pk3> OP_CHECKSIGADD OP_2 OP_EQUAL It should be a 3-2 threshold account, that require ...
user152745's user avatar
0 votes
2 answers
63 views

Can I spend a P2PKH transaction via the script-path of P2TR?

Is it possible to use a P2TR script-path to spend a legacy P2PKH UTXO? I have heard it is possible to "wrap" a P2PKH transaction with P2SH. Maybe it would be possible to "wrap" the ...
Mike C's user avatar
  • 1
0 votes
1 answer
62 views

Nonstandard type script's address [duplicate]

I have nonstandard tx output. txid is 03acfae47d1e0b7674f1193237099d1553d3d8a93ecc85c18c4bec37544fe386. And I want to express the tx output with specific unique address. Blockchain explorers all seem ...
Dane's user avatar
  • 1
2 votes
1 answer
201 views

Is there really a thing called "Bitcoin address"? Since all I need to spend a UTXO is to provide a scriptSig

When I want to spend a UTXO, I need to and only need to provide the scriptSig (or input script, or unlock script). In another word, the scriptPubKey (or output script, or lock script) of a UTXO simply ...
Yan's user avatar
  • 133
0 votes
1 answer
54 views

What op_codes are used to inscribe "microstrategy orange" spam?

Other than pricing out peer-to-peer financial transactions out of the scarce blockspace, can such inscriptions also bloat the UTXO set of Bitcoin? What op_codes are used to inscribe the decentralized ...
John Smith's user avatar
1 vote
1 answer
162 views

Understanding Script's number encoding, CScriptNum

What is a simple explanation of CScriptNum, the number encoding used by arithmetic opcodes in Bitcoin Script? What would an illustrative pseudocode/python example look like? What should the encoding ...
Lee's user avatar
  • 958
0 votes
1 answer
33 views

Unable to spend a script path using buidl python lib

I've been struggling to figure out how to spend a particular script path using buidl python lib. Currently I assume the problem lies in how I construct p2tr address or there's a bug (very unlikely) in ...
katsu's user avatar
  • 21
3 votes
1 answer
81 views

Why is my P2WSH OP_IF/NOTIF argument not minimal?

I have created an HTLC with the following Bitcoin script using bitcoinlib-js: const redeemScript = bitcoin.script.compile([ bitcoin.opcodes.OP_IF, bitcoin.opcodes.OP_SHA256, ...
Oscar Chambers's user avatar
5 votes
1 answer
381 views

What is Tapscript?

What is Tapscript? How is it different from script? Is it the same thing as "Leaf script"? How does it relate to Witness Script, miniscript and any other type of script used in Bitcoin ...
Lee's user avatar
  • 958
0 votes
1 answer
35 views

What is an example usage for Script pseudo words?

I see the following on bitcoin.it: Pseudo-words These words are used internally for assisting with transaction matching. They are invalid if used in actual scripts. Word Opcode Hex Description ...
Lee's user avatar
  • 958
1 vote
0 answers
49 views

Why does OP_CHECKSIG/OP_CHECKMULTISIG remove the signature from the subscript?

When OP_CHECKSIG is used, all instances of the signature are removed from the subScript before it's included in a transaction template to be verified. See also step 3 in this excellent diagram. The ...
Lee's user avatar
  • 958
1 vote
0 answers
36 views

Miniscript exercise for 3of4 multisig that turns into a 2of4 where 2 specific keys only can spend

I was trying to write this script (miniscript) or(multi(3,pk(key_1),pk(key_2),pk(key_3),pk(key_4)),and(older(12960),multi(2,pk(key_3),pk(key_4)))) where it's a 3of4 multisig which turns into a 2of4 (...
Ziya_Sadr's user avatar
1 vote
1 answer
69 views

Other than for obvious spam, what is OP_RETURN used for in non-coinbase transactions?

Some time a go I heard from Bitcoin Mechanic that there was a coin join implementation that inscribes some data that they need in order to determine their pricing. Is that true? Do custodians such as ...
John Smith's user avatar
1 vote
0 answers
29 views

ScriptSigSize fdf501 [duplicate]

I am trying to understand what scriptsigsize is. If I look at this transaction, the scriptsigsize of the first input would be "fdf501"? If I convert it to decimal, it cannot be the ...
Jim Quick's user avatar
0 votes
1 answer
76 views

Why does my PSBT's input script not have a pub key?

I have created a PSBT to sign an HTLC using a funded P2WSH, that I wish to sign with my xverse wallet. This is my decoded PSBT which I have created using bitcoin-cli o@OscarPC:~/bitcoin-htlc$ bitcoin-...
Oscar Chambers's user avatar
2 votes
0 answers
31 views

Lightning force close detection

┌────────────────────────────────────┐ ┌────────────────────────────┐ │ outputs contain revocation script? ├──yes──► force close w/ penalty = 3 │ └──────────────┬─────────────────────┘ ...
sanket1729's user avatar
  • 1,402
0 votes
1 answer
43 views

Does the Lightning Network support Bitcoin scripts, and what do the identifiers of Lightning wallets look like?

I'm currently exploring the deployment of Bitcoin scripts within the Lightning Network. Specifically, I'm interested in understanding the compatibility and functionality of Bitcoin scripts within the ...
Nerses Asaturyan's user avatar
1 vote
1 answer
78 views

spending P2TR script path output using python bitcoinutils library

I am currently trying to spend a P2TR output using one of the scripts used to create the address. Below is the python code I tried to construct raw transaction in order to spend the UTXO. The address ...
paranoid's user avatar
0 votes
1 answer
41 views

How to build a transaction that is valid for ANY input of an address but with a specific output

I am trying to achieve a more complex task, as an use-case where a company holds a very popular bitcoin address that has many hundreds of inputs (UTXOs) in related to stocks it issued. Now, the ...
skydanc3r's user avatar
  • 179
3 votes
1 answer
121 views

How are Bitkey's spending limits enforced?

Block's new Bitkey is a 2-of-3 multi signature wallet (https://bitkey.world/en-US) I've been reading their white paper, which is a good summary of their intentions, but doesn't really go into ...
atonaltensor's user avatar
1 vote
1 answer
98 views

Deriving bip84 addresses with python

Does anyone have a python script deriving the bip84 addresses from the private key? I do have the private root key so I don't need to go all the way from the private key. I'd like to do this with the ...
Peder Rustad's user avatar
1 vote
1 answer
91 views

How to identify P2TR output type?

The scriptpubkey alone can be used to identify the type of address. However, I'm debugging a library that's having difficulty differentiating the following transaction/scriptpubkey from a p2tr ...
arshbot's user avatar
  • 1,798
1 vote
1 answer
76 views

Is there any way for a script to depend on blockchain info?

The locktime opcodes OP_CHECKLOCKTIMEVERIFYand OP_CHECKSEQUENCEVERIFY indirectly allow for an approximate block number check, is there any way to obtain other information such as the previously mined ...
Tobias Kienzler's user avatar
2 votes
1 answer
151 views

If no push opcode, how does item still end up on stack (tx verification)

I was reading the following link and there it says: "Alice’s pubkey script then pushes the pubkey hash that Bob gave her for the first transaction". I mean how ? there's no opcode for that. ...
Giorgi Lagidze's user avatar
-1 votes
1 answer
88 views

Callback from computation threads to root UTXO without trusted third party signature

No expert on Bitcoin. How I understand it, loops can be done by UTXO storing a hash of the code it requires to run the next iteration in, and then the next iteration creates a new UTXO and runs it ...
Johan's user avatar
  • 1
2 votes
1 answer
162 views

Can OP_DROP be used to include arbitrary data?

I have recently been looking into OP_RETURN and its uses in so far as including data in a transaction. Given the fact that OP_RETURN is limited to 80 bytes I thought what if OP_DROP was used? That way ...
user2334659's user avatar
2 votes
3 answers
319 views

Where can I see Taproot scripts?

I am trying to look more into Taproot scripts and was wondering if someone could help me on how to access them? I was thinking of using a blockchain explorer that decodes Taproot scripts but I can't ...
hana's user avatar
  • 35
1 vote
0 answers
41 views

Ways of emulating OP_CAT

I understand that it's possible to emulate concatenation for up to 32 bits by calculating: x || y = x + (y << len(x)), where the left shift (L_SHIFT) can be performed through multiple ...
msinkec's user avatar
  • 43
1 vote
1 answer
158 views

Are there plans to make a script invalid if there is more than one element left in the stack?

In BIP62, it was proposed to make a script invalid if there was more than one element left in the stack after execution. This proposal was eventually withdrawn. From what I read, some people have ...
mathboi's user avatar
  • 191
2 votes
1 answer
194 views

What’s going on with this "NULL address input" transaction?

I was reading this from the Bitcoin wiki (https://en.bitcoin.it/wiki/From_address). I understand the concept of UTXOs and that any input to a transaction is an output from a previous transaction. I ...
user2334659's user avatar
3 votes
1 answer
99 views

Do any browser wallets support custom bitcoin scripts?

I am creating an atomic swap interface between Bitcoin and EVM using hashed timelock contracts as the underlying swapping mechanism. The idea is to support atomic swaps via the browser, using browser-...
Oscar Chambers's user avatar
2 votes
1 answer
106 views

What is the point of having a script language now?

When I first started learning how transaction are validated, it made sense why a script language was needed: the scriptPubKey was executed along the scriptSig, the software just executes this "...
mathboi's user avatar
  • 191
2 votes
1 answer
278 views

What was the OP_IF opcode used for (except Lightning) before 2023?

There is the OP_IF opcode in Script. What did users use the OP_IF opcode for (use cases except for Lightning) before 2023? What tools to use to extract the transactions (with OP_IF) from historical ...
Greg Tonoski's user avatar
4 votes
1 answer
150 views

Is there a way to push the output value of a UTXO to the stack in Bitcoin script?

When defining the spending conditions for a UTXO can one use the output value in a script by pushing it to the stack?
Poseidon's user avatar
  • 653
3 votes
1 answer
118 views

Is the Taproot script tree commitment quantum safe?

If an attacker in posession of a quantum computer can break the ECDLP, they can of course spend every Taproot output using the key path. However, do they also have the ability to construct a valid ...
Vojtěch Strnad's user avatar
0 votes
1 answer
59 views

How to set the output script of coinbase transaction

I found that the "getaddressinfo" command in RPC can get pubkey and scriptpubkey. My address pubkey scriptpubkey are: address='bcrt1q95h0le6kknpnjp4c29cau03gvdyxd35zug30yr' pubKey='...
Jack Green's user avatar
1 vote
1 answer
68 views

Is it possible to use Bitcoin Script to implement a quantum-resistant locking script that would be safe to spend from?

Stewart, I., et. al. (2018). "Committing to quantum resistance: A slow defence for Bitcoin against a fast quantum computing attack" described a method by which funds could be safely moved ...
bca-0353f40e's user avatar
  • 1,045
0 votes
1 answer
119 views

What is an "empty vector" in Bitcoin?

EDIT: Pieter Wuille gave an answer (look at the comments) to the last situation (with OP_CHECKSIG). OP_CHECKSIG is pushing 0x00. E.g. OP_0 pushes the empty vector, which represents the number 0 (to ...
Cosmos's user avatar
  • 309
1 vote
1 answer
141 views

Is the signature check performed when the signature is the empty vector?

In this answer Vojtěch Strnad wrote the following: OP_CHECKSIGADD always performs one check per signature, since unused public keys are required to be paired with an empty witness item and are ...
Cosmos's user avatar
  • 309
1 vote
1 answer
134 views

What are the all benefits/advantages of OP_CHECKSIGADD over OP_CHECKMULTISIG?

What are all the benefits of introducing OP_CHECKSIGADD in Taproot instead of OP_CHECKMULTISIG? I assume the first benefit is the following. For example, in pre-taproot approach, if we have 3-of-10 ...
Cosmos's user avatar
  • 309
2 votes
1 answer
121 views

What would happen if we provide to OP_CHECKMULTISIG more than threshold number (m) of signatures?

Asked here but still no answer. What would happen if we provide to OP_CHECKMULTISIG opcode more than threshold number (m) of signatures? For example, if the m = 3 and n = 6 and the output script is: 3 ...
Cosmos's user avatar
  • 309
2 votes
1 answer
177 views

non-mandatory-script-verify-flag (Invalid Schnorr signature) when trying to reveal a TR output

I'm building a Bitcoin wallet, and I'm trying to spend a Taproot output via a script spend path, but I keep running into this "Invalid Schnorr signature" error from my RPC node: { "...
Sherwin Li's user avatar

1
2 3 4 5
14