What is a Smart Contract?
To learn more about what a smart contract is, we invite you to read this article with information about the essence of Smart Contracts.
But to recap, let’s say that a smart contract, to this day, is similar to a contract as we understand it legally: an agreement between any two parties in which the terms and conditions of said agreement are regulated with clauses.
It is a computer code that, contrary to what is usual, is not installed on a personal computer or on a server. The code is inscribed in a chain of blocks, or “blockchain”, so that it cannot be deleted or edited.
Among its characteristics stands out the fact that it does not necessarily require a third party to enter into and validate the agreement.
However, this should not be understood as the service being free.
The complete cycle of a smart contract entails a series of costs (that is, processing, energy, programming, etc.) that the parties that make use of the contract will have to assume, for example in the form of a commission of the monetary assets that the contract manages or a usage fee.
Many experts assure that in the future, smart contracts will be able to handle much more complex day-to-day tasks and agreements, to the point that the word “contract” is probably an inappropriate term. But something closer to an intelligent “assistant” or “agent” capable of validating, deciding and executing for us.
In any case, it is one of the most powerful applications of technology, without a doubt.
What are its main advantages?
The computer code is based on very basic premises: if X happens, it executes Y.
Taking an example from real life we can say that if a plane is delayed for more than half an hour, it compensates passengers with 10% of the price of the flight.
In the real world, these types of agreements involve paperwork. And oftentimes the use of physical supports leads to delays and inefficiencies and increases the possibility of errors and fraud.
That is where the advantages of blockchain come in: the terms of the transaction are written in a computer code located in the blockchain and cryptographically signed by the intervening parties, which will be executed when the expected conditions are met.
Everything is on “blockchain”, which means that it is transparent for all parties, and unchangeable.
Thus, you can do business and transactions with strangers without the need for a third party to act as a trusted intermediary or as a validator.
All participants handle the same information at the same time and paperwork is eliminated, time is reduced and the risk of fraud and misunderstandings is almost 100% eliminated.
But… What about its weak points?
Immutability is an advantage, but it can also be a problem.
Once the smart contract has been written on the blockchain it cannot be modified so easily, and this can sometimes cause problems.
Another aspect to consider is the transparency of the blockchain.
In other words:
Do companies want their competition to be aware of the conditions of their Smart Contracts?
And what about consumer data protection?
One of the main problems is the fact that it is not enough for companies to encrypt user data and upload it to the “blockchain”. Because they would be in breach of the Data Protection Law.
The solution would be to separate the data in a repository in which personal information did appear and that could be related to what was written on the blockchain only by the company in question.
It is a solution, but… there is a risk that this repository will be “hacked”.
In the future, another possible solution to solve this risk would be the use of decentralized storage systems with IPFS (InterPlanetary File System), a new Internet protocol that allows creating distributed applications.
Security is precisely the other great concern in everything that has to do with computer code. What is on the blockchain cannot be “hacked”, but errors can occur with very serious consequences.
And what happened with The DAO is a serious warning.
The DAO was an autonomous and decentralized organization (its name comes from the initials in English of these three words) that raised the equivalent of 160 million dollars in the cryptocurrency ether to invest in projects of the decentralized economy.
Everything worked through smart contracts, but the problem arose when a hacker found an error in the computer code, and used it to keep part of the funds. The promoters reacted by creating an ether spin-off and thus managed to minimize part of the theft. Nonetheless, it is estimated that the hacker eventually took hold of approximately 2 million dollars.
How is a Smart Contract made?
To better understand how to create a smart contract, we are going to use an example in which the insurance deposits of any website that has Bitcoin.
Now, the steps to carry out a smart contract with this example are:
- User and website share a newly created public key.
- The user makes the first transaction without transmitting it by sending a certain amount of Bitcoins to an output that requires both him and the website to sign it.
- The user sends the hash (cryptographic operation) of the first transaction made to the web.
- The website carries out a second transaction that corresponds to the contract, in which the first is spent and returned to the user through the address given in the first step. However, since the first transaction required two signatures (user and portal) the action would not be completed yet. So a new BlockTime parameter is needed. It can be added to a Bitcoin transaction by placing a long-term date of, for example, a few months. Before that day, the funds cannot be used in any type of transaction.
- The completely unsigned transaction is returned to the user to verify if everything is in order and that these coins would return to their possession; this after the months that were estimated with the new parameter.
- Then, we need to take into consideration that the input script (rules programmed for each transaction) has not finished yet. The space reserved for the user’s signature is still filled with several zeros after the website carried out the second transaction. So the user’s signature would be missing.
- From this moment and after the months that were specified if both the first and the second transaction and the Bitcoins of the first transaction would be transmitted, they would be returned to the user.
The characteristics of this type of contract have not only allowed new financial tools to come to light in the Bitcoin Blockchain. Also, since the contracts are made up of people or machines, innovation is allowed in the Internet of Things, Logistics, etc. So, it will not seem strange that new apps begin to appear on these aspects.
The role of Solidity
Smart contracts are not written the same as traditional contracts. The former are programmed by computers and, therefore, the code or language used to develop them is called Solidity.
It refers to a computer language program that allows complex problems to be solved and has the possibility of carrying out certain tasks based on specific instructions.
These codes have been named as the complete Turing language, as it is developed for procedures with high computing power.
Smart Contracts in Bitcoin
Bitcoin already has several smart contracts developed that operate directly and transparently to the user.
Among the benefits of Bitcoin is the ability to add logic to money, making it “programmable money”.
This is what allows users to solve common everyday problems. But in addition, trust will be increasing through the automated process in which the interactions typical of a contract are carried out.
Examples of Smart Contracts in Bitcoins are inheritances, insurance, and properties such as cars.
Other Smart Contract Platforms
Not everything revolves around BitCoin. There are two platforms that are innovating using smart contracts.
We describe each one below.
Lisk makes it easy for developers to create new dApps with a commonly used developer action.
That is why Lisk has created a blockchain network that provides developers with all the resources they need to develop decentralized applications and put them in the hands of users.
In 2015, the launch of Ethereum made blockchain technology more accessible than ever.
Before Ethereum, users had to fork the source code of an existing blockchain or develop a new blockchain protocol from scratch to implement the technology. Both tasks are extremely difficult, lengthy and expensive.
Ethereum solved these problems with the introduction of EVM (Ethereum Virtual Machine), which allowed the adoption of blockchain technology without the need to fork or create a blockchain.
Simply put, EVM is a decentralized method of processing code. Any developer can submit the code to the EVM, and assuming the developer pays the required fees, the network will execute that code as instructed.
These bits of code sent to the EVM are known as smart contracts.
While smart contracts can be programmed to perform any number of functions, the underlying concept is the same for all of them: submit the code and required fees; then the EVM will process the contract exactly as designed.
Smart contracts are the best way to make complicated processes simpler and to ensure automated compromise between the parties to an agreement.
The future of how common services will be handled is already showing the first clues with this type of contracts and BitCoins. For this reason, being aware of its operation is essential to not be left behind.
New platforms begin to be added to make the most complex processes much simpler and the options open up in various areas of the users’ daily lives.
Are you ready for the change?
If you need advice on this and other issues related to blockchain technology, do not hesitate to contact us.
Also, if you want to know more information about this and other topics related to blockchain and others, stay tuned.
Until next time.