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

2
votes
0answers
29 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
44 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
70 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 ...
2
votes
2answers
98 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: ...
2
votes
2answers
34 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
39 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
86 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 ...
3
votes
1answer
53 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
59 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
87 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
95 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 ...
1
vote
1answer
42 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
100 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
76 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
97 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
33 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
141 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 ...
2
votes
1answer
109 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
46 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 ...
2
votes
1answer
63 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
98 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
112 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
146 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
0
votes
2answers
95 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
41 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
27 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?
11
votes
2answers
236 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
38 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. ...
7
votes
1answer
822 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
53 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
71 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
67 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
249 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
31 views

Question about script

I was reading that paper http://bitcoinhistory.net/Technical_Papers/ProgrammingBitcoinTransactionScripts.pdf and I have the following question. ScriptPubKey accompanies a transaction output and ...
2
votes
1answer
64 views

What new transactions are possible with 15 operations?

Today Gavin tweeted that he's relaxing the IsStandard rules for pay-to-script-hash transactions to allow any transaction with 15 or less operations. (Full git commit here) When this is merged and ...
1
vote
3answers
88 views

How to get value of script?

I would like to count script step by step, but I have problem with it. For example, I have such transaction: { "locktime": 0, "txid": ...
2
votes
1answer
72 views

Problem with value after OP_HASH160

I am trying to implement JavaScript interpreter for Bitcoin scripts, but I have problem with counting value of OP_HASH160. I found that Hash160(x) = RIPEMD160(SHA256(x)) However, when I try to count ...
1
vote
1answer
42 views

What happens when a transaction script for mining is used for fund transfer?

So, through an odd bug in hacking some stuff onto Bitcoin, I encountered a peculiar thing. Basically, I managed to generate an transaction with 2 outputs. The first output was a typical txout DUP ...
8
votes
3answers
229 views

The Bitcoin scripting system is purposefully not Turing-complete - why?

Can somebody explain to me why the Bitcoin scripting system is purposefully not Turing-complete? To make malicious programs difficult to develop (I guess)? Or because it was difficult to make it ...
2
votes
2answers
144 views

Can Bitcoin scripting be used for double spending attacks?

A standard Bitcoin transaction deposits coins into an address and then, using Bitcoin's scripting language, states that whoever wants to spend this output must be in possess of the private key ...
1
vote
2answers
71 views

What is the format of the standard claim script?

With reference to this: https://en.bitcoin.it/wiki/Transactions#Pay-to-PubkeyHash It would seem the claim script is simply the signature consisting of S and R and the public key. However I know at ...
0
votes
2answers
83 views

Conditional scripting: how does OP_NOTIF (and OP_IF) operation(s) affect the stack?

I'm trying to write a scriptPubKey for a transaction which checks that the hash of the top value in the scriptSig is equal to either one of two fixed values and if so will do the normal transaction ...
4
votes
1answer
78 views

Is it possible (in some way or other) to expire a txout?

I read Contracts: Will this be possible? where part of the question related to expiring a transaction and one of the replies said that it would never be possible since it causes problems. ...
1
vote
1answer
208 views

How does Multi-Signature Pay 2 Script Hash (P2SH) enable stronger security?

Coinfloor says it will pay out withdrawals using Multi-Signature Pay 2 Script Hash. What is Multi-Signature Pay 2 Script Hash? I read What is "Script Hash" address exactly and how does it ...
3
votes
1answer
69 views

Is there any way to send an output to a script which can then only be sent to one of two addresses?

Is the following scenario possible? I want to send money to a script. This script will require knowing a private key to spend, as usual, but the script is only valid if the money is being sent to one ...
0
votes
1answer
34 views

What are some valid ways to obfuscate the scriptPubKey?

Is it possible to hide the balance of an address from standard clients who may be watching blockchain? I'm thinking about using script to modify the the key that is to be verified, but am having ...
2
votes
2answers
167 views

What node implementations and mining pools relay and process 'non-standard' scripts?

Which Bitcoin node implementations, if any, currently relay valid transactions that use so-called 'non-standard' scripts? What proportion of the network is made up of these implementations? What ...
2
votes
2answers
115 views

What if the execution time for an alt coin script exceeds the block time?

I don't know when and how often a script is executed, but it seems to me that there would be a problem if a single script (or a sum of all scripts in a block) exceeds the time it takes to be included ...
5
votes
2answers
680 views

How does ScriptPubKey know the public key of an Bitcoin address?

I am currently having a blonde moment. The ScriptPubKey provides a hashed version of the receivers public key. scriptPubKey OP_DUP OP_HASH160 OP_EQUALVERIFY OP_CHECKSIG However, if I give ...
1
vote
3answers
87 views

Could the standard pay to address script be simpler? e.g. no compare of the HASH160?

What if I had a scriptPubKey of <pubKey>OP_CHECKSIG And an scriptSig of <sig> Question Would that work in the standard client? Why do we need to check the hash? The only ...