What are Smart Contracts?
Hello subs! Thank you to the 3 new subscribers who’ve joined Cryptalks on the journey of learning about the future. Our community now stands strong at 40 members. Really stoked to have y’all!
We’ve discussed how blockchain technology works and how bitcoin leveraged it to try to become the digital currency of the world but had to settle for a store of value instead. ☹️
Bitcoin is a 1st generation cryptocurrency that solved for decentralised transactions but it is slow, expensive and unsustainable. As developers started exploring more about blockchain technology, they realised that it can be used for more than just storing transactional data.
This gave rise to a 2nd generation cryptocurrency - Ethereum which had functionalities of allowing users to build an array of applications such as decentralised finance, insurance, NFTs etc. on the blockchain itself. All of this was made possible with the use of Smart Contracts.
A smart contract is a piece of code that can be executed automatically and in a predetermined way. If you have any experience with coding, it works on the principle of an if-else statement i.e if X happens, then Y will happen, else Z will happen. If you did not understand that, let Nick Szabo, the man who coined the term explain it to you with his simple example. They work on the same logic as a vending machine. If you put some money into it and select the snack you want, it’ll return the snack (+ change), else it’ll return your money incase the amount wasn’t sufficient. A useful way of thinking about smart contracts is just to realise that smart contracts are essentially the same as contracts - with the difference that they will automatically execute any actions that parties involved have agreed.
Since a smart contract is built on top of a blockchain, it inherits a couple of the main features. It is immutable (cannot be changed) and it is decentralised (can be accessed by everyone on the blockchain). This means that once a smart contract is deployed, it is tamper proof and since it is distributed, no one can argue against the set criteria. So it basically, they’re designed to remove human error and issues. A trust-less piece of technology for a trust-less generation. Seems apt.
Remember software wallets like Metamask that we discussed in the previous post? Think of a smart contract as a wallet once it is deployed on the blockchain, the only difference being that it isn’t run by humans, it is run by code. It acts as an escrow account between 2 or more parties that want to transact based on predefined conditions.
So how can this ‘piece of code contract’ change your life? Let’s discuss 3 real world applications. Just remember one thing, it’s all about the if-else statements baby.
Insurance - You can create an entire insurance company with just a few smart contracts. All you need to write is something as simple as this; if Karan the farmer has deposited 2 ETH and if the temperature is over 40 degrees for 7 days or more during the year, then give him 10 ETH. You’re probably wondering 2 things right now, where does the 10 ETH come from and how on Earth does the Smart contract know the temperature? Well, the money comes from the investors who created the smart contract and it knows what the temperature is through the use of Oracles; they are sources that provide real world data to any blockchain that requests it. We’ll discuss Oracles in detail when the time is right.
Exchanges - You can exchange one cryptocurrency for another without going through a centralised exchange. Say for example you’ve bought ETH from CoinDCX or WazirX and your friend tells you about a new token X on the ETH blockchain that is not available on any centralised exchange. In this case, you can go to a decentralised exchange like Uniswap and exchange the tokens, earn a profit in X Token and switch it back to ETH later.
Real Estate - Imagine being able to buy or sell a house in minutes, just like you do with stocks today. This is possible with another piece of technology that will work with the smart contract. It’s probably a word you’ve heard recently. NFT - Non-fungible token. For now, think of an NFT as something that can’t be duplicated. Now, the deed of your house is an NFT that’s stored on the blockchain. You set a price and some other criteria for the buyers using a smart contract, if they are met, the deed is transferred to them and your house is sold!
These are just a few easy to understand use cases of smart contracts in the real world. There are countless others and we’ll talk about them in the future.
Happy reading y’all, I’ll see you on the next one. Don’t forget to drop a like if y’all learnt something valuable today. It takes less than a minute and it helps the substack algorithm to show this newsletter to more people! It also low-key (high-key) makes me feel good when y’all show some love. 😜