2

https://en.bitcoin.it/wiki/Script

I'm trying to wrap my mind around them. Could anyone provide a bit more intuitive understanding?

  • Could you clarify what part of scripts you're unclear on? Why is your question not a duplicate of this? – Nick ODell Apr 21 '13 at 1:30
3

Scripts are used to determine the person who can spend the transaction (at Bitcoin you spend using transactions, not using BTC on an address).

To understand scripts, you probably first need to understand the Bitcoin transaction model. Unlike your old style bank, where you have accounts with a certain amount of money on it, Bitcoin doesn't actually have accounts. The address you send money to is nothing like an account, even though clients show them as such for simplicity.

What Bitcoin really does is send transactions with scripts that can only be solved by one specific private key, by using the public key to create a script. If you send money, you basically destroy one or more previous transactions to create a new one. If you're sending less than the sum of the transactions you're using, just send a bit back to your own account. A transaction can only be used once.

Because of that transaction model, scripting can work. A transaction can be made with a script that doesn't indicate one specific destination address, but instead lets everyone spend it. Such a transaction does not fit in the old style bank model, but works fine for Bitcoin. There can even be scripts that require multiple private keys, or scripts that require you to answer a question.

One quick step back to the transaction model, so I can give you the full picture. Money is created with mining, via special transactions that don't have to destroy a previous transaction: coinbase transactions. All transactions have inputs and outputs. The inputs are the previous transactions it's getting the money from (exception: coinbase) and the outputs are the scripts it's sending the money to. After money is created via mining, it can be used once as an input, after which the money will be destroyed and re-created in a new transaction that can then be used. The role that scripts play in this whole process is to verify that you actually have permission to spend certain transactions.

Hope it helped. Scripts are not the easiest part of bitcoin to understand.

  • Thank you Tom. Very helpful and informative. I'll have more questions a little later. I've been going through the source code slowly – Charles Hoskinson Apr 21 '13 at 1:36

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.