Smart Contracts: What’s their Purpose?

Sophie N. Ngouakang
7 min readJan 2, 2023

--

Photo by Maxwell Nelson on Unsplash

Have you ever heard oh Kickstarter? It’s where when you have an idea but you don’t have the money you basically make a page and show off your idea in hopes that other people donate to your project. For example, I might have an idea for a book that explains Cryptocurrency ideas and concepts to kids. Then, I create a page and say that I have a goal of getting $1300 in donations. In return for people donating, I’ll give out the book to everyone who donates atleast $15. So I run the campaign and it takes around a week and I come up with $1500 in donations. Kickstarter will hold that money for me and since I reached my goal of $1300 it will give me all of the money that has been donated. However if I didn’t reach the $1300 goal because for example XYZ didn’t donate or something, then I wouldn’t get anything and all that money would be returned to the people that donated it.

— Author: Sophie N. Ngouakang

A Smart contract is exactly like this, it’s a piece of code that does something if something else happens. A lot of people call it “ if this then that”. The most common smart contrats are written on the Ethereum network using a coding language called solidity. An example of smart contrat is, if you give me 100 likes $50 will be added to your account. If crypto currency exchange is legalized in Cameroon in the next 5 months, cryto trader Fon Joe’s account will receive $10.000 as trading insurance.

It would be really easy to write a Smart contract where people could donate Ethereum to a certain address and then if that contract address reached a certain point like 2000 Ethereum, then we could give each donor a portion of an online work such as an artistic NFT or access to read an online book or even join a community.

Photo by Shubham Dhage on Unsplash

There are two main things you need to know that makes them beneficial to all:

1- They are Immutable

They cannot be changed. Most smart contrats do something when they get triggered. They are basically just codes on the blockchain that gets ran and once it’s on the blockchain, it can never be changed. The downside of this would be that if there is a bug or an inefficient code, it will be the forever. However, if you wanted to , you could just create a new smart contrat in which you tell people not to use the old one.

2- They are distributed

There are no discrepancies. These smart contrats are agreements between a few parties that can be automatically executed if certain conditions are met. They are a piece of code designed to remove human error and and take care of certain issues. In fact, you can’t hire a lawyer denying that this wasn’t the original agreement as the code is on a bunch of computers around the world. Anyone if they want to can see your smart contract and you participate with it. Thus now, we can have financial agreement that nobody can argue because they are codes which do not change and everybody has access to them.

Purposes/ reasons to have a smart contract

The purpose of smart contrats are endless.

- Flash loan

The power of such a technology is similar to that of a flash loan. Imagine that you could borrow $10.000 with no money down. Crazy!? Well this is possible on the Ethereum network only if you write a Smart contract that pays it back in the exact same minute that it is borrowed. Doing so, you could borrow millions of dollars to do something for you on the Ethereum network if you know how to code it. All of the money must be paid back. In a more detailed overview, imagine if you could buy some dogecoin for 50 cents on coinbase and then sell it for 55 cents on Gemini. Hence, you could theoretically borrow $10.000 and buy a whole bunch of dogecoin on coinbase, sell it to Gemini and then pay back the original loan of $10.000 with some interests. In so doing you can make millions in a few minutes. This is called a flash loan. Here’s the kicker, a Smart contract can check itself by running a simulation of what you programmed and it can see if what you told it to do would actually be able to pay back the lender after it does the code. If it can do that, if it can immediately pay back the lender, it runs the code and you can borrow those funds to do whatever you want to do. The blockchain technology is a plus, you could never do this with traditional finance.

- Insurance

Using smart contracts, one can create an entire insurance company. Are you wondering how? Imagine that certain investors who want to start the insurance company, pool their money together to be able to front it. They would lock the money up in the insurance company’s smart contract whenever clients like taxi driver Mike buys it. For example, you could start by writing something simple like: If the taxi driver Mike give us $1500 and if the weather is rainy for 6 days in a row in Douala, pay taxi driver Mike $15.000. This is basically insurance. Taxi driver Mike can be sure that if he has no passengers during the heavy rains as people turn to stay indoors, the smart contract will know that it happened due to climate changes and pay him out his $15.000 insurance. How does a smart contract, a piece of code, know what the weather in Douala is like? Well, here comes the oracles. Oracles are helpful tools to any smart contract. Essentially, they are a trusted source that gets real-world information to anything on the blockchain that requests it. With the help of oracles, real world data is sent to the smart contract.

Back to the initial funds, the investors cannot do anything with the funds until the end of the rainy season, because at that moment, the smart contract owns the entire fund. At the end of the rainy season, if the insurance has not been paid out to taxi driver Mike, the initial investment of $15.000 plus taxi driver Mike’s $1500 premium gets paid back to the investors. Insurance could be and probably is going to be a very profitable use of smart contracts

- Token switching

When it comes to smart contracts, one of the most useful things that you can do is creating a pool of money with two different tokens. Start by writing smart contracts to allow traders to switch out one token for another token and as one token increases in volume, you increase the price of the other token. By so doing, you keep steady value in the pool. This is roughly how a decentralised exchange works. Look into uniswap for better understanding. Tokens switching opens up a whole new world for day traders or investors that want to get into a specific coin that isn’t currently on a major exchange like coinbase. Instead, they could buy a coin that is available and then use the decentralised exchange to swap those tokens.

-Purchasing a house/ an art

Imagine that you took the house or the apartment in which you live and that you took the deed of the said house and placed them on the blockchain. It’s not owned by you anymore or the bank. It’s owned by whoever has the deed on the blockchain. There might be a day where we can use a smart contract to buy and sell a house as it’s done with NFTs. Instead of going through the usual process that takes weeks; advertising the house, securing the funding, using escrow, getting insurance and the dreaded closing, you could just send an offer right on the blockchain and within minutes the other person can accept or deny. If they accept, you immediately own the new deed but the other person immediately has your payment. This would be very useful for anyone wanting to get into the real estate market but are stopped by the high fees or even banks who want to have a higher profit margin on their mortgages. Imagine if you could buy and sell a house as quickly and easily as you can buy and sell a stock. With blockchain that would be possible.

Conclusion

Smart contracts are simply computer programs stored on a blockchain or a transaction protocol that is intended to automatically execute, control or document events and actions according to the terms of a contract or an agreement.

About the author

Sophie N. Ngouakang is a blockchain enthusiast and a Lawyer, passionate about creating an impact in the world to drive blockchain adoption forward. Her blockchain journey began in the early days of the year 2021. Since then, she has enrolled in multiple empowerment programs in the blockchain ecosystem such as the DLT Talents program. After realizing that many people especially in Africa were struggling with getting an understanding of the blockchain technology, she set forth to found — She’s Techie — a tech -think-tank for the sensitization of Africans, women in particular, on blockchain technology. Get connected to Sophie via LinkedIn | Twitter.

--

--

Sophie N. Ngouakang

Attorney-at-Law | Regulatory & Compliance Officer | DLT Talent | NFT Talent | Influencer by DNA| Gobal Ambassador - Women in Tech | Bitcoin Enthusiast