Smart contracts are one of PLATINCOIN’s key technologies. They enable hundreds of thousands of our users around the world to generate passive income, maintain projects on Platin Hero and buy goods on PlatinDeal.

In this article, we will not only discuss how smart contracts work, but also look at some possible ways of how they can be applied.

Smart contracts consist of software code that sets the terms of certain deals. There may be two or more parties to such a contract. It works automatically, as the conditions set in the contract are triggered. This is its main resemblance to a conventional contract.

In addition, as in an ordinary contract, the parties agree to comply with the terms, and their agreement is voluntary, and the object of the contract may be the provision of an asset or service. The difference is that a smart contract exists not on paper, but in the form of lines of code that is executed thanks to the launch of the program. However, legally "smart" and conventional contracts are far from equal.

Who invented smart contracts?

In the early 90-ties of the XX century, the American scholar Nick Szabo proposed a new programmatic stage in the development of treaty law. He thought that cryptography protocols could prove useful for conducting commerce through the Internet. Due to implementing electronic security protocols, "smart contracts" could become even more secure than traditional contracts.

Nick Szabo emphasized that the name of the contracts is in no way related to artificial intelligence. Rather, they are similar in principle to a vending machine issuing a glass of sparkling water or small goods in exchange for a coin. Prior to the creation of blockchain technology, such contracts were only a speculative concept. Their rapid development took place only in the first and second decades of the twenty-first century. There are already several specific programming languages designed exclusively for writing smart contracts.

How smart contracts work

As mentioned above, these contracts are code executed automatically. It has input and output data, which can also be financial transactions. BITCOIN already has the ability to write such contracts, but the script code of the first digital currency is very limited in this regard.

The creation of the next digital currency, Ethereum, was a revolutionary breakthrough. It is considered revolutionary because it supports software scripts with Turing completeness. Simply put, Ethereum allows you to operate loops, conditions and other tools that are available in all programming languages. This ability, in turn, gives the possibility to realize a huge number of smart contracts.

Thanks to Ethereum, decentralized applications (Dapp) have emerged. They are all managed by a single protocol, and the blockchain of that cryptocurrency is used as their basis. The fulfilment of these conditions set by the algorithm is a "smart contract", which can function without human involvement.

Pros of smart contracts

In some simple cases, they can already replace lawyers and notaries. Their use eliminates the impact of the human factor while costing significantly less. Data on the blockchain can be accessed from anywhere, only access to the internet is needed. At the same time, cryptography securely protects your data against any interference by a third party. The blockchain itself is stored in a distributed form on many machines on the network.

In addition to being quick and secure, smart contracts are valued for running in an automatic mode. They may be entered into by both natural and legal persons. This reduces the number of middlemen involved in the transaction, and, consequently, the necessary cost of money and time.

Cons of smart contracts

The cons of smart contracts derive from their pros. The program code must be audited so that the parties to the contract are confident of its correct operation. Another drawback is the fundamental immutability of the blockchain that sets too rigid terms of the deal which can no longer be changed. Also, it looks like we won’t see the widespread adoption of smart contracts in conjunction with IoT (Internet of things) devices in the near future.

How do I write a smart contract?

Today, many cryptocurrencies already support smart contracts, but Ethereum is the main one. It uses the built-in programming language Solidity, which has a lot in common with C++. Smart contracts are also written in the less common programming language Serpent. Contracts are compiled inside EVM (Ethereum Virtual machine). They are done decentralized, on all machines in the network, and therefore quite slowly. VIRTUAL gas, which is bought for the Ethereum cryptocurrency, is charged as a fee for the operation.

Applications of smart contracts

If you’re not a technician, you can skip this section. Experienced cryptocurrency users will be interested to learn that smart contracts are based on replicated records and performing hash counts via Merkle tree roots. Thus, the "task of Byzantine generals", an essential part of modern public-key cryptography, is solved quickly and efficiently. Simply put, each peer-to-peer node independently verifies the operation of other nodes so that they cannot engage in malicious collusion.

Applications of smart contracts

The scope of smart contracts is incredibly wide and potentially covers all applications of conventional paper contracts. From now on, payments (e.g. payroll payments) can be programmed to work automatically. The process of registering and changing ownership of any intellectual or physical property can be simplified.

The energy industry is actively developing the use of such contracts for automatic transactions for the supply of electricity. After all, not only people and organizations but also devices and even sensors can enter into smart contracts. The way for automated rental of any property, such as auto or real estate, with automatic payment of the lease in cryptocurrency, is opening up. The principle of smart contracts allows to create new ways of their regular application in economic and social life.