Bitcoin protocol supports scripts.
- How do they work?
- How are those implemented?
- What are their intended usages?
- When are they planned to be used?
Bitcoin Stack Exchange is a question and answer site for Bitcoin users, developers, and enthusiasts. It only takes a minute to sign up.
Sign up to join this communityBitcoin protocol supports scripts.
Scripts are one of Bitcoin's more clever features. The most obvious way to implement a crypto-currency is to make a transfer be to a public key. To claim the transfer, you sign with the corresponding private key. This is not the way Bitcoin works.
When you send Bitcoins (the out of a transaction), you send them to a script. When you claim Bitcoins (the in) of a transaction) you claim them with a script. To determine if a transaction input correctly claims a transaction output, the two scripts are combined and the result is executed. If the result is true, then the input claims the output. The scripting language is stack-based and roughly similar to Forth.
The transaction input (the script trying to claim the Bitcoins) runs first. It will typically put a public key and a signature onto the stack. Then the output (the script whose Bitcoins are being claimed) runs. It will typically confirm that the public key is the correct one and that the signature signs the transaction with the corresponding private key.
Thus, you get the same effect as if you just specified a public key and signature, but you have the option of specifying more complex scripts. Unfortunately, this kind of simple script is pretty much the only kind of script supported right now. The original developer(s) imagined much more interesting scripts including things like contracts, multi-party signatures, and so on.
M of N signatures are planned. This way, you could list, say 3 public keys such that any 2 of them could claim the Bitcoins.
Unfortunately, some of the scripting components are feared to have security risks, so many of them are disabled currently.