logo
logo
Sign in

Study of Smart Contracts: Concept and Evolution

avatar
dapps development
Study of Smart Contracts: Concept and Evolution

What is a smart contract

In 1996, Nick Szabo proposed the concept of smart contracts in the article “Smart Contracts: Building Blocks For Digital Markets”. The so-called “contract” is something like a clause or a contract, which records the conditions of occurrence and the corresponding executed clauses to support operations such as confirmation of rights; the so-called “intelligence” means automation and programmability.

Therefore, Bridge Smart Contract Development Services is a programmable contract, and it can also be understood as a self-executing clause contract. In a computer, it is a self-executing program fragment. It is easier to save the contract, and it is run by a certain algorithm. Given the input, the corresponding output is obtained, which greatly guarantees the execution of the contract. Using the vending machine analogy can help us better understand the core features of smart contracts. When the user selects the goods to be purchased and completes the payment, the shipping logic will be triggered, and the user can get the desired goods, and this process does not require manual intervention, which saves the labor cost of selling goods. If you want to break this contract, you have to physically destroy the vending machine. Like POS card swiping machines, EDI (Electronic Data Interchange), etc., this analogy can also be used.

Smart Contracts and Blockchain

Smart contracts were proposed in the last century, while blockchain was born in 2009. By definition, smart contracts have little to do with blockchain. So why have smart contracts and blockchains been so closely related in the past 10 years? Because the blockchain can ensure that the smart contract cannot be tampered with, not only the contract content cannot be tampered with, but also the record of each call. The most basic premise for smart contracts to generate value is to have a strong underlying medium for storage, so that it cannot be physically damaged.

However, the ontology of a smart contract is a piece of code, which is very easy to be tampered with, and how to provide a strong storage medium for it becomes a problem. This is exactly what the blockchain is good at solving — through the practice of Bitcoin, Cross chain bridge development it has been proved that the blockchain can make electronic records immutable in a distributed environment. At the same time, smart contracts are also feeding the blockchain, which greatly expands the business scenarios of the blockchain.

After being combined with smart contracts, the blockchain no longer serves a single currency payment, and can be extended to all aspects of life. The rich application scenarios also pose new challenges to the capabilities of the blockchain.

Blockchain 2.0: The Birth of Ethereum

Bitcoin, born in 2009, uses technologies such as blockchain to ensure the ecology, creating the era of blockchain 1.0. Users can customize some things through script code, such as how to unlock a fund. These script codes are saved with the transaction, thus enjoying immutability and determinism. So from a certain perspective, these scripts can also be regarded as smart contracts. But they don’t work well. First, these script codes are not Turing-complete, which limits the functions that can be implemented; second, the development threshold is high, and the experience of writing complex logic will be poor, such as writing programs with JVM bytecode.

In 2013, a young goddess Buterin proposed Ethereum, the core of which is to update and verify blockchain data through the state of the world. The biggest difference between Ethereum and Bitcoin is that complex logical operations can be performed through smart contracts. On Ethereum, the language of smart contracts is Solidity, Build a cross chain bridge which is a Turing-complete and relatively upper-level language, which greatly expands the capabilities of smart contracts and reduces the difficulty of writing smart contracts. Because of this, the birth of Ethereum also marks the beginning of the blockchain 2.0 era. Subsequently, smart contract technology has gradually penetrated into multiple business scenarios such as traceability, certificate storage, and supply chain.

Status and Prospects of Smart Contracts

From a programming perspective, a smart contract is a piece of code. Smart contracts have many differences and limitations compared to regular code, such as:

  1. single thread execution
  2. Code execution consumes resources and cannot exceed resource limits
  3. It is currently difficult to obtain off-chain data, such as weather information, game results, etc.
  4. Other restrictions like TPS

These characteristics make the current smart contract ecology center on the governance of on-chain resources. Just like various ERC standards and governance schemes on Ethereum; there are various resource models on EOS, such as CPU, RAM, concurrent economic model, Rex, Bancor protocol, etc. Obviously, as far as the current ecology is concerned, the influence of smart contracts on the real world is limited. But things are always evolving. At present, there have been many researches devoted to breaking these limitations, typically Oracles (oracles, but often referred to as oracles), which allow smart contracts to interact with off-chain, which can greatly improve the use of smart contracts In the scene, it seems that a computer is connected to the Internet; for example, those attempts to break through the performance bottleneck of the chain itself, such as payment channels, cross-chain, plasma, and rollup, all break the shackles of security and performance from different angles. Undoubtedly, smart contracts will play an increasingly important role, and with the implementation of Ethereum 2.0 in the future, a new blockchain era may be opened.

Smart Contract Technology

Ethereum adopts Solidity as a smart contract language, Solidity is a high-level programming language created to implement smart contracts that can run on nodes that allow Ethereum programs. The language absorbs some features of C++ and JavaScript, such as it is a statically typed language, supports inheritance, libraries, etc. In addition to Solidity, the smart contract technology of each platform is also different. Next, we will introduce the technologies adopted by other platforms from the public chain and alliance chain.

Smart contract operation analysis

The function of this Solidity code is to access the _num field. This field is called a “state variable” and is persistently stored by the blockchain. Users can deploy this code on Ethereum or similar blockchains. Successful deployment means that the smart contract can no longer be modified. As long as the underlying blockchain is not destroyed, the contract will always exist. Anyone can call the contract interface through the “contract address”, and the information of each call will be recorded on the chain. Before explaining how this code works, let’s review how a traditional java program works.

First, after the user compiles the java code, Build a token bridge it will be saved on the disk in the form of bytecode; then the user will call the program, which is managed and executed by the JVM; during the execution of the program, the call parameters may be recorded through the log, and the Disk for IO. Solidity’s implementation is similar. The difference is that the medium is changed from hard disk to blockchain, and from stand-alone to distributed. After the code is deployed, it is stored on each node in the form of bytecode. When a user requests to call a function, the call request will be included in the transaction and packaged into a block. Once the entire network reaches a consensus on the block, it means that the call is legal. Next, the EVM will call the bytecode, which is responsible for accessing the underlying state variables, just like traditional programming IO.

Epilogue

This article introduces the concept and historical evolution of smart contracts. Smart contract is a technology proposed in the last century, which has radiated new vitality under the wave of blockchain. On the contrary, the extensive application scenarios of smart contracts have greatly promoted the development of blockchain.

To learn smart contracts, it is recommended to choose Solidity language, because it has the characteristics of some traditional languages. At the same time, the execution environment is completely based on blockchain, and the actual business development experience will be different from the previous programming experience. Readers can try to quickly build a blockchain environment based on FISCO BCOS, deploy a simplest contract, become familiar with the deployment and invocation methods, and then further enter the world of Solidity.


collect
0
avatar
dapps development
guide
Zupyak is the world’s largest content marketing community, with over 400 000 members and 3 million articles. Explore and get your content discovered.
Read more