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.

6
votes
2answers
2k views

How OP_EQUALVERIFY works in a standard transaction?

3 weeks ago I began learning about Bitcoins, and now I'm analyzing how it works internally. My problem is that I can't understand what two public key hashes are compare to use de OP_EQUALVERIFY, ...
46
votes
5answers
14k 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 ...
8
votes
1answer
3k views

How is the Output script formed?

I read about Input and output scripts on the wiki here: https://en.bitcoin.it/wiki/Transactions Let's say, I use my Bitcoin - QT Program, I go to "Send Coins" tab, enter a Bitcoin Address, BTC ...
6
votes
3answers
1k views

Can I use single address for all my transactions?

Can I always use single public key (addr1) for all my transactions and when I spend every time protect it with different scripts / keys (key2, key3, etc.), so that spending requires at least two keys (...
2
votes
1answer
182 views

How do I list all unique scripts from blockchain?

How do I list all unique scripts in the block chain, and their count (n-times-used)?
5
votes
1answer
547 views

In Bitcoin scripting, can you have an IF within an IF?

In bitcoin, you can create a script like this: OP_1 OP_IF OP_RETURN OP_ENDIF But could you place another if statement inside the first? OP_1 OP_IF OP_1 OP_IF OP_RETURN OP_ENDIF OP_ENDIF I grant ...
4
votes
2answers
541 views

How can a Bitcoin Oracle ensure that the money can't be respent?

Suppose I modify the requirements of the Inheritance Scripting Sample where I need to make sure that the prior BTC is "guaranteed" to be available and not reduced or re-spent prior to either of the ...
1
vote
2answers
323 views

Is the scripting system an incalculable security risk?

Why does Bitcoin have a complicated scripting system? https://en.bitcoin.it/wiki/Script https://github.com/bitcoin/bitcoin/blob/master/src/script.cpp I guess because it makes fancy contracts possible:...
4
votes
1answer
340 views

Bitcoin charity fraud - is it illegal?

So we're all aware of services like CoinAd, but what if someone took advantage of that? Imagine if someone had a video game on facebook or something and had people fill out a CAPTCHA before they could ...
2
votes
1answer
200 views

How do I read a script? How does the processor separate “data” from “commands”?

I'm trying to understand how a script works but am having trouble reading a script (the output of one Tx... and the input of a second Tx) and figuring out how the computer (bitcoin-qt) knows which ...
3
votes
1answer
378 views

How should a Bitcoin Oracle verify a transaction prior to signing?

What are the specific parts of a transaction(s) that need to be signed in the "inheritance scripting sample". Specifically, can someone provide more detail on what exactly is signed of the ...
7
votes
3answers
3k views

Can I send message inside the transactions script?

I would like to send transactions with messages as described in the wiki. In Transaction with slightly changed script is never relayed, someone answered that non-standard transactions are not relaid ...
1
vote
1answer
145 views

Can someone explain this [outdated] BIP12 OP_EVAL exploit?

I understand that BIP12 was withdrawn, and probably because of this exploit below. Can someone explain how this attack would have worked and the effect it would have on the network? for (;;) { ...
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
247 views

Are all the *coin networks consistent in which script actions are permitted and disabled?

The reference Bitcoin client disables several script commands (the programming within a transaction) due to possible implementation issues in the network. I think it's possible that a forked client ...
8
votes
3answers
925 views

Is there a listing of strange or unusual scripts found in transactions?

I'm studying scripts and am looking for strange or unusual scripts that have appeared in any of the *coin networks..(outside the standard ones listed on this page) Is any one person, or website ...
17
votes
3answers
2k views

Will general non-standard transactions ever be allowed?

To the best of my knowledge, currently "Satoshi" client relays and most pools accept only standard (transfer or generation) transactions. Besides, community is working on M-of-N transaction type. ...
4
votes
1answer
465 views

Password-based bitcoin transactions

I have been reading about the role of script in transactions and I gather it should be possible to do a Bitcoin transfer to a receiver who knows a password. Instead of checking an address, the script ...
5
votes
2answers
1k views

Bitcoin contracts. Are there good examples in the blockchain?

I have been checking the Bitcoin wiki for script and Bitcoin contracts and I have some doubts about advanced contracts. For instance, I have seen in many places references to password controlled ...
7
votes
4answers
6k views

How do you get the OP_HASH160 value from a bitcoin address?

I'm trying to sign a coinbase transaction. I know I need to use 76 A9 14 (HASH160) 88 AC but I don't understand how to create the HASH160 (20 byte) from a bitcoin address.
7
votes
2answers
2k views

What is the format of coinbase input scripts?

The input script of the coinbase transaction of block number 1 (right after the genesis block) looks like this: 04ffff001d010b How do I recognize this as a coinbase transaction? Do I simply know ...
2
votes
1answer
653 views

Can a scriptPubKey have multiple addresses?

When working directly with bitcoind, I can getRawTransaction for any transaction in the network. The vout has multiple outgoing addresses usually which contain a scriptPubKey. The scriptPubKey has a ...
4
votes
2answers
527 views

Did P2SH (BIP 16) get accepted?

Based on this, it seems like it did http://blockchain.info/p2sh but it seems I can't find a definitive answer.
15
votes
2answers
1k views

Transaction with slightly changed script is never relayed

I am playing with bitcoin transaction a bit now. I have a question. Normally, the output script looks like OP_DUP OP_HASH160 (hash) OP_EQUALVERIFY OP_CHECKSIG Now that is understandable. However, ...
5
votes
1answer
188 views

Why do some generation transactions use pubkey, instead of hash?

At BlockExplorer I can see that (edit: some) generation transactions use a pubkey in the script (<key> OP_CHECKSIG), while ordinary transactions use address/hash (OP_DUP OP_HASH160 <hash> ...
2
votes
3answers
311 views

Custom validation logic for transactions/ custom script extensions

Is it possible to add a hook for custom validation of transactions with a special script "tag" in them? If so, How? In essence, I want to add something similar in functionality to bitcoin script, but ...
3
votes
2answers
768 views

In which Block was Len Sassaman memorialised?

It has been mentioned a couple times here and there that Len Sassaman was memorialised somewhere in the Block Chain. I was able to find a dump of of the tribute to him, but I can't seem to find where ...
2
votes
1answer
113 views

What does script operation “OP_IFDUP” do?

According to the wiki page, OP_IFDUP will duplicate the top of the stack "if the input is true or false". It seems to me that everything is true or false when interpreted as a boolean. According to ...
5
votes
1answer
347 views

How did these 3 tx make it into a block in the main chain?

http://blockexplorer.com/block/000000000000051b42fd09195c75da7a084df7593f47ad18139cdc9cd83a112e The last three tx have a inputs with script_sig "1". This is invalid right? According to protocol ...
5
votes
3answers
324 views

Can Scripts be used to implement Chargebacks?

I went ahead and wrote this semi-detailed post about how to implement Chargebacks, when I hit my head and said "Doh, maybe this can just be implemented more cleanly with Scripts". So ... is there a ...
10
votes
3answers
749 views

Why is Script needed?

As I see it, the script feature is one of the most complicated features in the entire protocol. It features $ cat src/script.h|grep '^ *OP_'|wc -l 118 instructions, and requires a stack to ...
2
votes
1answer
152 views

Will any of the proposed Scripts (OP_XXX) allow subscription/recurring type payments?

Is it possible to implement a subscription/recurring payment type using Bitcoin scripts? For example, you could send a payment for a service where there is a monthly subscription say, and each month ...
7
votes
3answers
5k views

How to know if a transaction is valid?

I understand there are a couple things that need to be checked for a transaction to be valid - the previous transaction had to be correct, no OP can invalidate the transaction, etc, but is there a ...
7
votes
1answer
814 views

Script - OP_IF etc. clarifications

Description of the OP IF is a bit vague on the wiki. Where does one get statements for the op for? Are they coming from the stack, or from somewhere else? Are there any available examples of how a ...
2
votes
1answer
163 views

Script - OP_SIZE

Does the OP_SIZE operation in Script push one item onto the stack (length of the string), or two (string and its length)?
1
vote
1answer
107 views

Script - true and false values

In the Script, when one is checking whether a value is true of false, should the length of the expression be checked? For example, 0x01 is evaluated as true, but can the same be said about 0x0001, ...
5
votes
1answer
835 views

Script - OP_PUSHDATAs

When using OP_PUSHDATAs in different Scripts, how are the next bytes denoting the amount of bytes to be pushed encoded? Are they to be treated as unsigned integer, or signed (like the data that is ...
7
votes
1answer
3k views

Bitcoin script example

Is there some good example on how to process a basic tx's scriptsig and get the recipient's address from the raw transaction?
5
votes
1answer
540 views

How are transactions in discarded forks merged back into the blockchain?

It sounds like transactions in discarded blocks are propagated back to the network to be included in the next block to be generated, is that the case? If so, is that triggered in the client when it ...
9
votes
1answer
3k views

How would I hand code a Bitcoin transaction

Form the Bitcoin Wiki - Transactions I see a transaction has the following format. Input: Previous tx: f5d8ee39a430901c91a5917b9f2dc19d6d1a0e9cea205b009ca73dd04470b9a6 Index: 0 scriptSig: ...
20
votes
1answer
4k views

How do Scripts work?

Bitcoin protocol supports scripts. How do they work? How are those implemented? What are their intended usages? When are they planned to be used?
7
votes
1answer
321 views

How does a recipient know they can satisfy the transaction script to spend their bitcoins?

The wiki page on the transaction script says: The party who originally sent the Bitcoins now being spent, dictates the script operations that will occur last in order to release them for use in ...
24
votes
2answers
4k views

Useful alternative Bitcoin transaction scripts

The Bitcoin wiki describes a transaction's script as something that describes "how the next person wanting to spend the Bitcoins being transferred can gain access to them". The script for "a typical ...