The Story of Smart Contracts, or How Blockchain Grew Arms and Legs

Do repost and rate:

Almost 15 years have passed since the Bitcoin network was launched, offering the world a new way of transferring value, an alternative to traditional currencies. By 2023, blockchain-based projects in various sectors of the economy - especially financial - are in full swing, and governments are seriously engaged in launching their own crypto. This breakthrough was made possible largely thanks to smart contracts. In this post, we will explain what smart contracts are and how they have evolved.

While its most famous success stories are related to this, blockchain is not just a way to transfer value in the form of tokens. It is a technology for working with data in a single environment where participants do not trust each other. Blockchain networks are protected from malicious participants - they even solve the famous problem of Byzantine generals. And thanks to transactions, all changes in the state of the network can be unambiguously tracked - including identifying the authors of questionable transactions. All transactions, in turn, are protected from spoofing and overwriting by the basic architectural principles of the technology, as well as by electronic signatures.

In today's world, with its multitude of international and other connections at different levels, blockchain technology can be used in a variety of scenarios, from logistics to elections. But blockchain itself is not enough to create systems of the complexity required. Smart contracts - essentially classic computer programs that use blockchain networks as the infrastructure for their operation - have come to the rescue.

Ethereum: the beginning of smart contracts development

The concept of smart contracts was first proposed by Nick Szabo, a famous scientist in the field of computer science and cryptography. It is popularly believed that it is Nick who hides behind the pseudonym Satoshi Nakamoto, although he himself denies it. But what is known for sure is Sabo's participation in the development of the Ethereum technology stack, which started the widespread use of smart contracts. It was smart contracts and their potentially limitless possibilities that made ether popular not only with investors, but also with developers around the world.

The first smart contracts already made it possible to build complex business logic based on blockchain, but had features that did not allow them to compete with traditional applications. In particular, the entire smart contract had to fit into a single transaction, i.e. it should not take up more than 24 KB - after all, interaction in a blockchain network is realized through transactions. This limitation was later overcome. Also at an early stage, smart contracts had a number of "childhood diseases" and vulnerabilities, which were eventually overcome.

Back then, smart contracts also had no access to data outside the blockchain network. This is now being solved with oracles. They supply data from the outside world to the blockchain network, operate according to consensus and have digital signatures. This is a big topic that deserves a separate post.

Ethereum was the first network where smart contracts became widespread, and it maintains its leadership to this day. Many projects still do not present a better environment for their implementation, and it is not easy to argue with them. Most Ethereum smart contracts are written in Solidity, a language that has come a long way and once even absorbed its "little brother" Vyper. Solidity is surrounded by a rich ecosystem and a wide community of developers.

The basic mechanism for smart contracts in Ethereum is implemented using an EVM (Ethereum Virtual Machine) and is essentially quite simple. When a transaction triggers a smart contract, the EVM modifies the Ethereum network's stack so that it matches the outcome of the contract. Each smart contract has a defined amount of "gas" to execute, paid for by the sender. As the smart contract is executed as part of the transaction, the amount of this gas decreases, and if it reaches zero before the transaction is completed, all changes are rolled back and the smart contract is not executed. And the gas is still paid for - after all, the network resources have been used.

Smart contracts can initiate transactions and call other smart contracts independently: for this purpose, a new, nested EVM instance is loaded within the current EVC. And if there is not enough gas to execute the smart contract, the transaction is rolled back to a higher level. When executing smart contracts, a deterministic algorithm converts valid input data into expected output data, and consensus ensures that a smart contract can have only one execution result.

Ethereum is not the best fit for corporate scenarios due to the nature of the network itself. Ethereum is a public and untrusted environment, which immediately limits its capabilities when working with non-public, sensitive data; and their share in the corporate segment is very high. Another feature is the unstable, unpredictable cost of "gas" (transactions), which can easily push a large-scale project over budget.

Smart Contracts on WebAssembly

The next variant of implementing smart contracts, which can be recognized as the most advanced today, is using a low-level WebAssembly virtual machine. This is a relatively young technology: it began to be developed in 2017. Nevertheless, many people already see it as an industry standard.

In terms of use with smart contracts, WebAssembly has many advantages. Compared to EVM, it provides better performance and security. Unlike the Docker implementation, WebAssembly has no network latency. Compilation of different programming languages is supported, as well as complex smart contract operations - for example, calling one smart contract over another. There is a huge ecosystem including several WebAssembly implementations for different tasks, tools for creating custom implementations and an active developer community.

Privacy in smart contracts

When evaluating smart contracts for use in business applications, we are bound to encounter the issue of privacy. Confidentiality is a security property of information, where only those who have the right to access it have access to it. Blockchain by definition implies that the chain of its blocks is not encrypted and is available in the open. Should we try to combine the two? Perhaps it is.

Blockchain technology has a number of advantages that are very attractive to confidential systems. Blockchain networks offer unprecedented resistance to hacking. It can be used to solve the problem of Byzantine generals. DDoS attacks don't work well on decentralized protocols. There can be no single point of failure in blockchain. Risks from password leaks in the blockchain are also quite limited: compromising the private key of one of the participants cannot give anything to attackers. Such a node will simply get on the ban list, which will send a signal to the rest of the network.

So how can blockchain-based corporate information systems combine the high level of security inherent in blockchain with the necessary confidentiality?

The simplest option is to create a private network and regulate its members. This eliminates random participants and guarantees confidentiality. But what if you have to change the composition of network members? Or a project needs many networks for different tasks? There is an approach to creating sub-networks, each with its own participants and rules, but all connected to the main blockchain network. While seemingly convenient, this approach has two significant disadvantages - high labor costs and inability to scale horizontally (as the load grows, botnets can appear in the most unexpected places).

Regulation and Society adoption

Ждем новостей

Нет новых страниц

Следующая новость