Autonomy and safety. How smart contracts work

How to create a smart contract, what advantages and disadvantages they have. topplabs.org answers all questions about a promising new technology A smart contract is a computer program that fulfills agreements concluded between two or …

How to create a smart contract, what advantages and disadvantages they have. topplabs.org answers all questions about a promising new technology

A smart contract is a computer program that fulfills agreements concluded between two or more parties, as a result of which, when certain conditions are met, certain actions take place. That is, when a previously programmed condition is activated, the smart contract automatically executes the corresponding agreement. If we consider a regular contract and a smart contract, then we can say for sure that they are both agreements in which two or more parties agree to abide by a number of conditions. Their fundamental elements are the same: voluntary consent of all parties, the object of the contract (goods or services) and a single goal. However, both differ in three factors: the way of writing, its legal implications, and the concept of compliance.

History of smart contracts

The term “smart contracts” was coined by software scientist Nick Szabo, probably in 1993, to explain the purpose of implementing what he called “highly advanced” contract law and related business practices in e-commerce into protocol development. Szabo, inspired by researchers such as David Chaum, also believed that developing smart contracts by executing cryptographic protocols and other digital security mechanisms could be a significant improvement over traditional legal contracts.

Szabo used the word "smart" in quotation marks and stated that artificial intelligence would not be involved. He gave a classic example of a smart contract: a vending machine. If the terms of the "contract" suit the buyer (that is, he puts money into the machine), then the machine automatically observes the terms of the unwritten agreement and provides the purchase.

Several formal languages have now been developed and have been proposed for defining the terms of a contract. At the moment, there are many working groups specializing in smart contracts, which are contributing to the continuation of this research in the future. Before the advent of blockchain, there was no platform that could make smart contracts a reality, so it was only defined conceptually.

How do smart contracts work?

Smart contracts are completely digital and written in a programming language. In addition to setting commitments and consequences in the same way as in a regular physical document, code can execute automatically. Consequently, he can receive and process information relating to negotiations, already taking action in accordance with the rules of the contract. BTC is limited in the use of tokens for financial transfers.

The Ethereum platform replaces the more limited BTC language (a scripting language of about a hundred) with a language that allows developers to define their own scripts. Ethereum allows developers to program their own smart contracts. The language is "Turing complete", which means that it supports a wider set of computational instructions.

The Ethereum platform has been used to distribute decentralized applications (DApps). Instead of many applications managed by many protocols, Ethereum allows all applications to be managed over a single protocol.

Ethereum is a platform that allows developers to create any program and run it on the main functions of the blockchain, using smart contracts to automatically perform their actions using predefined conditions built into the algorithm. If the conditions are met, the specified function is automatically terminated without the need to take any action.

Benefits of smart contracts

By using smart contracts, you no longer need to resort to the help of a third party, for example, a lawyer or a notary, which, in addition to possible errors, entails significant costs. Blockchain is capable of protecting information on an encrypted network that can be accessed from anywhere in the world, so speed and security are obvious. The most important advantages of contracts are:

Autonomy

These contracts are always concluded between one or more natural or legal persons, but without intermediaries. A lawyer is not required to confirm the contract. Therefore, the parties reduce and may even eliminate any superfluous person who does not participate in the contract.

Reduced costs

Since contracts are not dependent on a third party, costs are reduced. Less human intervention results in lower costs.

Speed

Smart contracts use code to automate tasks that would otherwise be done manually. Therefore, they increase the speed of business processes and are less prone to manual errors.

Security

By basing contracts on the Ethereum blockchain, they cannot be lost. Everything is unchanging. Nothing and no one can make it disappear, and you always have access to them.

The decentralized governance process eliminates the risk of manipulation, since execution is automatically managed by the entire network, not a single piece.

Disadvantages of smart contracts

On the other hand, programs of this type also have certain disadvantages. The main one is mainly in the use of technologies that it uses: the Internet of things and the blockchain.

The IoT can provide connectivity to assets, but it still has a long way to go in security. IoT devices are easy to hack. The blockchain is more than secure, but it is immutable. Once the terms have been agreed, they cannot be changed later, which is disadvantageous for one of the parties.

How to create a smart contract?

The contract is developed in a specific language (Solidity, Serpent or Mutan), compiled in EVM and, with some exceptions, follows the standard ERC-20 interface. Solidity is a language that is based on JS, Python and C ++.

To approach creating a smart contract, you need to know Solidity. Just like paper contracts are created by people who know the entire legal environment around them, smart contracts need to know computer code called Solidity.

The Lawyer's Introduction to Smart Contracts document describes two “tiers” for smart contracts: the smart contract platform (SCP), which is the infrastructure that allows them to be created and managed on the blockchain, and the smart contract management system (SCMS ). This protocol is added to this infrastructure to make it easier for the user to interact with the contracts. That is, it is a graphical interface.

The contract is executed on the network, inside the Ethereum Virtual Machine (EVM). This performance is not free, but is paid for in the form of "gas", a small amount of ether currency contributed by one or more parties to the contract. An important detail is that the execution is decentralized and takes place at all nodes in the network. This is one of the reasons the EVM is so slow and can only process around 15 transactions per second.

How is the process of registration of smart contracts

The infrastructure of smart contracts can be implemented using replicated records, and the execution of contracts can be done using the Merkle tree, which operates through cryptographic hash functions and Byzantine Generals Task (BFT) replication, which is a generalized task of two generals. Each node in the peer-to-peer network acts as a registry of trust or assurance, making changes to the contract holders and automatically checking the rules imposed by the transaction, as well as verifying the operation of other nodes for the same. Cryptocurrencies like BTC have implemented special cases for those records or nodes where money is the property and core of the transaction. BTC and many of its derivatives contain more generalized mechanisms for property rights and contract execution. Code maintenance is a very important and part of the BTC protocol, based on state machine replication.

How can smart contracts be used?

In the twenty-first century, there is an opportunity to translate all kinds of paper contracts into digital smart contracts, and therefore a wide range of potential applications is emerging.

Payment automation: the contract can be programmed to ensure that the requested amount arrives at the specified time to the specified individuals or organizations.

Registration and change of ownership: The necessary documents can be registered on the blockchain to establish ownership from the start and change ownership through smart contracts.

Energy Transactions: This is believed to create a digital ecosystem for the exchange of energy. Thus, the sources of electricity or fuel will be associated with smart contracts concluded only between individuals or with organizations involved, which, in turn, can personalize the consumption of each client.

Intellectual property: You can embed a smart contract in any object that is digitally controlled. This is where smart property is born that can be assimilated with networked IoT objects. They can range from home to cars. In this way, for example, the rental of these properties can be automated.

Also, cryptocurrencies like Bitcoin can be viewed as a set of smart contracts that enforce property law. Cryptographic techniques are used to ensure that only the owner of the digital token can spend them. Several decentralized asset markets already exist, so many different digital assets can be traded on the same blockchain. The same principle can be extended to physical products with electronic control or embedded microchips.

Financial Services: Cryptocurrencies obviously open up a wide range of different use cases for smart contracts that would not otherwise be possible. For example, systems like the one used by BurstCoin can run auctions that automatically check for the highest price at a given time and automatically transfer inactive funds.

Leave a Comment