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

<p>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.</p>

<p>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 <em>destroy</em> 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. <em>A transaction can only be used once.</em></p>

<p>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.</p>

<p>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 <em>destroy</em> 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.</p>

<p>Hope it helped. Scripts are not the easiest part of bitcoin to understand.</p>

CC BY-SA 3.0
2013-04-21T01:36:35.803Z
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
CC BY-SA 3.0
2013-04-21T01:32:37.690Z
2013-04-21T01:32:37.690Z
Tom van der Woerdt
<p><a href="https://en.bitcoin.it/wiki/Script" rel="nofollow">https://en.bitcoin.it/wiki/Script</a></p>

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

CC BY-SA 3.0
2013-04-21T01:30:50.660Z
Could you clarify what part of scripts you're unclear on? Why is your question not a duplicate of [this](http://bitcoin.stackexchange.com/questions/553/how-do-scripts-work)?
Nick ODell
<transactions><script>
An explanation of transaction scripts
Charles Hoskinson
# An explanation of transaction scripts

(Asked by: username_0 on 2013-04-21)

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

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

**Tags:** transactions, script

> **Comments:**
> **username_1**: Could you clarify what part of scripts you're unclear on? Why is your question not a duplicate of [this](http://bitcoin.stackexchange.com/questions/553/how-do-scripts-work)?  

---

## 1 answers

### Answer by username_2 on 2013-04-21. Score: 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.

> **Comments:**
> **username_0**: Thank you Tom. Very helpful and informative. I'll have more questions a little later. I've been going through the source code slowly  

---

