A smart contract is a special type of instructions that is stored on the blockchain. It also has the ability to auto-execute actions according to a series of parameters already programmed. All this in an immutable, transparent and completely secure way.
blockchain smart contracts
Tflush the creation of Bitcoin, There have been many interesting projects that have appeared, contributing new ideas and decentralized solutions to many of the centralized processes or applications that we all use today. In that case let us ask you: Do smart contracts ring a bell? smart contracts They aim to eliminate intermediaries to simplify processes and thereby save costs for the consumer.
Get started on Bit2Me and jump into the world of cryptocurrencies with a head start. Register easily and get €15 FREE on your first purchase with this link. Don't wait any longer to join the crypto revolution! Join Now
What is a smart contract?
To understand a smart contract, we must first remember what a contract means. A contract is nothing more than an agreement between two or more parties, an environment where you define what can be done, how it can be done, what happens if something is not done. In other words, some rules of the game that allow all parties that accept it to understand what the interaction they are going to do will consist of.
Until now contracts have been oral or written documents. These documents are subject to the laws and territorial jurisdictions, and sometimes require notaries. That is, more costs, time and third parties involved in the process. Because of this, they are not accessible to everyone. And this is not the worst: the contents of contracts may be subject to interpretation.
Instead, a smart contract is capable of executing and enforcing itself, autonomously and automatically, without intermediaries or mediators. They avoid the burden of interpretation by not being verbal or written in the languages we speak. Smart contracts are “scripts” written with programming languages. This means that the terms of the contract are pure statements and commands in the code that forms it.
On the other hand, a smart contract can be created and called by natural and / or legal persons. But also by machines or other programs that work autonomously. A smart contract is valid without depending on authorities. This is due to its nature: It is a code visible to all and that cannot be changed by existing on blockchain technology. This gives it a decentralized, immutable and transparent character.
Smarts contracts and their enormous potential
With the above, you have surely been able to see the enormous potential that these smart contracts hold. It is important to note that, as it is distributed over thousands of computers, it prevents a large company from guarding them, which eliminates bureaucracy, censorship and the great costs / times implicit in this process that, by the way, until now is the custodian .
If we combine the principles of a smart contract with the creativity of many developers on the planet, the result is possibilities never seen before, accessible to all and at costs that are almost free. Ecosystems without authoritarian figures that submit their members to their will. We are talking about a more just world.
Imagine a self-driving Tesla car, bought in a group, capable of self-managing and renting itself. All this without an Uber-type company behind taking 10%. Of that we can say: Welcome to the world of smart contracts.
The first smart contracts
The first time that public contracts on smart contracts are known is through Nick Szabo, jurist and cryptographer, who publicly mentioned the term in a document in 1995. Two years later, in 1997, he developed a much more detailed document explaining smart contracts.
Unfortunately, despite defining the theory, it was impossible to make it a reality with the existing technological infrastructure. For smart contracts to be executed, programmable transactions and a financial system that recognizes them, digitally native, need to exist.
Precisely what Szabo defined as non-existent in 1995, in 2009 (almost 15 years later) would become a reality with the appearance of Bitcoin and its technology, the blockchain (blockchain).
Bitcoin and smart contracts
Bitcoin has some smart contracts already created that run by default and transparently to the user. When we talk about distribution contracts, we are referring to one of the Bitcoin use cases to form agreements between people through the blockchain. And it is that Bitcoin, among all its advantages, allows you to add logic to money, something unique to this type of money: it is programmable money. This logic applied to money allows us to solve common problems that we may encounter today, but increasing the level of trust throughout the automated process in which the interaction takes place.
Some examples of smarts contracts in Bitcoin
By exemplifying, new products or applications could be developed such as:
- Distributed markets that allow the implementation of contracts P2P y signals in the markets with Bitcoin running as a complete competitor to the current financial system.
- Properties like cars, phones, houses or non-physical elements controlled through the blockchain make up the named smart-property. Through the use of smart property and contracts, the level of trust is allowed to be much higher by reducing fraud, third-party mediation fees and allowing operations to be taken to a new level.
- Automation of inheritances establishing the allocation of assets after death. As soon as death arrives, the contract will come into force and will be executed, in this case distributing the funds to the address established in the contract.
- Insurance: accident reports, company payments for repairs, reduction of accident fraud ...
And is that the smart contracts they use Bitcoin technology to exist, something that is great for Bitcoin, since it is making it receive much more attention by bringing hundreds of thousands of new users to its ecosystem. In fact, it is not difficult to find affirmations of the type: «The smart contracts are killer APP of bitcoin».
This logic that can be applied to Bitcoin transactions is done through the use of all a language own allowing it to be the same blockchain who determines what to do based on the programmed indications. This means that we have a transaction with instructions in a distributed and immutable way, giving complete security and without interpretation.
A Smart Contract is not what you think
Today everything is controlled by computer systems. Everything interacts with them. In application development, it is normal for programmers to create a series of "doors" to their application (called APIs). These doors allow other programmers to enter your application to create or obtain information. Almost all the websites or programs have theirs. That is, a protocol is defined, a contract, a known way in which the application is called with a data structure. It is through this door that we will get an answer, but with the predictable data structure. In this case, so that the communication does not fail and, with it, the programs.
But this contract is not guaranteed. The application server is controlled by someone who has the ability to make the program work differently tomorrow. It is centralized and can mutate to the decision of that third party. It is not "smart".
People need predictable, transparent and incorruptible environments. Smart contracts are pieces of similar codes, that is, they have ways to call them and get answers, they have a contract, but they are also immutable because they are distributed in thousands of nodes. they cannot alter their content. That way you get a program that will always act the same way without requiring the goodwill of that third party. Something that for almost any use case is necessary. Smart Contracts are cloud programs that always act the same, and allow you to store information that cannot be treacherously modified. They are the safest programs ever created in humanity and they only fail when they are poorly programmed.
Badly programmed Smart Contracts
Smart Contracts are capable of managing digital assets, subject to a certain economic value, so in reality Smart Contracts can manage money. This requires that special emphasis be placed on its correct programming, since the Smart Contract could have security flaws or failures that could generate execution errors or unexpected behaviors.
When this happens the money can be lost entirely. It has not happened a few times and without Know-how Enough will continue to happen to many initiatives.
Unfortunately this happens frequently, so it is really important to pay special attention to the development and testing of these pieces of software.
How is a smart contract made in Bitcoin?
For all of this to be possible, there has to be a completely secure process that ensures that at least two parties can execute the contract without needing to trust each other, or even know each other.
Contracts use Bitcoin's decentralized system to enforce financial agreements without reliance on outside agents, such as court systems, lowering the risk of dealing with unknown entities in financial transactions.
Smart contract generation process
There are several steps to creating smart contracts insurance. Let's exemplify with the case of making safe deposits on any web page that accepts bitcoins. Nobody likes to lose their money, right?
Together, all these features not only allow new and interesting financial tools to be built on the Bitcoin blockchain, but since each smart contract is made up of people or machines, the possibilities for innovation in the field of Internet of Things, Insurtech, Logistics, Administration they are so wide that the first few are likely to start coming out very soon killer app or revolutionary applications in these areas.
Steps for generating a smart contract
- The user and the web page send each other a newly generated public key.
- Then the user creates the first transaction without transmitting it, for example putting 5 BTC in an output that requires both the user and the website to sign it.
- The user sends the hash of the first transaction to the web page.
- The portal creates a second transaction corresponding to the contract. In this second transaction, the first transaction is spent and is returned to the user through the address provided in the first step. But since the first transaction required two signatures (user and web page) this operation would not be complete yet. This is where a new parameter becomes important: nLockTime. This can be added in a bitcoin transaction by setting a future date of for example 6 months. Before this date, those funds could not be incorporated into any transaction. The SequenceNumber the input is also set to 0.
- Finally, the entire unsigned transaction would be returned to the user. This would check that everything is correct and that the coins would return to their possession. Of course, after the 6 months that were stipulated with nLockTime. By having the Sequence Number at 0, this contract could be modified in the future if both parties consider it convenient. But of course ... If the administrators of the website disappear, how could the user recover the funds?
- Note that the input script (instructions recorded in each transaction) has not yet finished. The space reserved for the user's signature is still made up of a set of zeros after the portal will create the second transaction. Now only the signature of the user in said contract would be missing.
- From here, after the 6 months that were defined, both the first and the second transaction would be transmitted and the 5 BTC of the first transaction would be returned to the user in question.
Taken together, all these characteristics not only allow the construction of new and interesting financial tools on the Bitcoin blockchain, but also, since each smart contract is made up of people or machines, the possibilities of innovation for the field of Internet of Things, Insurtech, Logistics , Administration are so extensive that it is likely that the first killer apps or revolutionary applications in these areas will begin to appear very soon.
Smart contracts in Bitcoin
Let's not forget that when we talk about Bitcoin we are talking about a new, dynamic and constantly growing ecosystem, but also, as we have indicated previously, about smart contracts.
Along with the multi-signature addresses, the double tanks They are one of the functions that facilitate the proper functioning of smart contracts of this type. It was introduced by BitHalo and is innovative because it eliminates the need for a third party to act as arbitrator. Basically it is that the parties, say for example a buyer and a seller, BOTH make a deposit transaction linked to a smart contract. The contract schedule has a set time before it expires. If the people involved in the agreement do not resolve it in that period of time, the funds from the deposits will be burned, that is, they will be sent to an address where no one knows the private key, forcing the parties to make efforts to maximum in the search for solutions.
Although Bitcoin has a programming language to add logic, there are those who think that sometimes it falls short. This is the reason why solutions have been created that take smart contracts to new horizons, with complete Turing languages.
What is Counterparty?
Counterparty born in 2014. It is a platform open source in which applications can be developed peer-to-peer. Initially they are oriented to the financial sector, on the blockchain Bitcoin: Currently the protocol implements and supports the creation of assets, the issuance of bonds from those assets, the payment of dividends, the trading of assets using a decentralized market, binary bets, and contracts-for-difference (CFD). Its open source protocol, in addition to allowing the creation and operation of digital assets, also allows the writing of smart contracts, allowing it to transform many of the actions in the real world into code that works automatically without the need for intermediaries and is resistant to failures.
In Counterparty there is also a token (or cryptocurrency) called XCP. This is used to offer some possibilities that are not technically possible at the moment using BTC (bitcoins).
Although interest in smart contracts more powerful was announced from the beginning of the project, it was finally announced that it would be introduced within Counterparty the Ethereum EVM, which would allow the execution of intelligent contracts identical to those of Ethereum but on the Bitcoin network, allowing a huge diversity of applications such as Decentralized Autonomous Organizations (DAOs), identity systems, voting systems based on consensus, among others.
What is RootStock?
Root Stock (RSK), known as the Ethereum of Bitcoin, is another of the platforms trying to bring Turing-complete smart contracts to Bitcoin in order to take advantage of the network effect and the security of Bitcoin without having to create something from scratch (it has been published that the platform will also be compatible with Ethereum). It is a platform open source for creating smart contracts that will reward miners who actively participate. Its main objective is to add value and functionality to the Bitcoin ecosystem by activating smart contracts secure online, adding options for instant payments and greater scalability. To do this, RootStock uses side chains, connected to the Bitcoin chain, and its token (Roots), which is only used to be exchanged for bitcoins.
Platforms innovating with smart contracts
Not all projects revolve solely around the Bitcoin network and there are already several alternatives. Ethereum initially stands out and, during 2016, Lisk. Let's go into a bit of detail to describe each of them.
Smart contracts on Ethereum
Ethereum is one of the most famous projects in the smart contract sector. It is a distributed computing platform based on a blockchain public like Bitcoin and that also allows P2P smart contracts to be executed (between nodes, without central servers) in a decentralized virtual machine called Ethereum Virtual Machine (EVM).
It is based on the entire Bitcoin theory of being distributed, having your own cryptocurrency, miners, and even your own blockchain among other things but, unlike Bitcoin, Ethereum has created a much more extensive programming language interpreter (Turing complete), allowing much more complex logic to be added within the blockchain. In other words, it could be similar to a distributed computer, which uses its cryptocurrency (ether) as the "gasoline" that the contract needs so that the miners can execute it. That is to say, now with Ethereum the contracts are programs with many more functionalities and possibilities. Although for this, and this is something that many people criticize, they have had to create a whole new network from scratch, giving up the Bitcoin network (the most powerful in the world).
You can consult, study or copy an extensive list of decentralized applications developed on Ethereum in State of Dapps. Do you want to learn more about Ethereum?
Ethereum 101 Course
Medium levelIn this Ethereum 101 Course you will deepen your crypto knowledge by entering the Ethereum ecosystem and knowing everything about its characteristics, evolution and tools.
Smart contracts at Lisk
Lisk is a platform to create and run smart contracts in a decentralized way, it was launched in 2016 presenting itself as one of the best options to develop safe and fast smart contracts thanks to the use of Javascript (the most used programming language) as the language for the creation of smart contracts, thus becoming an alternative to Ethereum in which the programming language used is Solidity.
After a successful pre-sale of the currency that the contract will need to function (the LSK), in which more than 14,000 bitcoins were raised, Lisk is still in a very early phase but already has several DAPP concepts that are being worked on such as the 'proof of existance' or a social network for artists called Discover.
The oracles
We can't forget the oracles. One of the most important characteristics for a smart contract to be able to interact with the real world, are the so-called oracles. Oracles are instruments that allow updating internal states of a smart contract through information from abroad (generally obtained through APIs): for example, obtaining the price of a share or currency or if a package has been sent by the transport company .
To explain it better, let's imagine an intelligent contract on a soccer bet: Madrid – Barça, the contract would use an official source as an oracle, for example the LaLiga website. Depending on the result, the funds are released to the winner. Who needs a sportsbook that takes a percentage of your money? This itself would be a betting house without commissions, safe and without intermediaries (decentralized).
Oracles also function autonomously. However, keep in mind that the source used by the oracle is a third party that you have to trust, and that it could be corrupted by its owner, cracked, or your server could simply fail, something that has negative implications: we are CENTRALIZING trust, something contrary to philosophy blockchain. Fortunately, there are already projects that are developing solutions to this problem. Outline y Oracle. In essence, they combine the results of all the information providers that are indicated to them and it is they who determine their decision based on what the majority tells them. That is, it decentralizes the obtaining of the result.
A world dominated by smart contracts
Can you imagine that, in a few decades, the politicians of the time spend 4 years preparing the smart contract where they will define how the money will be distributed and the shares they will have? In this way, society should only vote (through blockchain technology as well) the smart contract that it wants to use during that new period.
This would guarantee that what was voted will be executed, having total transparency and monitoring of expenses. That may be the way the elections will be in not a long time.
This is just the beginning
As you have seen, some platforms compete for similar solutions in an environment of constant creativity but all with the same goal: to eliminate friction points of the traditional system to save people time and money. Everything remains to be done, there are many problems, many things that are not working properly. Isn't this a unique opportunity to do something?
We are going towards a global world, but distributed, without intermediaries or large companies organizing everything at will in the shadows. A global world with global services, where smart contracts tThey have all the ballots to be the seed of an unprecedented change. Smart contracts translate into this and much more, now all that remains is to create simple interfaces that make use of this potential in specific cases. Are you ready for it?
Click here to open your user account in Spanish for FREE and securely and receive a €15 gift.