What is a Smart Contract?

So, a smart contract is basically a piece of code that executes automatically if certain conditions are met. 

Let me explain this concept by using an insurance example. 

The Farmer Metaphor

Imagine a farmer somewhere in the countryside wants to insure his crops against unpredictable weather. 

So, he goes to an insurance provider and gets a rainfall policy. 

If the amount of rain expected for the planting season fails to hit 750 mm, the insurance will compensate the farmer $10,000 to cover his lost production. 

At its core, it’s a type of contract that will only be executed if rainfall conditions don’t meet certain targets. 

Smart contracts work in the same way. They only execute if specific conditions are met.

The big difference is that they can execute automatically - without any additional input from a third party. 

What Makes Contracts 'smart'?

The first key attribute is that smart contracts are considered immutable. This means that they cannot be changed. 

Once the conditions of the smart contracts are set and deployed on the blockchain, they cannot be changed by anyone. 

Even if there is a bug or problem with a particular contract, the most that can be done is to urge people to avoid using it.

The second key attribute is that smart contracts are designed to be trustless

This basically means that the contract doesn’t need to rely on anyone to execute. 

You don't need a lawyer, a third-party company, or any intermediaries to get the ball rolling. As soon as conditions for execution are met, the contract will take care of the rest. 

In fact, the primary advantage of smart contracts is their ability to remove human error and bias when following through with decisions.

And finally, the third key attribute is that smart contracts are distributable and decentralized.

Essentially, once the contracts are deployed on the blockchain, anybody can access them. 

Anybody can see what the terms of a contract are, and the conditions required for them to execute. 

Additionally, for a contract to be executed, it must be validated by a network of decentralized computers. 

This means that a network of autonomous computers will check to see if the conditions are met. 

The contract can only be executed, or in this case - validated, if all or a significant majority of the computers in the decentralized network agree. 

What's in the fine print?

The key to understanding smart contracts is that they execute when certain conditions are met, right? 

But this raises another pertinent question - how does a smart contract actually know these conditions have been met? 

Let’s go back to the initial example I used about the farmer. 

In the example, I said that an insurance provider would theoretically pay out $10,000 if rainfall during a specified time failed to hit 750 mm. 

But how would a smart contract measure rainfall? 

Well, it can’t by itself, and this is why smart contracts rely heavily on something called Oracles. 

Oracles are basically portals, designed to connect blockchains to external systems - so that they can get access to real-time data. 

In the case of the farmer’s insurance example, a smart contract that executes automatically could be connected to the meteorological database, where it would be automatically fed real-time weather data and information. 

This way, the smart contract will know if rainfall conditions were met or not.

So, how do Smart Contract Payments go through?

Now that I’ve explained how smart contracts get their data, you must surely be wondering where the $10,000 needed to pay the farmer comes from, right? 

Well, it’s simple. When a smart contract is created, the $10,000 can be deposited and locked into the contract itself. 

Think of it as an escrow payment. The money can only be released if the conditions of the smart contract are met, which in this case will be rainfall under 750 mm over a specified period of time. 

This $10,000 remains locked into the contract and cannot be touched or used in any other way. 

Another possibility is connecting the smart contract to an external funding source, such as a decentralized autonomous organization or DAO. 

The DAO can provide the necessary funds if and when the conditions of the smart contract are met.

If the conditions are not realized, the money is simply returned to the insurer once the contract expires. 

Real-world uses of Smart Contracts

One area where smart contracts have been used extensively is decentralized exchanges. 

A decentralized exchange is a digital platform that allows users to swap different digital currencies from peer to peer.

In other words, the exchanges allow you to exchange cryptocurrency with total strangers, all without any third-party intermediary. 

How do smart contracts make this happen? 

Well, the contracts define the terms of exchange. 

For example, I can write a smart contract that says 1 ETH token is equal to, say, 50 DOGE coins. So, if a user wants  50 DOGE coins, they must have at least 1 ETH locked into a smart contract. 

On the other hand, a user who wants to swap or exchange DOGE coins for ETH must have at least 50 DOGE coins locked into a smart contract to get 1 ETH. 

As long as these conditions are met, the contract will execute automatically, and each person will get exactly what they were looking for. 

Another area where Smart Contracts are being used is DAOs.

Also known as decentralized autonomous organizations, DAOs are a form of organizational structure that operates purely on smart contracts. 

If you want to learn more about DAOs and how they use smart contracts to offer fully autonomous organizations, you can check out my detailed video on DAOs on this channel. 

With that said, smart contracts may also find additional applications in decentralized finance, including decentralized insurance, in the future.

Are there any issues with using Smart Contracts?

Yes, unfortunately, some problems remain with using smart contracts. 

One disadvantage is that smart contracts, by their very nature, are immutable. 

As I explained earlier in the video, this simply means that once the contract is deployed on the blockchain, it cannot be changed. 

So, even if it is faulty or, meant to exploit people - it will execute as long as conditions are met - like a trap. 

This lack of flexibility can sometimes be a huge downside.

Another disadvantage is that smart contracts still rely heavily on external data to execute. 

This means that if external data becomes corrupted or misrepresented, contracts could end up executing prematurely. 

To make things worse, there is absolutely no legal redress available at present. Once the contract executes, there is nothing you can do to reverse it. 

A final disadvantage is that smart contracts are very simplistic in nature. 

They may not be suitable for agreements that require more nuance and context. Rainfall policies are all very well but complex insurance cases requiring investigation probably wouldn’t work well with smart contracts. 

Conclusion

Put simply, Smart contracts are pieces of computer code that will execute a transaction automatically once certain conditions are met. 

They are immutable, trustless, distributed and decentralized.

Smart contracts rely on trusted, external data sources to work effectively, commonly referred to as oracles.

They’re being used for a variety of decentralized applications, such as exchanges and the basis for DAOs.

Smart contracts still have some issues, including their inflexibility making them susceptible to errors or fraudulent use. They may also be too simple to ever be applied to complex issues.


Leave your comments

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>