A smart contract is a special type of instruction that is stored in the blockchain. And that it also has the ability to auto-execute actions according to a series of already programmed parameters. All this in an immutable, transparent and completely secure way.

blockchain smart contracts

En recent years, after the creation of Bitcoin and the launch of its first version in 2009, there have been many interesting projects that have been appearing, 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 they sound familiar to you smart contracts?

Well, this time we will talk in depth about these mechanisms. And is that smart contracts They aim to eliminate intermediaries to simplify processes and thereby save costs for the consumer. Most of the information related to smart contracts is only available in English. That is why, from Bit2Me and after a first chapter in our guide dedicated to making an introduction to smart contracts, we do not want you to be left in doubt, without fully understanding the concept of what smart contracts are and what their potential is. .

That is why we will talk about the origin of smart contracts. Later we will analyze the current situation and thirdly we will present some of the alternative projects to Bitcoin more important. And finally we will describe what the future of this technology is.

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 verbal documents or expensive written documents. These documents are subject to territorial laws and jurisdictions, and sometimes require notaries. In other words, more costs, time and third parties involved in the process. Because of this, they are not accessible to anyone. And this is not the worst: the contents of the contracts may be subject to interpretation. Hold on!

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.

Smart contracts

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, lawyer and cryptographer Nick Szabo who publicly mentioned the term in a document in 1995. Two years later, in 1997, he developed a much more detailed document explaining the 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 trading 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, as 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 statements of the type: 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.

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.

Current situation of 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 previously indicated, of smart contracts. Little by little, new implementations of the smart contracts in Bitcoin but, currently, it is already applied in some functionalities that will probably ring a bell, such as multi-signature purses, where two or more parties must approve the completion of a transaction before the funds are released.

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 carry the smart contracts to new horizons, with full Turing languages, let's get to know some of these new options.

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.

counter party

In Counterparty there is also a token (o cryptocurrency) called XCP. This is used to offer some possibilities that are not technically possible at the moment using BTC (bitcoins).

Although the interest in smart contracts more powerful has been announced since the beginning of the project, it is recently when it has been confirmed that the Ethereum EVM will finally be introduced within Counterparty, which will allow the execution of smart 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, consensus-based voting systems, among others. As of this chapter of the Bitcoin Guide, the Ethereum Virtual Machine (EVM) it is operational only in the Counterparty test network. How is it possible that they could reuse the free software EVM? Counterparty uses the same smart contract programming language, called Solidity.

According to Trevor Altpeter, director of the Counterparty Foundation, EVM will now be able to do everything Ethereum does, only in the blockchain Bitcoin.

In order to execute the contracts, the Counterparty currency, the XCP, is used.

What is RootStock?

Root Stock (RSK), known as Bitcoin's Ethereum, is another platform trying to bring smart contracts Complete turing to Bitcoin to take advantage of the network effect and security of Bitcoin without creating anything 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 will serve only to be exchanged for bitcoins.

Despite being relatively new, Rootstock has already raised $ 1 million in its latest round of funding from the Digital Currency Group (DGC).

Nick Szabo himself has said on his twitter: "the best of Bitcoin (currency and liquidity of the system) + the best of Ethereum (smart contract programming ecosystem)"

RooStock or RSK

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, which is one of the most famous projects in the sector of smart contracts. 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, Etherum has created a much more extensive programming language interpreter (Turing complete), allowing to add much more complex logic within the blockchain. That is, it could resemble a distributed computer, which uses its cryptocurrency (ether) as the "gasoline" that the contract needs so that the miners can execute it. That is, now with Ethereum, contracts are programs with much more functionality and possibilities. Although for this, and this is something that many people criticize them, 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? Below we leave you an infographic in Spanish that could be of interest to you.

ethereum smart contracts

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.

How much do you know, cryptonuta?

Can smart contracts interact with the physical world?


Due to the enormous programming flexibility of smart contracts and blockchain technology, it is possible to make them interact with the physical or real world through different interfaces. One of the most used today is the oracles crypto.

The oracles

We can't forget the oracles. One of the most important characteristics for a Smart contract can interact with the real world, they are called oracles (oracles in English). Oracles are instruments that allow updating the 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 better explain it, let's imagine a smart contract on a football bet, Madrid - Barça, the contract would use an official source as an oracle, for example the website of the Spanish Football League. Depending on the result, the funds are released to the winner. Who needs a bookmaker that keeps a percentage of your money? This would come to 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 and it is this who determines their decision based on what the majority tell them. That is, it decentralizes the obtaining of the result, something great.

A world dominated by Smart Contracts

Can you imagine that, in a few decades, the politicians of the time will be preparing the smart contract for 4 years 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, of course) the smart contract that it wants to use during that new period.

This would guarantee that the vote will be carried out, having full transparency and monitoring of expenses. Something urgently needed, given the times ...

This may be the election in a short time.

This is just the beginning

And so far, for the moment, our journey through this exciting branch of technology blockchain. 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 from the traditional system to save people time and money. Just a few years after the first steps of Bitcoin, only a few will take the trouble to read this text (feel lucky), even fewer will be those who will delve into it and very few will decide to step forward and pass to action. There is everything to do, there are many problems, many things that are malfunctioning, isn't this a unique opportunity to do something?

As soon as one imagines, one can glimpse a tomorrow without large multinationals monopolizing sectors, but transparent codes that live infinitely on a blockchain and are capable of orchestrating the provision of all kinds of services at no cost (or a ridiculous cost compared to current). We are moving towards a global, but distributed world, without intermediaries or large companies, organizing everything at will in the shade. A global world with global services, where smart contracts they have all the ballots of being the seed of an unprecedented change: more than 25 billion devices connected to the Internet are calculated in 2017, all of them capable of running smart contracts between them daily.

This and much more translate the smart contractsNow all that remains is to create simple interfaces that make use of this potential in specific cases. Are you ready for it?