Skip main navigation

Smart contracts

Smart contracts are a key concept to understand how blockchain can have many uses in different fields than mere economic transactions.
12.4
The true leap that blockchain made towards the consolidation as a disruptive force capable of affecting the world on a multi-sectorial level, was brought by the smart contracts. But what is a smart contract? It came with the realization that a decentralized ledger able to serve as platform for trading electronic cash, could perfectly be used for other kinds of data, like complex programs or non-financial records. Smart contracts are pieces of code that can be stored in a blockchain, performing complex operations. It’s software with the ability of self-executing when one or many conditions are matched.
46.1
Smart contract is a term used to describe a computer program that is capable of facilitating, executing, and enforcing the negotiation or performance of an agreement, using blockchain technology. The entire process is automated and can act as a complement, or substitute, for legal contracts, where the terms of the contract are recorded in lines of code, as a set of instructions. For better understanding of the concept, see quoted the example that Vitalik Buterin, creator of Ethereum, used to describe the concept.
77.4
“Suppose you rent an apartment from me. You can do this through the blockchain by paying in crypto-currency. You get a receipt which is held in our virtual contract; I give you the digital entry key which comes to you by a specified date. If the key doesn’t come on time, the blockchain releases a refund. If I send the key before the rental date, the function holds it releasing both the fee and key to you and me respectively when the date arrives. The system works on the If-Then premise and is witnessed by hundreds of people, so you can expect a faultless delivery. If I give you the key, I’m sure to be paid. If you send a certain amount in Bitcoin, you receive the key. The document is automatically canceled after the time, and the code cannot be interfered by either of us without the other knowing, since all participants are simultaneously alerted.”
129.3
But how do they really work? What are the steps to follow for effectively design a smart contract and publish it on the blockchain so it can start carrying out its functions?
140.1
The process to be followed is the next: In first place, the contract has to be coded. The programmer has to define the outcome that will be triggered once the contract is executed, and more importantly, what conditions have to be matched in order for this to happen.
155.4
In the previous example: IF the contract receives enough funds THEN the key to the apartment will be sent to the buyer. In second place, it has to be deployed to the distributed ledger. Once the contract is effectively published, it will be allocated in the public ledger, where it’ll be accessible for all the users of the system. Therefore, it will be ready to start sending/receiving funds. Finally, following the rules of blockchain, once the contract has been published, every execution will cause every node in the system to achieve an individual agreement of its results. The network will then be updated with a record of the results of that execution.
194.2
These results will be written and stored in the blockchain, and from that moment single party manipulation will be impossible. All centralized systems are susceptible to be decentralized through the usage of smart contracts. Loans provided by banks, title registries, voting systems, regulatory compliance, and royalties for artists… Virtually anything that requires of a strong security, identification and privacy can be optimized by transitioning to a platform that uses smart contracts.
225.8
Smart contracts have been used in: The energy sector, to issue payments between prosumers and consumers in ecosystems where the first ones sell their excess of energy to the second group. Peer-to-peer have a tremendous potential in decentralizing the energy sector, empowering the consumers and opening the market for competition. Insurances, cutting down administrative costs and reducing the time needed to issue the payment. Also the usage of smart contracts allows to link the software to databases and sensors measuring parameters such as wind speed or magnitude of earthquakes, data that is recorded in the blockchain and triggers the outcome of the smart contract when surpassing the determined threshold.
268.4
Patents and copyright, A smart contract proving the ownership over something secured with copyright, like a song in the music industry, would ensure that the holder receives the royalty fee every time the content is used for commercial purposes. This is also used to secure ownership over real state. Internet of Things, In an era where everything goes towards a global interconnectivity, smart contracts are a key enabler for it. Each contract can call out data for multiple databases, and trigger if needed, the execution of other multiple contracts. Entire processes can be structured through a succession of smart contracts.
303.2
For example, keeping track of a package that has been sent, each sensor forms its own node on a blockchain and smart contracts can record “possession” of the device to each individual sensor, and subsequent location. A barcode / NFC chip / other tracking device on the package will be read at each sensor on the way to your house. Each time it is read by a new sensor, its location is broadcasted to and agreed on by all the IoT participants on the blockchain. As each recording of the package’s location is encrypted into the blockchain in a specific order, there is no securer system for tracking packages.
338.8
A smart contract then keeps tabs of “possession” all the way along the line, solidifying the trust of exactly where to find the package. The tremendous potential motivated that countless smart contracts started getting published in different ecosystems, most of them using different protocols and certainly different cryptocurrencies. In addition, they were written in different programming languages, creating a non-uniformous mass. The sector was calling for unification.
Smart contracts are a great example to understand how blockchain can be used for many other uses than mere economic transactions.
In this video, you will learn what a smart contract is, how it operates, and some of the different applications it has.
A lesson from Grzegorz Bytniewski, FlexiDAO Co-founder, CTO.
This article is from the free online

Blockchain in the Energy Sector

Created by
FutureLearn - Learning For Life

Our purpose is to transform access to education.

We offer a diverse selection of courses from leading universities and cultural institutions from around the world. These are delivered one step at a time, and are accessible on mobile, tablet and desktop, so you can fit learning around your life.

We believe learning should be an enjoyable, social experience, so our courses offer the opportunity to discuss what you’re learning with others as you go, helping you make fresh discoveries and form new ideas.
You can unlock new opportunities with unlimited access to hundreds of online short courses for a year by subscribing to our Unlimited package. Build your knowledge with top universities and organisations.

Learn more about how FutureLearn is transforming access to education

close