Within the context of Bitcoin, scripts are a set of instructions on how to complete a transaction. The default send/receive actions are scripts but the protocol can be extended through the creation of new scripts, such as the DNS replacement abilities of NameCoin.

learn more… | top users | synonyms

1
vote
2answers
39 views

When can I send 80 byte OP_Returns?

I heard bitcoin-core 0.11 allows 80 byte OP_Returns, but I know miners operate different implementations and was wondering when it would be likely that 80 byte OP_Returns will be swiftly included in ...
2
votes
1answer
48 views

Does an OP_RETURN script always need another output within the transaction?

I was reading this: Explanation of what an OP_RETURN transaction looks like and I wondered if the second output "value" : 0.00200000, was at all necessary. Can I just have a OP_RETURN with a 0 output ...
1
vote
1answer
27 views

Compact integer in Scripts

I've been looking at the compact representation of integers for integer operations in the Script language. It seems that most operations produce or push byte arrays, but when integer operations are ...
2
votes
1answer
24 views

Maximum number of op_codes in script

Is there any part of the Bitcoin protocol that established a limit on the maximum number of op_codes in a script. Recently I have hit the limit for the bitcoin core client. In: ...
1
vote
1answer
25 views

Script. OP_PICK/OP_ROLL

OP_PICK should take the nth element from the back of the stack and take it on top: for input xn ... x2 x1 x0 gives xn ... x2 x1 x0 xn I have used it in some scripts, but I've noticed some strange ...
1
vote
2answers
31 views

txout script criteria (scriptpubkey critieria)

what is the criteria for a txout script to be accepted into a mined block? is there any criteria at all? the reason i ask is that OP_RETURN is regularly used in txout scripts yet it is not spendable: ...
5
votes
3answers
150 views

Are loans with enforced repayment possible on the blockchain?

Are loans with interest possible in Bitcoin, such that repayment is enforceably encoded with Bitcoin Script on the blockchain from the establishment of the lending contract?
1
vote
1answer
53 views

How do I print unspent transaction outputs of an address using pybitcointools

I am a beginner looking to write a simple program that takes an input (address) and prints the unspent amount in it. I copied some code from chapter 4 of Mastering Bitcoin to generate a random ...
2
votes
2answers
96 views

OP_HASH256 of a negative number

transaction 9 in block 251684 spends transaction 25 of block 249957. the script to be evaluated here is: OP_PUSHDATA0(20) 16cfb9bc7654ef1d7723e5c2722fc0c3d505045e OP_SIZE OP_DUP OP_TRUE ...
5
votes
0answers
49 views

Which release fixed CVE-2010-5141 (attacker can spend any coin)

This post by Mike Hearn relates an interesting bit of history: When Bitcoin was first released, it contained two completely fatal bugs that made the entire system worthless. Fortunately, they were ...
0
votes
1answer
24 views

Can a transaction be conditioned on signing another transaction?

I was thinking around http://lightning.network/ . My problem is Alice sending coins to Bob via Eve: A -- tx1 -> E -- tx2 -> B Is there a way to condition tx1 on Eve signing tx2?
2
votes
1answer
36 views

What are these strange outputs in the Litecoin blockchain?

I have found that there are some strange outputs in the Litecoin blockchain that pay small amounts to the scriptPubKey 736372697074. In ASCII, this translates to "script", reminding me of how nodes ...
2
votes
1answer
35 views

Is it possible to copy other scriptSig for using in different transaction?

To use a UTXO one must supply correct scriptSig or "unlocking script" to the given scriptPubKey "lock script", I know the scriptSig in PTPKH locking is sig and pubkey. My question is what makes the ...
1
vote
2answers
40 views

Does value 'True' at the middle of stack is valid transaction?

If at the middle of the execution of scriptSig + scriptPubKey we get the value 'True', while there are remaining values or operators in the stack, is the transaction valid? Or should the stack be ...
1
vote
1answer
63 views

Without using something like Bitcoin Script, how NEM verify the transaction?

From NEM's thread in bitcointalk, it mentions: NEM doesn’t use so-called “scripts” aka predicates. I understand how Bitcoin use the script to verify the transaction. May I know where I can read ...
0
votes
1answer
20 views

Does OP_EQUALVERIFY have a return value?

The Bitcoin wiki has a page that summarizes OP_EQUAL and OP_EQUALVERIFY: OP_EQUAL Opcode (Hex): 135 (0x87) Input: x1 x2 Output: True / false Summary: Returns 1 if the ...
3
votes
0answers
79 views

Working example of raw transaction utilising Boolean (OP_IF, OP_ENDIF) scripting REQUIRED

I recently posted this Testnet TX (TxID 2d0daa01da8294a54178f8111eb2a02010c425fd15957d8baee8717edcfbe105) which successfully spends an output (TxID ...
1
vote
2answers
50 views

Specific instance of Tx using a malformed null byte vector for P2SH; insight req

From Biteasy's API for TXID fccf964964c34994e5dbbb9ff7f914159b524b0831f6eea12255aa424b39090e we can see the following info regarding inputs (for a P2SH Tx): "script_sig_string": "[] ...
1
vote
2answers
107 views

bitcoin script for a competitive crowdfunding-like contract

I'm curious about how one might replicate the functionality of http://whatbitcointhinks.com/ using bitcoin script. The functionality is that there's a sort of crowdfunding competition between two ...
3
votes
2answers
143 views

Non standard Tx with obscure OP codes: examples

I've been writing Python code to fetch various transactions and came across this: 77822fd6663c665104119cb7635352756dfc50da76a92d417ec1a12c518fad69. The script field is as follows: scriptPubKey: ...
3
votes
2answers
93 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 ...
1
vote
1answer
58 views

Does createrawtransction accept scriptPubKey and redeemScript as inputs?

According to the built-in RPC documentation the signature for createrawtransaction is: createrawtransaction [{"txid":"id","vout":n},...] {"address":amount,...}. Gavin in his example on 2-of-3 ...
3
votes
2answers
125 views

Which bitcoin script forms should be detected when tracking wallet balance?

I am implementing a library for tracking wallet balance of given bitcoin addresses. How should the transaction output script be parsed to find if the output belongs to the given address? Is it dirty ...
4
votes
1answer
90 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 the use of the OP_CODESEPARATOR. Am I right in interpreting this ...
2
votes
1answer
86 views

Multisignature: what happens if the number of signatures exceeds the “threshold” number of public keys?

Let's say a coin has been locked with a 2-of-3 challenge script. In other words, spending the coin requires two signatures, each of which matches one of three designated public keys. Now I try to ...
1
vote
1answer
138 views

Redeem bitcoins of non-standard transactions made with eligius

As I understand it, Eligius is the only miner pool accepting non-standard transactions. The Opcodes for the scripts are here. Some use cases for non-standard transactions can be found here. My ...
2
votes
2answers
142 views

Is there any way to make an UTXO that cannot be spent until a certain block #?

In bitcoin, each transaction has an nLockTime integer to specify the earliest allowed block number/time that the transaction can be added to the blockchain. In addition, each transaction input has an ...
2
votes
1answer
75 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; ...
1
vote
1answer
119 views

how to get one address from two public keys?

Parsing an input script of a transaction, I’ve come across two public keys in the script. Either public key is 33 byte long. I know how to transform a single 33 byte long public into an address. ...
1
vote
2answers
92 views

Can new OP codes be added with a soft fork?

I understand that P2SH transaction types were added "softly" by repurposing a Tx message that is already valid, so old nodes won't reject them in blocks. Is there a similar method to adding new ...
4
votes
2answers
119 views

Bitcoind transaction data verification

I find myself a victim of either my poor googling skills, or the lack of detail in the bitcoind docs. I have a walletNotify script running on a full node that whenever a transaction to / from my ...
0
votes
1answer
48 views

Why is the scriptPubKey required when using signrawtransaction?

The signrawtransaction rpc method calls for the following use: signrawtransaction "hexstring" ( [{"txid":"id","vout":n,"scriptPubKey":"hex","redeemScript":"hex"},...] ["privatekey1",...] sighashtype ...
4
votes
1answer
154 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 ...
3
votes
1answer
115 views

Bitcoin Script Execution - Must end with just `true`?

When executing bitcoin validation scripts, does the final stack have to end with just true on the stack, or can there be some elements under the true? In other words, are both of these final stack ...
4
votes
1answer
64 views

Does OP_HASH160 consume the top stack element?

In a standard P2PKH configuration, the scripts look like: Pubkey script: OP_DUP OP_HASH160 <PubKeyHash> OP_EQUALVERIFY OP_CHECKSIG Signature script: <sig> <pubkey> When ...
3
votes
1answer
78 views

How to denote <serialized> script in P2SH transaction?

From the bitcoin developer page, the format of the scripts used in P2SH transactions are as follows: Pubkey script: OP_HASH160 <Hash160(redeemScript)> OP_EQUAL Redeem script: <OP_2> ...
0
votes
2answers
155 views

How much binary data (bytes) could I put in a transaction and how?

I know that some people had put text, pdf and images in the blockchain. I wonder which are the limits in order to have a minimum "bytes/btc" value in regarding the blockchain as a permanent database. ...
1
vote
2answers
136 views

Multiple Addresses in one UTXO

The 'decoderawtransaction' RPC method of the Bitcoin-QT client gives a JSON object with an array of addresses in each UTXO. For example, when I run: decoderawtransaction ...
2
votes
1answer
150 views

Bitcoin payout based on real-life event

Just starting to learn bitcoin scripting. Can someone explain how to pay out based on some real-life event? I currently test from the command line with bitcoind -regtest
1
vote
3answers
119 views

How many OP_RETURN transactions in the Blockchain would be too many?

I realize this question may not have an answer and therefore might not be suitable for SE, but I'm very curious about OP_RETURN transactions. OP_RETURN transactions appear to be the accepted ...
0
votes
1answer
45 views

Why does the script contain the hash of the public key

The ScriptPubKey contains the hash of the public key, and this is compared to the public key in the ScriptSig. It is not possible to derive the public key from the hash (address). But when the output ...
2
votes
1answer
32 views

What are the requirements for a ScriptPubKey to be valid?

Can they have arbitrary scripts, as long as they are under a certain length?
13
votes
2answers
306 views

History behind the scripting language in Bitcoin?

What is the history of the current existing scripting language in Bitcoin? Satoshi's original whitepaper on Bitcoin makes no mention of a stack based scripting language. So who was the first person ...
1
vote
1answer
44 views

I cannot see the expected OP_CODE in transactions

According to different answers on this site the format of the standard TX claim script should be [OP_PUSH DER(R+S)+HashType OP_PUSH PubKey] The OP_PUSH code is 4C, 4D or 4E depending on push length. ...
11
votes
1answer
2k views

Explanation of what an OP_RETURN transaction looks like

How is OP_RETURN used and why was it introduced in the first place?
2
votes
1answer
56 views

Scripts within Scripts

I have read the following: https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki https://darkwallet.is/bip16-17 However, I would like to know, can one specify a pay-to-script hash that ...
1
vote
0answers
86 views

How to get bitcoin address from the pubkey_hash using bitcoin-abe or something else?

I'm using: https://github.com/bitcoin-abe/bitcoin-abe to import the blockchain into a mysql DB it is almost done after 5 days. So I started looking at the data and didn't see any addresses. I know the ...
1
vote
1answer
71 views

Arithmetic operations in Bitcoin (OP_ADD, etc)

How do arithmetic operations work in Bitcoin? If I have: 5 OP_1ADD it is obvious that I will get 6 on stack. But what if I have to make OP_1ADD on ...
2
votes
2answers
281 views

Are there examples of scripthash transactions in the blockchain that do not use MultiSig destinations?

BIP 16 uses an example of a one signature required transaction as a scripthash example: scriptSig: [signature] {[pubkey] OP_CHECKSIG} scriptPubKey: OP_HASH160 [20-byte-hash of {[pubkey] OP_CHECKSIG} ...
1
vote
1answer
39 views

What part of the transaction is scriptSig in?

I was reading this paper https://web.archive.org/web/20140331191527/http://bitcoinhistory.net/Technical_Papers/ProgrammingBitcoinTransactionScripts.pdf and I have the following question: ...