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: https://en.bitcoin.it/wiki/Contracts Could even be kinds of contracts that we would never think about today.

Still, from what I understand currently there are only a handful of scripts in popular use.

Would it not be wise to restrict the scripting engine to a limited number of well understood scripts? It seems like an invitation for trouble. New scripts could be added over time.


2 Answers 2


New scripts could be added over time.

And how would you do that (without breaking old clients / getting all bitcoin clients to work the same way with the same scripts / etc) ?

I think the script language will let bitcoin evolve, without having to make any (fundamental) changes to the protocol. It's a futurewise smart decision (just like bitcoin has some protection against quantum computers, even though they ain't "dangerous" yet - and might never be). IMO it's one of the thing that make bitcoin 'better than the rest'.

Ofc having a less complex script language would minimize any potential attack vector, but I think the complexity of the language already is low enough for it not to be of any concern. At most we will probably see DoS attack (e.g. transactions which loops endless), but this should be easily fixable with an update (and the currently client already have lots of "anti-DoS" checks, to protect against this).

  • 1
    Bitcoin scripts lack any sort of looping operation. For instance, instead of using loops to do hashing, bitcoin uses a dedicated operation, OP_SHA256 to do it.
    – Nick ODell
    Commented Feb 14, 2013 at 18:45

Early on in bitcoin history, there was a proposal that scripting be replaced by a single transaction type field. This never came to pass, because it has three important problems:

  1. If you want to use a new transaction type, old clients will not have any idea of how to validate it.
  2. Everyone needs to agree on new transaction types. If I say 0x03 ought to be used for multisigature transactions, and you say it ought to be used for longer hashes of public keys, then that's a problem.
  3. Let's say that RIPEMD-160 becomes unsuitable for bitcoin addresses for whatever reason. In that case, we can make a new type of address, which only new clients will be able to spend to. However, there is no need to change any of the miners, because they will still understand the new scripts.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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