With more and more frequency we hear that concept: smart contracts. The simplest definition in this respect is that they are contracts that have the capacity to be fulfilled automatically once the parties have agreed to the terms. But surely you have in mind the classic signed paper, so how is it possible that a contract can enforce itself? Well, the truth is that smart contracts are a little different from paper contracts.Both are agreements in which two or more involved agree to comply with a series of conditions, and its fundamental elements are the same: the voluntary consent of all the parties, the object of the contract (good or service), and a just cause, true and lawful. However, both differ in three factors: the mode of writing, its legal implication and the mode of compliance.Paper contracts are written in natural language. That is, it is enough to write the conditions and terms in the language involved. If all parties agree, they sign to secure their promise, which leads to their legal involvement: a paper contract has costs. Depending on the jurisdiction where the parties are involved, or under which they want to carry out the contract, it is very likely that they have to meet certain requirements, such as recourse to a notary. On the other hand, its mode of compliance is subject to the interpretation of the parties, which may favor one more than the other.Smart contracts, on the other hand, are computer programs. They are not written in natural language, but in virtual code. They are a type of software that is programmed, like any other software, to carry out a task or series of tasks determined according to the instructions previously introduced. Its fulfillment, therefore, is not subject to the interpretation of any of the parties: if event A happens, then consequence B will start automatically. Its legal implication has fallen -like all the technology related to Bitcoin- in a gray zone. No trusted intermediary is required (as a notary), because this role is adopted by the computer code, which will ensure without doubt the compliance with the conditions. Therefore, significant time and costs are reduced.SMART CONTRACTS, IOT AND BLOCKCHAINHere we can stop for a moment. Smart contracts seem to be a great concept, but how is it possible for software to connect with real assets? Let’s say I want to buy a house and for that I need a contract. A notary can assure me that the seller will give me the property title once I pay what was agreed, but how can that be assured by software? In addition, money management has strong regulations. Do not these affect smart contracts in the same way? And what about computer manipulation? Can not one of the parties manipulate to its benefit the computer where the contract was written or even the code of its software?All these problems were met by its original creator, Nick Zsabo (suspected, by the way, of being Satoshi Nakamoto), when he first proposed the idea in the early 90’s. The technology of that time could not solve these problems , and for that reason the idea was waiting for a better future.Fortunately, that better future, with the consequent technology that allows smart contracts to apply, is already reaching all parts of the world: it is the blockchain or distributed accounting and the Internet of Things (IoT).Let’s review the problems to solve in the last century: computer manipulation, regulatory limitations for money management and the connection of software with real assets. Well, only the blockchain can solve these three problems almost completely.Being an encrypted and immutable database, maintained not only by a computer but by hundreds or even thousands, where you can literally register anything – even a computer program such as intelligent contracts – computer manipulation is discarded. Regarding money management, it must be said that the blockchain has allowed the emergence of cryptocurrencies, a kind of digital and decentralized asset, that is, not linked to any government or entity, available to anyone anywhere in the world without regulations. territorial added; which facilitates the transfer of money. Finally there is the connection with real assets. And while the blockchain can register documents, bonds, stocks, applications and any other type of digital asset, we still have the problem of connection to the house (for example). How the smart contract will work for the purchase of a house?That’s where the Internet of Things comes in. According to an IBM report, by 2020 worldwide there will be more than 34 billion devices connected to the Internet, and at least two-thirds of them will not be computers or mobile phones. They will be everyday objects: from a washing machine and a light bulb to a stove or a lock. And therefore, being connected to the Internet, they can be controlled digitally.FUNCTIONINGLet’s go back to the example of buying the house. Let’s say that Anita wants to buy Bhavana’s house on credit, paying a certain amount of monthly fees. Then Anita and Bhavana use some platform of intelligent contracts ( Smart Contract) to schedule the contract with the established terms. Among them, that Anita will pay X amount before certain date each month, or else the lock on the door of the house will be blocked, and that Bhavana will irrevocably cede the property title registered in the chain of blocks to A when the amount agreed upon is reached. Then the intelligent contract will act, without intermediaries, and will carry out exactly those instructions, literally, without Anita or Bhavana being able to intervene.Now, let’s put another example where more external information is required, such as a sports bet. Let’s say that Anita wants to bet X bitcoin on team C, and Bhavana wants to bet the same amount on team D. They deposit the funds in a smart contract to make sure that, after the result, the winner really stays with them. But who tells the contract which of the teams won?The answer is the oracle. These are computer tools that allow you to update the status of smart contracts with information from abroad, such as the prices of currencies, the quotation of the shares or if the team Anita or Bhavana won. Although, of course, the source of that oracle It is still a third party, an intermediary outside the blockchain and outside the contract and therefore subject to trust. This is a problem to solve, because precisely what you want to eliminate with the smarts contracts and the blockchain is the need for trust. However, there are already options for this: some projects, such as Oraclize, compare information from all the sources that are indicated to determine their validity.Let’s take a last example. Let’s imagine that Bhavana and Anita want to save by means of monthly payments a certain amount in a certain period and spend it on a common product or service. The contract will then block those funds until that amount is reached, but at that moment, what ensures that Anita  or Bhavana  does not withdraw it on their own? This time the answer is not the oracle, but the multifirm function. This allows you to configure the contract so that all parties have the duty to approve a transaction. In this way, only one of them can not dispose of the funds.In conclusion, this is how an intelligent contract works: the parties configure the terms of the contract, this is stored in a specific address of the blockchain, the event contemplated in it takes place (a transaction or received information) and the previously established consequence takes finished.ADVANTAGES AND DISADVANTAGESThe advantages are obvious, and can be reduced to three words: autonomy, security and confidence. Using intelligent contracts, it is no longer necessary to resort to a third party – such as a lawyer or a notary – which, in addition to being prone to errors, causes significant expenses. The blockchain is able to protect the information in an encrypted network that can be consulted from anywhere in the world, so that speed and security are obvious.On the other hand, and like everything in fact, this type of programs also have certain disadvantages, or rather obstacles to overcome. The first consists of the technologies that it uses: IoT and blockchain. While the IoT can allow a true link with real assets, the truth is that it still has a long way to go in security. IoT devices are easily hackable, something that large companies have already joined to solve. The blockchain, on the other hand, is more than secure, but it is immutable. Once the terms are agreed, they can not be changed afterwards, something that is certainly disadvantageous for a contract: Anita can have some inconvenience some month, and then she would stay out of the house without Bhavana being able to avoid it. For this also solutions are being developed: Accenture, for example, is building an editable blockchain.Experts in intelligent contract programming are also not enough to promote mass adoption, and it is even worth mentioning that sometimes they are wrong. These programs are delicate, and if only one error remains in your programming (bug) it is possible for a third party with bad intentions to steal the funds stored in the contract. It happened with DAO sometime ago, but since this is a new technology, such incidents can be common at the beginning.