Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

1
vote
0answers
5 views

Why CHECKLOCKTIME and CHECKSEQUENCEVERIFY opcodes have to be succeeded with DROP Opcode?

Opcodes that end in VERIFY generally do not leave anything on the stack. What's so different and the reasoning when designing these opcodes that CHECKLOCKTIMEVERIFY and CHECKSEQUENCEVERIFY opcodes ...
0
votes
1answer
40 views

ScriptCode field in P2SH-P2WPKH BIP-143 Test Vector

I'm trying to understand the meaning of scriptCode in the context of spending a P2SH(P2WPKH) UTXO. I've already read the following answer to a similar question, but it does not fully address my ...
0
votes
0answers
31 views

OP_CHECKDATASIGVERIFY not working

I'm trying to generate a signature and pass it through OP_CHECKDATASIGVERIFY as part of a P2SH address on a regtest network. This results in the following: Public Key: ...
0
votes
2answers
41 views

Can someone help me understand what these scripts mean?

Could someone explain what the commands i have in bold do? if possible. Thank you. Transaction URL www.blockchain.com/btc/tx Input Scripts- ScriptSig: PUSHDATA(71)[...
2
votes
2answers
328 views

Same seed from Electrum but generate different Bitcoin addresses

I am using Electrum 3.2.2, I have the wallet file generated from Electrum and a password to decrypt the file. There is an error whenever I am trying to send Bitcoin out of that wallet, so I decide to ...
0
votes
1answer
25 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 ...
13
votes
7answers
4k views

Online Bitcoin Script simulator or debugger?

Is there an online simulator that would allow me to step through, debug, or simulate the execution of a Bitcoin script?
0
votes
1answer
37 views

Original bitcoin core has one script.cpp.where is interepreter for it?I want to write hello world compiler to understand this.?

How to understand script.cpp and its interpreter.I understand register and postfix operation. I want to understand how script is parsed into machine code.Can i write hello world such as only pushing ...
0
votes
0answers
16 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 ...
47
votes
5answers
15k 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 ...
0
votes
0answers
18 views

Uniquely identifying a UTXO

I see two ways: Txid + index Txid + script hash Pros of the txid + index: Simple and short Cons of txid + index: It relies on array iteration being deterministic and all third party ...
6
votes
2answers
903 views

Bitcoin Script tutorial

Are there any tutorials with examples on Bitcoin Script: from basics to complex scripts?
1
vote
1answer
24 views

what is the use of OP_PUSHBYTES

what is the meaning of this SCRIPTPUBKEY: OP_DUP OP_HASH160 OP_PUSHBYTES_20 xxxxx....xxxxxxxx OP_EQUALVERIFY OP_CHECKSIG in particular I searched for some documentation on OP_PUSHBYTES_X which only ...
1
vote
2answers
101 views

How is subscript computed for OP_CHECKMULTISIG?

I'm trying to learn the Bitcoin protocol by implementing it, and I've got OP_CHECKSIG working (following instructions in https://en.bitcoin.it/wiki/OP_CHECKSIG), but I can't get an transaction input ...
1
vote
2answers
2k views

How to manually verify a signature given scriptSig and scriptPubKey?

First transaction Given a transaction on the blockchain: 3a1b9e330d32fef1ee42f8e86420d2be978bbe0dc5862f17da9027cf9e11f8c4 One of the outputs transfers 424,242.42424242 BTC to ...
0
votes
0answers
29 views

Check an outpoint's scriptPubKey against known scripts

So I would like to check if coin.out.scriptPubKey is part of GetScriptForDestination(mypubkey.GetID()) A simple comparison isn't possible as the scriptPubKey (when I decode it) contains only the ...
1
vote
1answer
56 views

Bitcoin Script: mandatory-script-verify-flag-failed Script failed an OP_EQUALVERIFY operation

I try to spend a P2SH transaction (in regtest) with a timelockscript of 200 blocks. I got the following error: mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY operation) (...
8
votes
2answers
263 views

PUSHDATA4 unnecessary?

Any data push greater than 520 bytes in a Bitcoin transaction is not allowed (https://github.com/bitcoin/bitcoin/blob/v0.10.0rc3/src/script/script.h#L18). The opcode OP_PUSHDATA4 specifies, that the ...
4
votes
0answers
88 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 ...
1
vote
1answer
50 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 ...
4
votes
1answer
38 views

Is the bit encoding format for the graphic in BIP 68 implicitly little-endian?

CLTV (OP_CHECKLOCKTIMEVERIFY - absolute locktime) and CSV (OP_CHECKSEQUENCEVERIFY - relative locktime) utilize BIP 68. Is the locktime for those two operations implicitly encoded in little-endian ...
1
vote
1answer
44 views

Maximum standard input script size

What is the maximum size for an input script so to be considered standard ? Looking at the Bitcoin Core source code it appears to be 10'000 byte, however reading here and there, it appears to be 1650 ...
9
votes
1answer
3k views

Why does the default miner implementation use pay-to-pubkey?

Looking at the v0.9.3 source in miner.cpp: CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey) { CPubKey pubkey; if (!reservekey.GetReservedKey(pubkey)) return NULL; ...
4
votes
2answers
352 views

Multi-signature public key validation

In a pay 2 script hash transaction, does the redeem script get checked for valid public keys before a transaction can be signed? I have noticed that if I have a redeem script with one invalid pubkey ...
1
vote
1answer
44 views

What is the meaning of in-script and out-script in standard bitcoin transaction?

I am new to bitcoin world and I am reading this paper: Secure multiparty computations on Bitcoin https://eprint.iacr.org/2013/784.pdf The author said on page 7 that the standard bitcoin transaction ...
1
vote
2answers
35 views

Valid public key check in transaction output

Let's say I build a P2MS output script using uncompressed public keys, and let's say too that these public keys are not valid, i.e. they do not represent a valid EC Point and they don't start with ...
1
vote
2answers
115 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 ...
0
votes
1answer
93 views

Possible to check who signed the transaction in a multi-sig transaction case?

Say you have a multi-sig tx that originated from a 2-of-3 P2SH address. Is it possible to say who signed the transaction? i.e. you can get access to the redeem script once the tx is broadcasted, and ...
2
votes
1answer
258 views

Lightning close-channel transaction example?

From this article, I can understand that a punishment-based bidirectional payment channel (the type used by Lightning) would contain roughly this bitcoin script as one of the outputs: OP_IF “+7 days” ...
0
votes
1answer
74 views

Transaction still unspendable with CLTV

Previously I generated tx with CHECKLOCKTIMEVERIFY Here is the transaction https://tchain.btc.com/bb1415c166fd9f767c06d34d539f4b110ef4445f74a76c5ffad1ded33032e872 It lock funds before block 1442909. ...
0
votes
1answer
60 views

Create simple and secure transaction without checksig?

According to my previously asked question (P2SH secure spending. How?) creating transactions without signature checking is probably not secure. Anyway, I see many transactions (for ex.:...
0
votes
1answer
56 views

Diferent redeemscript for the same scriptpubkey?

Most transactions to p2sh address has the follwing scriptpubkey HASH160 f45d94733d430261962932e0c847075195916a04 OP_EQUAL As I understood, this transaction do not need to be signed. Is it true? ...
0
votes
1answer
567 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
2answers
36 views

In theory could a pubkeyhash script be solved without the public key in the scriptSig?

When signing a pubkeyhash UTXO, it is required to provide both a signature and a public key. The public key is duplicated and one copy is provided to op_checksigverify to ensure the signature is valid,...
2
votes
1answer
65 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
26 views

Script - Is it possible to build an addresss that allows retrieve a certain amount per address?

Is it possible to define a multi signature address that allows spending only certain percentage to each signature? For example, three different people with different public-private keys build an pay ...
2
votes
2answers
120 views

Operation not valid with the current stack size

According to bip65 https://github.com/bitcoin/bips/blob/master/bip-0065.mediawiki I can use expressions like IF ... ELSE ... ENDIF Here is example script from this document: IF HASH160 <...
1
vote
1answer
80 views

Why this transaction is invalid?

I issued this transaction on testnet (for a homework later solved with another script). python-bitcoinlib validates the transaction but when i submit it to blockcypher it gets rejected with error: {"...
1
vote
1answer
77 views

MULTISIG Verified transaction don't get mined on testnet

I'm trying to check the following simple MULTISIG P2SH script on bitcoin testnet (using python-bitcoinlib): Redeem = CScript([2, J1_public_key, J2_public_key, J3_public_key, 3, OP_CHECKMULTISIG]) ...
0
votes
2answers
70 views

Non-standard transaction scripts broadcasting

I'm developing an application on Bitcoin blockchain, and I use output transaction scripts that are not standard according to the classic payment methods. However, even so, on Tesnet everything works ...
8
votes
2answers
2k views

Is there a maximum size of a scriptSig/scriptPubKey?

Previous research: Transaction's maximum size What is the maximum size of a transaction? The maximum size of a standard transaction is 100k bytes. Are there any consensus rules that prohibit ...
2
votes
1answer
92 views

Why is 20 the maximum public keys in a multisig transaction?

In script.h the following limit is set: MAX_PUBKEYS_PER_MULTISIG = 20 I'm wondering: Why is the limit set to 20? How would one would construct a script that allows n more than the current OP_16? E....
0
votes
1answer
68 views

nSequence win OP_CSV in child tx must be equal to nSeq parent tx?

When I create OP_CSV transaction I need to set nSequence to the same number (in blocks) e.g. 3 OP_CHECKSEQUENCEVERIFY nSequence = 3 But when I trying to spend this tx (after 3 blocks confirmation)...
1
vote
1answer
245 views

Script evaluated without error but finished with a false/empty top stack element

I'm trying to spend coins from this tx https://tchain.btc.com/ad7a1ed858eecdd146d9c932779aecae4b33f068d29cf794fad6de20f5a5d449 The scriptpubkey is simple: 1 OP_CHECKSEQUENCEVERIFY OP_DROP ...
2
votes
1answer
61 views

Cant spend input with non-standart redeemscript (OP_CSV)

I'm playing with OP_CHECKSEQUENCEVERIFY. Here is my transaction that I'm trying to spend: https://tchain.btc.com/e79d469698915aa6724288ae3a4141a31706d081f39fb7fd0b956a73a9044b22 which has the ...
8
votes
1answer
5k views

How is a Transaction ID generated & when does it change? (with a new sequence ID?)

I'm creating a non-mainstream client that processes and validates Bitcoin transactions and need to track transactions in my database. How is the TxID generated and when does it change? ...
3
votes
1answer
50 views

OP_CHECKLOCKTIMEVERIFY . Include / reject or will not included in block?

What happened if I translate to network transaction with the folowing redeem script: [now + 3 months] CHECKLOCKTIMEVERIFY DROP DUP HASH160 [Bob's Public Key Hash] EQUALVERIFY CHECKSIG This tx will ...
44
votes
2answers
21k views
1
vote
1answer
56 views

Is it safe to store bitcoins on p2sh (no multisig)?

I've just generated p2sh btc address and look in the output script: HASH160 PUSHDATA(20)[e5c32bdc7f7fb1e6ae7aa1baf42a429803054d2c] EQUALVERIFY while normal (legacy btc address) transaction has ...
2
votes
1answer
72 views

scriptcode, scriptsig, pubkeyscript confusion

I've been banging my head on a desk for a few days trying to understand the segwit protocol properly. Another roadblock has thrown me off-guard and I am struggling to grasp the concept of "scriptCode:...