0.0667 s - время 57 - запросов

We use cookies in order to improve your experience while using our website. If you continue to use our site, you accept our Cookies Policy, revised Privacy Policy and updated Terms of Use.

BTC $ 4150.62536819 (3.87 %)
ETH $ 158.746045165 (6.67 %)
XRP $ 0.3325752362 (3.18 %)
EOS $ 4.2805524342 (10.24 %)
LTC $ 51.7334276317 (4.12 %)
BCH $ 150.390369748 (3.96 %)
USDT $ 1.0090949051 (0.17 %)
XLM $ 0.0944367371 (3.87 %)
TRX $ 0.0254116628 (1.3 %)
BNB $ 10.7849535861 (-0.16 %)

Key Features Of Bitcoin Language Called Script

20:15 06/02/2019
Main Properties Of Script Language

Introduction

 

The complexity of Bitcoin does not come only from privacy and security. Of course, there are several methods of data protection in use. Hashing of two types and elliptic curves protect data consistency. A strict block and transaction structure protect miners' efforts. Data exchange protocols applied to reach the connection between neighboring nodes were partially developed by the Bitcoin team. And also, we shouldn’t forget about the software itself which is the implementation of all rules and principles mentioned above.

 

However, in the Bitcoin environment there is a component which, due to its complexity, requires separate consideration. This is a programing language called Script. The reason to distinguish it from other components is that it is changeable. You can’t change network rules or a block structure without writing a new update and applying it to all Bitcoin participants. But you can write a rule for your transaction approvement with the help of the Script code.

 

Let’s find out more about this Bitcoin issue.

 

Script basics

 

So, what is Script after all? It is the simplest programing language. It lacks several complex structures to be called Turing-complete. Script uses stack and it is an altered version of the Forth language. 

 

Turing completeness

 

This is an innate property of any programming language. To be more precise, this is the requirement programming languages may or may not satisfy. In general, it means that a language is capable of solving any finite task with strict and clear conditions. Different sources can give a different list of requirement. If a language possess all of them, it can be considered Turing-complete.

 

There is an important property that is absent in the Bitcoin programing language — a repetition commands set. You can place many identical commands one after another but can’t create a loop with several lines of the code. This restriction was made to prevent infinite loops in the code execution, as Bitcoin developers can be responsible for wallet software but they can’t manually control all transactions written by participants.

 

Stack application

 

The stack-like nature of Script comes from Forth. This property is inherited and gets along with Bitcoin goals. A stack is a certain memory area accessed by programs. Each stack has two access modes called FILO and FIFO. These names stand for “first-in, last-out” and “first-in, first-out” and explain how elements placed in the stack are to be processed thereafter. Script accesses the stack in the FILO mode.

 

Script operation

 

Every program unlocking funds is a combination of two parts. Both of them are written in Script and consist of two different object types:

 

  • Data unit. This group includes public keys, hash data, and signature. When a Script processor meets this data in the code it simply puts it in the stack.
  • Operation code. This group includes commands that explain what to do. The commands can perform some minor operations, such as comparison or duplication.

 

These two parts of a single code line are taken from the output of one transaction and the input of the next transaction. After they are written together, their content is taken and processed, one component by another. After the whole line is processed, there can be two outputs. If the result is satisfactory — the current transaction input is valid and funds are unlocked. If the result is false — the current transaction input is invalid and should be replaced.

 

Afterword

 

In this article, we took a brief look at the Script programing language used in Bitcoin. Some core properties of this language were explained, yet there are many interesting details left. We will talk about them in our next articles.

Found a mistake? Highlight it and press Ctrl + Enter to notify the administrator.

Up-to-date Blockchain and cryptocurrency news. Be the first to know!

What is it for?