Stack Exchange Network

Stack Exchange network consists of 174 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
1answer
30 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 ...
4
votes
1answer
36 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
votes
0answers
28 views

BitcoinJ manually sign P2SH output

I'm trying to create, with BitcoinJ, something similar as the one stated in BIP16: scriptSig: [signature] {[pubkey] OP_CHECKSIG} scriptPubKey: OP_HASH160 [20-byte-hash of {[pubkey] OP_CHECKSIG} ] ...
1
vote
1answer
34 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
31 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 ...
0
votes
1answer
56 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.:...
1
vote
1answer
25 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 ...
1
vote
2answers
88 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
61 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: {"...
0
votes
2answers
34 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,...
0
votes
2answers
51 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 ...
2
votes
1answer
64 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
54 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
68 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]) ...
1
vote
1answer
168 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 ...
0
votes
1answer
47 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? ...
2
votes
1answer
54 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 ...
0
votes
1answer
42 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. ...
3
votes
1answer
44 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 ...
1
vote
1answer
47 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 ...
0
votes
1answer
41 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:...
3
votes
2answers
82 views

How are blocks verified?

I see in the bitcoin wiki there is something called "script" which compiles down to some bytecode to be run by a very very basic virtual machine. Does this mean that each block is actually just a ...
2
votes
1answer
68 views

Finding Transactions with seldom used opcodes for testing

I'm trying to implement a script evaluator and would like to get some real testing data from the blockchain (testnet or mainnet). Are there transactions whose input scriptSigs combined with the ...
1
vote
1answer
37 views

Is it posible to create a transaction output that can either be reddemed by privK of Addr A or by privK of Addr B AFTER certain blockheight?

I am thinking about how to secure your Bitcoin savings. One idea I had was to create sort of a "backup" address B for an address A which stores the bitcoins. So what I want to achieve is that you ...
0
votes
1answer
40 views

Is it possible to write a script, which can allow spend only own inputs except all of them?

Let's imagine: We have just one BTC address. Users send some coins to this shared address. And can spend only own inputs. P.S. If someone can provide some example script for this I'll be very ...
1
vote
1answer
19 views

One more question about scripting

Is it possible to write a script that would allow withdrawal of money only to a specific address? Is it possible to write a script that would allow withdrawal only specific amount? Any examples ? ...
1
vote
2answers
80 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 ...
0
votes
1answer
15 views

When do scripts executed?

Can anyone explain when does a script executed exactly? There are several information about "how scripts are executed" but no information about "when".
1
vote
2answers
110 views

What is the purpose of the script like RETURN PUSHDATA(36)(…)

The example is in here: https://www.blockchain.com/btc/tx/63910fdfa84db96bd1f28fead4c32f97388d5368c10059d035aac3c5f72fcdc0 Actually, there are two outputs DUP HASH160 PUSHDATA(20)[...
1
vote
1answer
117 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 ...
2
votes
1answer
54 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
2answers
218 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 ...
1
vote
1answer
51 views

How OP_CHECKSIG knows the source of sig in pay to pubkey hash transaction

https://en.bitcoin.it/wiki/Script#Standard_Transaction_to_Bitcoin_address_.28pay-to-pubkey-hash.29 The last step of pay to pubkey hash transaction is to check the signature of the previous ...
0
votes
1answer
59 views

Differences/similarities of “Bitcoin script” and “Ethereum smart contract”?

Can we compare Bitcoin script and Ethereum smart contract ? And if yes, What are differences/similarities of Bitcoin script and Ethereum smart contract in sense of functionality, architecture and ...
1
vote
0answers
30 views

Segwit versioning limitations

Currently my understanding is that if new version of Segwit script is introduced, you are free to create whatever crazy rules you want there as long as they do not go against any valid consensus rules....
1
vote
1answer
112 views

what if a coin is spendable by multiple keys?

it seems like the scripting language could allow multiple private keys to spend a coin? what if i send a coin to someone, but also allow it to be spendable by me. would their wallet still show they ...
0
votes
1answer
74 views

Bitcoin's script expressivity

I'm conscious that Bitcoin's script is not turing complete, as multiple answers point out (e.g., this answer and this one). But I'm wondering if script can express the language of a PDA or ...
4
votes
1answer
108 views

Trying to get a deeper understanding of atomic swaps

I'm an IT-student and writing a thesis about atomic swaps on BTC and BTC-like blockchains. For the thesis I decided to use BTC, LTC, BCH and DCR. These chains have a somehow similar codebase and the ...
1
vote
1answer
40 views

Why is the output address a list in RPC/console?

Vout contains a list of addresses, which I noticed to be always with size = 1, if it exists. The following is an example from Bitcoin Testnet: { "value": 0.91840581, "n": 2, "...
7
votes
1answer
126 views

What's the use of not relaying non-standard transactions if anyone can still use them using P2SH?

It seems that non-standard transactions are not normally relayed because there is a concern this might break the network or it might make future upgrades harder. But anyone can use these non-standard ...
0
votes
0answers
32 views

Bitcoin transaction scripts : does ScriptSig or ScriptPubkey run first? [duplicate]

I'm confused as to the order regarding which script is run. For examples sake: say I want to spend 1 Bitcoin which was given to me by Alice in a single transaction of value 1 Bitcoin. I understand ...
0
votes
0answers
22 views

How can users verify bitcoin escrows, or any bitcoin smart contract?

Coming from an ethereum background, one can view a contract that you send ether to before you send it and verify that the logic works as advertised. How can bitcoin users do the same? Or am I ...
0
votes
2answers
179 views

P2SH signature verification in python

I am trying to understand and verify P2SH script by writing a python code to parse real transaction in blockchain. I have chosen below Transaction randomly. TxID: ...
6
votes
1answer
690 views

Bitcoin Script tutorial

Are there any tutorials with examples on Bitcoin Script: from basics to complex scripts?
10
votes
2answers
1k views

Is sha-1 used in Bitcoin?

The Bitcoin scripting language has OP_SHA1 as one of its opcodes. However, I'm not able to find any usage of this opcode (it is not used in any standard scripts nor in any other procedures such as ...
2
votes
1answer
131 views

Addresses field in ScriptPubkey

"txid": "055f9c6dc094cf21fa224e1eb4a54ee3cc44ae9daa8aa47f98df5c73c48997f9", "hash": "055f9c6dc094cf21fa224e1eb4a54ee3cc44ae9daa8aa47f98df5c73c48997f9", "version": 1, "size": 433, "vsize": 433, "...
0
votes
1answer
35 views

Why do I get 5 bytes worth of 0x00 hex values in both outputs?

From the hex generated by the createrawtransaction command, I understand that the following is the output value: ...
0
votes
2answers
34 views

Breaking down the hex value for output 1

Within the hex generated by createrawtransaction, I am trying to understand the output 1 hex. The output 1 hex I have is: 76a914ab68025513c3dbd2f7b92a94e0581f5d50f654e788ac Spacing out the ...
1
vote
0answers
117 views

Locktime requirement not satisfied when locktime set to 1 in p2sh

I've created the following script on testnet: OP_IF 2 <pubkey1> <pubkey2> <pubkey3> 3 OP_CHECKMULTISIG OP_ELSE 1 OP_CHECKSEQUENCEVERIFY OP_DROP <pubkey1&...
2
votes
1answer
204 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” ...