Blockchain Ethereum

What Is a Smart Contract and How Does it Work?

what-is-smart-contract

It’s 2018 — even those who are not familiar with blockchain are likely to have heard of Ethereum. Ethereum is the second-largest cryptocurrency with a huge market cap of over $70 billion. To fully understand Ethereum, one should properly understand what is a smart contract.

INTERESTING FACT

But Ethereum is not just a currency; it is also a platform that allows other blockchain applications to be built on it. The Ethereum platform uses a currency called Ether, which is used to pay for transactions.

The Ethereum blockchain works like the Bitcoin blockchain; a network of computers (or nodes) run software which confirms transactions on the network.

Ether works more like fuel than a normal cryptocurrency. In the same way that you need gasoline or diesel for your car, you need Ether to run the smart contracts and applications on the Ethereum blockchain.

I want you to remember all of this as it will help you understand one of the main products of the Ethereum blockchain. This product is called a smart contract, and they are now used by many cryptocurrencies. Because of the growth in popularity that Ethereum has seen, the question ‘what is a smart contract?’ has become one of the most-asked questions in the crypto space just lately.

So, what is a smart contract? Well, let’s take a deeper look…

What is a Smart Contract: What You’re Going to Find In This Guide

The purpose of this guide is to help you understand what is a smart contract and how do smart contracts work.

I understand that “smart contracts” can seem confusing at first. But once I explain them, you’ll realize that they are simpler than you think.

By the end of this Smart Contract Explained guide, you will never have to google “what is a smart contract” again. You’ll understand how and why smart contracts began, the code it uses, how it can be used and why it could change society forever!

Before we get into the more technical stuff, it’s important to talk about the history of smart contracts. Knowing why and how smart contracts were created makes it easier to understand its purpose in the blockchain world.

What is a Smart Contract: When Were Smart Contracts Invented?

In 1994, Nick Szabo (a cryptographer), came up with the idea of being able to record contracts in the form of computer code. This contract would be activated automatically when certain conditions are met. This idea could potentially remove the need for trusted third-party companies (such as banks).

But why? The answer is simple — because you no longer need a trusted third party when you make a transaction. Instead, the contracts (or transactions) are self-executed on a trusted network that is completely controlled by computers.

Cool idea, right? Szabo worked on this idea for many years and even wrote a book called “Smart Contracts: Building Blocks for Digital Free Markets“. The problem was that back in 1994, blockchain technology didn’t exist.

But it does now!

In 2009, Bitcoin introduced the first use of blockchain technology. In 2015, Ethereum was founded by an intelligent young man named Vitalik Buterin, and it introduced the first working smart contracts.

(To learn more about blockchain technology, check out our Blockchain Explained guide.)

What Is a Smart Contract?

I don’t just want to teach you about what smart contracts are, I also want you to remember what they are. So, to do that, I have highlighted three key points that you should read and try to remember about what is a smart contract:


A smart contract is an agreement between two people in the form of computer code. They run on the blockchain, so they are stored on a public database and cannot be changed.

The transactions that happen in a smart contract processed by the blockchain, which means they can be sent automatically without a third party. This means there is no one to rely on!

The transactions only happen when the conditions in the agreement are met — there is no third party, so there are no issues with trust.

What is a Smart Contract: How Does a Smart Contract Work?

Yes, just how do smart contracts work then?

To find the answer, let’s start by looking at how a smart contract can be used:

Let’s imagine that John wants to buy Mike’s house. This agreement is formed on the Ethereum blockchain using a smart contract. This smart contract contains the agreement between John and Mike.

In the simplest terms, the agreement will look like this: “WHEN John pays Mike 300 Ether, THEN John will receive ownership of the house”.

Once this smart contract agreement has been put into place, it cannot be changed — meaning John can feel safe to pay Mike 300 Ether for the house.

Without the use of a smart contract in this scenario, Mike and John would have to pay lots of fees to third-party companies. Including the bank, a lawyer and a house broker.

It’s great, right? No more commissions and no more delays to wait to for a lawyer and broker to process the agreement! This is just one of many examples of how a smart contract can be used.

Smart contracts are automatically executed once the conditions of the agreement are met. This means there is no need for a third party, like a bank, a broker or a government.

How Is This Possible?

As mentioned before, we have the blockchain to thank. Because of blockchain technology, we are able to decentralize smart contracts so that they are fair and trustless. By decentralize, I mean that they are not controlled by one central party (like a bank, broker or government etc.).

The blockchain is a shared database run by many computers (called nodes) belonging to many different people. Because of this, not one single person or company has control of it.

It means it is near impossible to hack it — the hacker would need to hack more than half of the nodes if they wanted to attack the blockchain or the smart contracts that run on it. Therefore, smart contracts can run safely and automatically without anyone being able to change them! Now you know even more about what a smart contact is!

We can finally feel safe when we pay deposits for products or services — there is no trust involved.

What is a Smart Contract: What are Smart Contracts Currently Being Used For?

As I said earlier, Mike & John’s house sale is not the only scenario in which smart contracts can be used. Smart contacts can be used for any type of transaction — it doesn’t have to be financial.

The possibilities are endless for smart contracts. They are already being used for financial trades and services, insurance, credit authorization, legal processes and even for crowdfunding agreements (ICOs).

Let’s look at how smart contracts are already benefiting certain industries and how they will benefit other industries in the future…

Insurance Companies

Two insurance companies, Atlas Insurance in Malta and Axa in France, tested smart contracts in 2017. They had prototypes that compensated airline customers if their flights were delayed.

Let’s see an example:

John is about to fly from NYC to Los Angeles. He sends $5 worth of cryptocurrency to the Axa Insurance smart contract and provides his flight number. Axa send $95 to the smart contract. So, there is $100 in the smart contract.

If John’s flight is on time, Axa are sent $100 from the smart contract. But if the plane is late, $100 is sent to John from the smart contract. Everything is automatic.

This saves lots of time and money. It also means that John does not have to trust that AXA will pay him the agreed amount if his flight is late — he knows that if it is late, the smart contract will instantly send him his compensation ($100).

Health Systems

Health systems will use smart contracts to record and safely transfer data.

encrypgen

We can already see examples of smart contracts being used in the medical industry by the likes of Encrypgen. This is an application that use smart contracts to transfer patient data in a secure way, allowing no access from third parties.

This way, the patients are in control of their own data. If researchers want to use patient data, they must pay for it. Not only that, but the patient has to choose whether or not they want to sell it to them.

Governments

For governments, smart contracts running on the blockchain can make voting systems completely trustless and much more secure.

follow-my-vote

Applications like FollowMyVote use smart contracts and blockchain technology to protect votes from fraud. When the voting transaction is written to the blockchain, it cannot be changed. When the voting is over, the smart contract will send a token to an address that represents the winner of the vote.

This way, the voting is always fair, meaning the winner is always correct.

Business Management

Businesses can benefit massively from smart contracts. Instead of paying staff to run payrolls, they can use smart contracts.

Businesses can just set up a smart contract that says WHEN the date is 28.03.18, the Business sends John 2 ETH. This means John will always be paid on time, and he will never be underpaid. The business benefits because it is all automated, saving them lots of time and money!

ICOs

If you want to start your own project that uses the blockchain, you can build your project on the Ethereum blockchain, as we saw earlier. However, you’re going to need some money!

How’re you going to get the money you need? Welcome to ICOs…

An ICO (Initial Coin Offering) is a crowdfunding system for new applications that use blockchain technology. You create a smart contract, and a token for that smart contract. Let’s imagine you call your token ABC.

You want to raise $10,000,000 to start your project and build your application — let’s imagine that $10,000,000 is equal to 10,000 Ether. You decide you’re going to put 100,000 ABC tokens into the smart contract, and that each ABC token is going to be worth 0.1 Ether.

That way, if you sell all 100,000 ABC tokens, you will have the 10,000 Ether that you need, because 100,000 x 0.1 = 10,000.

Now, in the smart contract, you will write something like: IF 0.1 ETH is sent to the smart contract, THEN the smart contract will send 1 ABC to the address that send the 0.1 ETH. That way, the people contributing to the ICO always get the right amount of ABC token.

Why would people want to buy the ABC token?

The two most common reasons people buy tokens from ICOs are:

  1. The token can be used on the application once it is built
  2. The price of the token may increase when the project becomes more popular

You can think of ICOs as a blockchain version of Kickstarter. The key difference is that it automates the whole crowdsale process in a secure, trustless way.

What is a Smart Contract: How are Smart Contracts Created?

Smart contracts can be built on multiple blockchain platforms, including Ethereum and NEO. As Ethereum is the most popular choice for developers, I will tell you about Ethereum’s smart contracts. (Ethereum being the most popular choice is why you’ll often hear the term ‘Ethereum smart contract’ or ‘Ethereum contract’ popping up on the crypto scene.)

Smart contracts are developed using Ethereum’s original coding language, called Solidity.

If you want to learn Solidity, you can try our Space Doggos interactive solidity tutorial! It’s a fun and friendly way to learn Solidity. By following the steps in the course, you will create your own Solidity game. Check it out here.

what is a smart contract

What is a Smart Contract: How Smart Contracts Will Change the World (Conclusion)

It’s already happening. You can see from the examples I have given that smart contracts are already beginning to replace middlemen. We also saw the potential this has for future applications — remember John and Mike’s house sale? They didn’t need an estate agent, lawyer or bank, did they?

So, if smart contracts fulfill their purpose, perhaps we’ll one day live in a world that is free of middlemen.

What would happen then?

The best thing about having no middlemen is the fact that we save a lot of money. Not only that, but we would no longer need to trust anyone, either.

There is a potential downside, too, though: People may lose their jobs. Middleman are real people, just like you and me. Why would someone pay an employee to do a job that could be done for free by using a smart contract? They wouldn’t.

Of course, no one knows what the future holds. All we can do is guess and predict, but we must be prepared for all possible outcomes.

So, as you can see, smart contracts can make the world a better place that is free of commission. It can reduce fraud, delays and the overall cost of many things. However, as we further advance technology, we remove the need for certain jobs. Now that you’ve read this guide, you should feel comfortable answering the golden question: ‘what is a smart contract?’.

What are your thoughts on smart contracts? Let us know!

1 Comment

Click here to post a comment

More in Blockchain, Ethereum
myetherwallet-review
MyEtherWallet Review: Full & Detailed Guide

Close