0.0413 s - время 44 - запросов

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 $ 4023.92355945 (-1.4 %)
ETH $ 136.39576179 (-2.78 %)
XRP $ 0.3113747168 (-2.23 %)
LTC $ 59.0526398482 (-2.34 %)
EOS $ 3.6460578087 (-2.48 %)
BCH $ 154.241968821 (-3.82 %)
BNB $ 14.8097661416 (-3.34 %)
XLM $ 0.1066975822 (-4.48 %)
USDT $ 1.0105941253 (-0.06 %)
TRX $ 0.0224994932 (-1.91 %)

Solidity As Key Tool For Creating Ethereum Smart Contracts

08:00 01/11/2018
Solidity As Key Tool For Creating Smart Contracts

Introduction


Step by step we have disclosed some basic smart contracts-related concepts and solutions in the global crypto environment. The program components of blockchain solutions evolved significantly. It all started as a simple scripting code. Later on, the development extended the functionality of smart contracts and involved such features as high-level programming languages. Since Ethereum was the first one to popularize this approach, we will examine its key instrument for creating smart contracts. This is the programming language called Solidity (All data presented in the article is valid as of October 22, 2018).

 

Solidity general information

 

As you can see from the official description, Solidity is a complex language developed specially to write and deploy smart contracts on the Ethereum blockchain. Its design was affected by several popular languages, such as C++ and Python. Evidently, Solidity is intended to interact with Ethereum Virtual Machine (EVM). Other major properties are static types, hierarchy, functions collections, different users, etc.

 

Solidity is a complex language developed specially to write and deploy smart contracts on the Ethereum blockchain

Solidity can be used within several integrations, including Remix compiler, Visual Studio, Atom plugins, and other solutions. It supports a console interface but contracts might be written and deployed in an offline mode. Various services related to Solidity include smart contracts testing and debugging, tools for building, managing and assisting in the deployment environment, vulnerability checks, bytecode analysis, documentation generation, and various analysers.

 

Solidity smart contracts

 

Before we proceed, let’s recollect some valuable information on Ethereum smart contracts. There are two types of accounts in the Ethereum blockchain. The first one is called “Externally owned account” (EOA). It is designed to be controlled by participants. It has an address, an ether balance, and is controlled by a user with a private key. The second account type is “Contract account”. According to the official document, this is the fusion of a code and information placed in a particular place on the Ethereum blockchain. It has address, balance, and two hash pointers to the executable code and a permanent storage. The second account type is what we will focus on now.

 

Solidity smart contracts

Contracts can be written with a huge complexity level. Their internal structure is flexible enough to be managed in different programing styles. Contracts can be programmed to react upon external call. In this case, a contract will accept a message and come up with the result, predefined by the contract author. Multiple contracts form logical sequences that might interact with each other. Of course, there are some restrictions.

 

First, it is the gas price that must be paid in order to execute a contract. Gas can be considered as the EVM fuel. It has its own price in ETH, and this cryptocurrency will be spent amid smart contract execution after all. Second, it is the depth of smart contracts call. The maximum depth, that can be reached in smart contract sequences, is equal to 1024. Latter calls will return an exception and halt the execution.

 

Details and applications


The majority of Solidity properties and techniques are widely used in high-level programming languages, for example Vyper. Some unique solutions exist as well. From the point of view of syntax and semantic, Solidity has import statements with the different path resolution including mappings, different comments, state variables, functions as code units within a contract, function modifiers to specify function behaviour, events as interface representatives, structs and enums as custom defined types, booleans, integers, address with members, contract types, different arrays and literals, etc.

 

Details and applications Solidity

The key features that guarantee the language diversity also include various functions types with several execution options, mapping as a hash table, types conversion, ether management commands, time issues, various variables and functions, addressable block and transaction details, ABI encoding and decoding functions, error management, dynamic contracts creating, libraries, inline assembly. More common structures are expressions and control statements: if, else, while, do, for, break, continue, return, etc.

 

Conclusion

 

Unfortunately, we can’t show the whole complexity and variability of the Solidity language in a single article. Moreover, each Solidity feature requires more thorough and detailed study. It is interesting that Solidity became so comfortable that other projects use it in their solutions. This will be the topic of our next article.

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?