Introduction to Smart Contracts – How To Create Your Own ERC20 Cryptocurrency Token in 2020

Table of Contents
introduction to smart contracts
Table of Contents

Have you ever wondered what smart contracts are? Well, wonder no more, because in this short video we’ll guide you through all the concepts that you have to know in order to understand smart contracts. First, we’ll show you what a smart contract is, then we’ll show you some pros and cons of a smart contract. We’ll also give you an idea about the application areas of a smart contract. Did we get your attention? Watch our video to find out more!

Welcome to lesson two! Introduction to Ethereum smart contracts.

So what are they? Let’s first have a look at our current legal system and compare it to a vending machine. So right now if you go to a lawyer or a notary you have to pay him and then wait for the document however long it takes the lawyer or the notary to process it.

Here, this is you. You pay the money. Here is the vending machine, which is the lawyer or the notary in this case. Then you wait. And finally, you get what you asked for.

With smart contracts, is a bit simpler. You simply drop a coin into vending machine i.e. public ledger and your document, escrow, or whatever immediately drops into your account. So here you don’t have the waiting circle as before and you also pay in cryptocurrency rather than dollars or whatever fiat currency.

In other words, what ‘Smart contracts’ is really is just a code that automates if this happens do that. The logic of a traditional contract.

So as an example when you put $2 coin in a vending machine you participate in an implicit contract between a vending machine and yourself so if you put $2 you get a coke, so the if condition is the $2 deposit and then condition is that you get the coke. Smart contracts are very similar to that.

 The main difference is that everything happens digitally rather than physically.

Let’s have a look at one of the examples of smart contract. 

On the left side, we have Alice who owns a car and she wants to lend it. On the right side, we have Bob who doesn’t have a car and wants to rent one. 

In this case, a smart contract matches the lender Alice with the renter Bob. 

Once the contract receives the assets, so with digital car key from Alice, assuming that the car can be opened with a key and the payment in cryptocurrency from Bob, it then distributes the assets so Alice gets the payment and Bob gets his car keys. 

So what are some benefits of smart contracts? Well first of all the code behaves in expected ways and does not have the linguistic nuances of human languages. So once it’s set in code you cannot change it anymore.

Also called code is replicated in many computers giving the contract security and immutability. So basically that’s what public legers gives us.  

There are also fewer intermediaries, so for example there’s no need for a lawyer or a notary in a lot of cases, or let’s say if you do a direct transaction like we saw in previous example there’s no need for an intermediary car rental company. 

Of course, it’s just not pros, not just benefits, there’s also cons of smart contracts. Let’s have a look. 

The first one is that in some cases a trusted entity or in other words an Oracle is still required to make smart contracts work. Mostly applies to situations where real-life data is required i.e. damage report for insurance. You can’t just blindly trust somebody submitting his insurance claim and then automatically pay him the money. You still need somebody to have a look at it.

Also, there’s no ability to hide confidential data. For example, if 10 banks set up a blockchain together and two banks made a bilateral transaction, it will be immediately obvious to the other 8 banks that the transaction happened.

Finally, the smart contract needs gas or Etherium in other words to run. If contract runs out of gas all the work that has been done gets reverted. So financial and competition resources get wasted.

Now, let’s have a look at some of the application areas that smart contract enables. 

The first one is Financial Services and to be exact insurance, so a smart contract could perform error checking routing, and approval workflows, and calculate payout based on the type of claim and underline policy.

Another application area is trade clearing and settlement could manage approval workflows between counterparties, calculate trade settlement amounts, and transfer funds automatically. 

Another huge application area is healthcare and to be exact electronic medical records where a smart contract would provide transfer and access to medical health records upon multi-signature approvals between patients and providers.

Another area of application is population health data access where health researchers could be granted certain personal health information and micropayments would be automatically transferred to the patient for participation.

Another really interesting application area is personal health tracking where patient’s health would be tracked through Internet of Things devices such as Fitbit and automatically generate rewards or penalties based on specific milestones, so if you are slacking and you’re not walking as much maybe some amount of money will be taken from your Bitcoin account or your Ethereum account.

Another huge area, which could be disrupted is entertainment. So a smart contract could calculate and distribute royalty payments to artists and other associated parties according to the rules of the contract.

Now, this is going to be a fairly far-scratched example but imagine a future where autonomous electrical vehicle comes to a charging station and pays the station from its wallet using ethereum, for example, Anders charging station processes the deposit, enables the charging, and then returns remaining funds when complete. That’s pretty cool right?!

Next one is logistics where each party in the supply chain could track and audit all the life of product and in a verifiable and trustable manner.

Another really interesting application area is peer to peer transacting where smart contract matches parties and transfers payments automatically based on some conditions, so this enables applications such as peer-to-peer lending, transaction, insurance, energy credits and anything else that is possible using peer to peer transacting.

Now there are dozens and probably much, much more application areas such as such as voting where smart contract validates voter criteria, log votes onto blockchain, and initiates specific actions as a result of the majority vote.

Another interesting area is crowdfunding which is quite known by now even by the general public and it’s a recognized model where a new token is released as part of initial coin offering to raise funds for a specific project.

Another really interesting application area which I am particularly excited about is forecasting. So platforms such as Augur are now being created which are based on the idea of wisdom of crowds where the premise is that opinion or guess of many people gives closure approximation of the truth, then single expert opinion. 

So as you can see there are many, many application areas of smart contracts and it’s a really exciting future that we are heading towards and you can be a part of it too. In the upcoming lessons, we will dive straight into smart contracts coding and start exploring them in full detail.