Bitcoin Forum
November 19, 2018, 02:54:14 PM *
News: Latest Bitcoin Core release: 0.17.0 [Torrent].
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: What is the purpose of scripts in transaction?  (Read 49 times)
tower.grv
Newbie
*
Offline Offline

Activity: 4
Merit: 0


View Profile
December 27, 2017, 03:40:01 PM
 #1

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?
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1542639254
Hero Member
*
Offline Offline

Posts: 1542639254

View Profile Personal Message (Offline)

Ignore
1542639254
Reply with quote  #2

1542639254
Report to moderator
1542639254
Hero Member
*
Offline Offline

Posts: 1542639254

View Profile Personal Message (Offline)

Ignore
1542639254
Reply with quote  #2

1542639254
Report to moderator
1542639254
Hero Member
*
Offline Offline

Posts: 1542639254

View Profile Personal Message (Offline)

Ignore
1542639254
Reply with quote  #2

1542639254
Report to moderator
colatkinson
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
December 27, 2017, 08:08:59 PM
 #2

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?

Not all transaction scripts are the same! The majority are, but scripting provides for more flexibility. The standard way of using custom scripts is to use a P2SH transaction, in which funds can only be unlocked if a certain script is fulfilled. This is how multisig, time locks, and even puzzles can be added to funds.

As always, the Bitcoin Book (http://chimera.labs.oreilly.com/books/1234000001802/ch05.html) is a great resource if you want to know more.
hopeAo
Jr. Member
*
Offline Offline

Activity: 42
Merit: 1


View Profile
December 28, 2017, 12:59:28 AM
 #3

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
pebwindkraft
Full Member
***
Offline Offline

Activity: 256
Merit: 239


View Profile
December 28, 2017, 08:12:57 AM
 #4

In general, it is clean for me.
really?  Grin Cheesy just kidding... script is a fundamental part of the way, the bitcoin system works.

Quote
But i can not understand for what transaction scripts are needed?
next to the links already provided (and I really recommend reading Andreas' book "Mastering Bitcoin", these scrpts make sure, that only the defined target user (or owner of that address) can spend a transaction.

Quote
Why was this introduced?
Difficult to say, but based on previous developments, one had to make sure, that in a P2P world, there might be malicious actors. So one had to make sure, that you can not spam the network, you cannot double spend a transaction, you cannot create values out of thin air... all this has to do with the scripting.

Quote
It seems for any transaction the script is same, so , why it is used here?
no, definetly not!!!
There are two parts in a transaction, which conatin scripts. In the input section, and in the output section.
The input section contains the condition, which must be met, so the funds can be transferred from the previous address to a new address.
The output section contains a script, that proves, that "I" had the correct keys, to be able to move the funds.
This all has to do with cryptographics (especially hashing and signing, you will step over the words of ECDSA...).

If interested further, the links above explain alot, and here is two links, explaining the signing process and more:
http://www.righto.com/2014/02/bitcoins-hard-way-using-raw-bitcoin.html
https://bitcoin.stackexchange.com/questions/3374/how-to-redeem-a-basic-tx

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!