3

All I've learned about so far is that while theoretically quite versatile (e.g. allowing multisignature transactions) most scripts are simply not propagated by the default client nodes, i.e. while you can easily transfer funds to a script, you may end up having a difficult time of ever spending these transactions. So, what makes a script standard/non-standard, is there a list of scripts currently supported by the network?

3

I know of four standard scripts. As Luca said, the source code for the reference client is the protocol definition, so you need to read the code to get the definitive answer. As Peter noted, a standard script is one that is relayed by the reference client. A non-standard script will not be rejected if it is in a block as long as it is a valid script.

The ones that I know are:

  1. Pay-to-PubKey-Hash: This is the standard payment to a bitcoin address. The address is in the output and the signature and pubkey are in the input.
  2. Pay-to-Pubkey: This is a payment to a pubkey. The pubkey is in the output and the signature is in the input.
  3. Pay-to-ScriptHash: This is being used for some of the fancier payment transactions. A script hash is in the output and the signature and a serialized script are in the input. On the first pass, the script hash is verified against the serialized script. If it checks, then the serialized script is expanded and a second pass is done using that script.
  4. Pay-to-MultiSig: Multiple signatures are required to sign the script. The output contains the pubkeys and the input contains the signatures. All signatures must be verified by one of the pubkeys but there can be more pubkeys than signatures. The current limit for M of N scripts is N=3.
  • 1
    You may want to add that for multisig transactions, the limit is M-out-of-N, with N at most 3. Also, for P2SH there is a requirement that the embedded script is also standard. Apart from that, this list is correct for 0.8.x. – Pieter Wuille Jan 26 '14 at 10:51
  • 2
    Also note that standardness only impacts which transactions are relayed. Non-standard scripts that are valid can be put in blocks without problems, if a miner chooses to. – Pieter Wuille Jan 26 '14 at 10:57
  • So currently P2SH means a transaction spending it will only be relayed if that script is again one of these four? – Tobias Kienzler Jan 27 '14 at 8:55
  • 1
    As for M of N - the only limit for N per se is 15, but above a certain M+N your transaction size would be too big to be mined. We managed to push 3 of 3, and 2 of 4 through default pools when testing Orisi.org. And you can push 8 of 15 through the Eligius pool - they have only 5% of hashing power, so you'll have to wait 4-10 hours for the tx to go through. (also, see bitcoin.stackexchange.com/questions/23893/… ) – kolinko Jul 17 '14 at 21:03
  • 1
    Also, there is a pull request that was made by one of the core devs to relax the rules on scripts. In a few months anything will be allowed (see bitcoin.stackexchange.com/questions/28181/… ). And even before that time - Eligius will accept almost anything :) – kolinko Jul 17 '14 at 21:06
-1

The standard list of operations for scripts are actually within the bitcoind source-code which you can find here: https://github.com/bitcoin/bitcoin/blob/master/src/script.cpp#L90

To understand which ones are actually implemented and used, you'd have to read the source-code.

So no, there's no standard for this. The standard is the actual bitcoind program.

  • So a script is always considered standard if it only uses these opcodes? – Tobias Kienzler Jan 25 '14 at 11:21
  • No, these are just the list of opcodes that exist. Not all of them are even enabled. But it has nothing to do with standardness, that is done elsewhere in the code. – Pieter Wuille Jan 25 '14 at 13:21
  • That's why I said "To understand which ones are actually implemented and used, you'd have to read the source-code." – Luca Matteis Jan 25 '14 at 15:20
  • 1
    A script being "standard" is a technical term here. Standard scripts are the ones which the reference client relays. It's independent from whether they are valid or not. – Pieter Wuille Jan 26 '14 at 10:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.