Post
Topic
Board Development & Technical Discussion
Re: What is the purpose of scripts in transaction?
by
hopeAo
on 28/12/2017, 00:59:28 UTC
Hi All,

I try to understand how bitcoin works .
In general, it is clean for me. But i can not understand for what transaction scripts are needed? Why was this introduced?
It seems for any transaction the script is same, so , why it is used here?

Script is the name of the Bitcoin protocol’s scripting system that processes and validates transactions. Script is a clever, stack-based instruction engine, and it makes all transactions from simple payments to complex oracle overseen contracts possible. All bitcoin transactions have scripts embedded into its inputs and outputs. The scripts use a very simple programming language, which is evaluated from left to right using a stack. The language is designed such that it guarantees all scripts will execute in a limited amount of time. When a transaction is validated, the input scripts are concatenated with the output scripts and evaluated. To be valid, all transaction scripts must evaluate to true. A good analogy for how this works is that the output scripts are puzzles that specify in which conditions can those bitcoins be spent. The input scripts provide the correct data to make those output scripts evaluate to true.

https://bitcore.io/api/lib/script