Smart Contracts: What are Smart Contracts in Blockchain? [4 Examples]

What are Smart Contracts in Crypto? : Have you ever heard of 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 well I’d create a page and say that I have a goal of getting one thousand dollars in donations in turn for people donating I’ll give out a book to everyone who donates at least ten dollars. so, I run the campaign and it takes around a week and I come up with thirteen hundred dollars in donations.

Kickstarter will hold that money for me and since I reached my goal of one thousand dollars it’ll give me all of the money that has been donated however if I didn’t reach the one thousand dollar goal because, for example, my grandma didn’t donate or something then I wouldn’t get anything and all that money would be returned to the people that donated it.

What is Smart Contract?

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 the most common smart contracts are written on the Ethereum network using something called solidity.

So let’s go over some examples of purposes of smart contracts you could write a piece of code that says if you give me five Ethereum in turn I will give you 20 basic attention tokens (BAT).

If you have at least 1,00,000 followers by the end of the year 20 Ethereum will be added to your account and if the temperature is over 95 degrees for more than four days in a row this year farmer john’s account will receive 100000 as crop insurance.

Now 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 maybe say 500 Ethereum then we could give each donor a portion of online work. such as an artistic NFT or access to read an online book or even join a community.

The purposes of smart contracts are endless. But when it comes to smart contracts there are two main things that you need to know that makes them beneficial to everyone

1. Immutable

They are immutable this means they cannot change so you remember how I said some people call them if this than that it’s because most smart contracts do something when they get triggered they are basically just coded on the blockchain that gets ran and once it’s on the blockchain it can never be changed now the downside of this you might be thinking is that if there is a bug or the code is inefficient it will be a bug and it will be inefficient forever however if you wanted to you could just create a new smart contract and tell people not to use the old one in fact this happens very often.

2. Distributed

They are distributed which means there are no discrepancies you can’t hire a lawyer and be like that wasn’t our agreement these smart contracts are an agreement between a few parties online that can be automatically executed if certain conditions are met.

Smart contracts are a piece of code designed to remove human error and issues in fact you couldn’t hire a lawyer even if you wanted to the code is on a bunch of computers around the world in fact anyone if they wanted to could see your smart contract and how you participated with it

So now we have financial agreements that nobody can argue because they are codes they don’t change and everybody has access to them now you might not understand what the power of technology like this is but to help you get the hang of it. let’s go over.


What is Flash Loan ?

Flash loan what if I told you that you could borrow 10 million dollars with no money down well on the Ethereum network you absolutely can but only if you write a smart contract that pays it back in the exact same minute that it is borrowed that’s right you can borrow millions of dollars to do something for you on the Ethereum network if you know how to code it so here’s the catch-all of the money must be paid back so you may be wondering why would we want to do this well imagine you could buy some dogecoin for 50 cents on coinbase and then sell it for 55 cents on Gemini you could theoretically borrow 10 million dollars and buy a whole bunch of dogecoin on coinbase and then sell it to Gemini and then pay back the original loan of 10 million dollars with some interest. this is called a flash loan and some guy made 360 000 in a few minutes by creating one of these that did pretty much the example that we just described.

Here’s the kicker the smart contract can check itself it can run 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 and 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.

You could never do this with traditional finance but you can on the blockchain.


Did you know you can create an entire insurance company with just a few smart contracts we would just write something simple like this if farmer john gives us two thousand dollars and if it is more than 95 degrees for four days in a row in texas pay farmer john ten thousand dollars. so this is basically insurance farmer john can be sure that if his crops die from a heat wave the smart contract will know that it happened due to temperature changes and pay him out his 100 000 insurance.

Now you might be asking how the heck does a smart contract a piece of code know what the temperature in texas is well with the help of something called oracles. So oracles are helpful tools to any smart contract essentially they are a trusted source that gives real-world information to anything on the blockchain that requests it now oracles can get confusing so we’ll leave those for another article you just need to know.

They send real-world data to a smart contract now another question you might be wondering is where does the initial one hundred thousand dollars come from well you’d have to imagine that investors who wanted to start that insurance company would have to pool their money together to be able to front it in fact they would have to lock it up in that smart contract whenever farmer john buys it they cannot do anything with those funds until the end of the summer because at that moment the smart contract owns that money then at the end of the summer if the insurance has not been paid out to farmer john the initial investment of one hundred $1000 plus farmer john’s $2000 premium get paid back to the investors now 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 create a pool of money with two different tokens you write smart contracts to allow traders to switch out one token for another token and as one increases in volume you increase the price of the other token this way you keep steady value in the pool. this is roughly how a decentralized exchange works and if you’re curious what that is you can check out our article on uni swap that article explains it beautifully.

You can write a smart contract that says if you give me 20 apples I’ll give you 30 coconuts except the apples and coconuts are Ethereum and basic attention token so a smart contract can allow you to switch tokens token 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 decentralized exchange to swap those tokens.

Buy a House

So if you haven’t already you should read our article on

NFTS because you need to understand those and their purpose to get this example so imagine you took the house or the apartment that you’re living in and you took the deed and you put it on the blockchain it’s not owned by you anymore or the bank in fact 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 instead of going through the usual process that takes weeks you know 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.

Now, 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.


Please enter your comment!
Please enter your name here