Smart Contracts: Code Is Law

5 14
Avatar for NinjaWingnut
2 years ago

In a previous post, Blockchain: What’s A Blockchain?, I mentioned that there was something called smart contracts, that I would revisit in a later post. Well, now is the time to roll up our sleeves and have a closer look at these fancy bits of code that exist on blockchains and provide lots of cool functionality.

For the usual disclosure, I am not a financial advisor, I don’t even work in finance at all. My day job is as a telecommunications software engineer. Treat everything you read here as some educational resources and not financial advise. Some of the links you find on here will also be affiliate links, so using them will benefit the both of us.

What Are Smart Contracts

Simply put, a smart contract is simply a bunch of code that has been stored on the blockchain to be executed. Once they are there, they are immutable and cannot be changed. Once deployed, they run autonomously and can be reused as many times as necessary. They also run in a trustless way and are generally very secure.

They have quite a few uses out in the crypto world, from providing decentralized exchange functionality, liquidity funding pools, decentralized finance applications, and can even be used for things like charities.

Smart contracts are also able to read and utilize real world data, like the market price for a crypto, by using things such as Oracle services. This allows outside, real world data, to affect how a smart contract operates.

Smart Contracts Example

Let’s take a pretty basic look at what kind of functionality a smart contract could be used for and why it would be better than a traditional manner. Let’s say Bob and Karen have decided they want to exchange 200 BOB tokens for 200 KAREN tokens.

If Karen and Bob both trust each other, they could send each other their respective tokens and be on their way. But this relies on them trusting each other. In the traditional way, to mitigate this risk, you move that trust onto a 3rd party like some kind of escrow system. This of course carries it’s own risks, as you now need to trust a 3rd party. There are also generally fees associated with this kind of undertaking. Usually, there is quite a lot of time involved in this process as well, and who wants to wait around?

Now, using a smart contract, we can make this a simple and fast process. We setup the code so that when Bob and Karen both deposit their respective tokens into the contract, the conditions are met and the contract will send the tokens off to their respective recipients.

No third party is involved to take a cut of the deal, or run off with your funds. As long as the code is well written, the risk in doing this transaction is quite mitigated.

Benefits Of Smart Contracts

There are quite a lot of benefits to using a smart contract. As mentioned above, they run autonomously, so you don’t have to worry about business hours, or people’s availability. They run in a deterministic way, you know ahead of time exactly what outputs you will get for what inputs you provide. They also don’t require you to trust another person, only trust the code behind the contract.

The transaction speeds that you can get for using a smart contract is as fast as the underlying networks block speed. You don’t have to rely on the speed of a 3rd party, as soon as the conditions of the contract are met, it executes.

Traditional contracts and using things like escrow have significant fees, while smart contracts don’t. You don’t have to worry about fraud, as no people are involved to commit it. Any crypto involved in the transaction are easily validated on the block chain, so no counterfeiting.

Smart Contract Risks

There are of course some risks involved in smart contracts, namely software bugs and hackers finding ways to exploit them. There have been a number of recent news articles out about smart contracts being targeted and drained of funding.

That being said, there are companies out there that audit smart contracts, so whenever you are looking at using one for something, it’s always best to look into the contract itself. Who is the team behind it? Was it forked off another project? Have there been any attacks carried out against the underlying codebase? If the contract is using real world data, is it coming from a reliable source?

While there are a number of risks involved in smart contracts, they are not any more risky than anything else in the crypto game. It’s all about managing your risk.

Conclusions

I hope this introduction into the world of smart contracts helps you to understand what these fancy little bits of code that exist out on the blockchain can do for you. They provide a large range of functionality, and if you can’t find one that does what you want, you can always go and write your own.

If you enjoyed this content, come back every Monday through Thursday for fresh Crypto content. If you have any comments or questions, feel free to email me a ninjawingnutcrypto@gmail.com, use the Contact form, or hit me up on TwitterFacebookInstagram or Telegram.

You can also sign up for my weekly newsletter to receive fresh new crypto content to your inbox every Friday!

Missed some of the earlier posts, here are some related ones I think you’d enjoy:

Getting Some Free Starter Crypto
Moving Average: Technical Analysis Part II
A Guide To Spot Trading

Reposted From My Website: https://ninjawingnut.xyz/2021/06/01/smart-contracts/

2
$ 0.00
Avatar for NinjaWingnut
2 years ago

Comments

I will read, and re-read this again until I truly get it enough to be able to explain it myself. Thank you because it's stumped me before but you distilled it simply.

$ 0.00
2 years ago

Glad I could help out! Some of this tech can be pretty complex

$ 0.00
2 years ago

Very, very complex especially if your brain is not wired for it. hahaha

$ 0.00
2 years ago

Well, if you have any questions, let me know and I'll do my best to answer them for you!

$ 0.00
2 years ago

Thanks! I will probably take you up on that offer.

$ 0.00
2 years ago