DEV Community

Temiloluwa Akintade
Temiloluwa Akintade

Posted on

Issue #8: Smart Contracts

A Blockchain revolution...

If you are conversant with the web3 ecosystem, chances are that you would have interacted with a decentralized App (dApp), you have a crypto wallet, own some tokens and have probably even made crypto transfers.

All of the aforementioned functionalities are made possible through Smart Contracts. What are the Smart Contracts?

Smart Contracts are rules that live on the Blockchain, these rules govern interactions with the Blockchain and are enforced by code.

As I have explained in previous issues, the Blockchain is a Decentralized network where data is shared across multiple nodes, each node holds a "ledger" that keeps track of the data and changes to it, each page (block) in this ledger is cryptographically linked to it's previous block, forming a "chain of blocks".

Smart Contracts are programmes on the Blockchain, the code is stored across nodes and to change this code, you'd have to change it across a majority of the nodes to change the terms of the contract. This makes smart Contracts tamper proof, the terms of the contract cannot be changed, once deployed.

Smart contracts are trustless, this means that you do not have to "trust" the other party in an agreement, you just have to trust the code, the same code will always produce the same result under the same circumstances, the same cannot be said about humans.

Take a look at this analogy, you and 3 of your friends run a grocery store, and you all agree to split the yearly proceeds 80/20, 80% is shared equally among the four of you while 20% is reinvested into the business.

You need a bank account, and one of you is appointed to be the Chief Financial Officer (CFO), he is in charge of finance, acts as the signatory to the joint account and he splits the 80/20 revenue pro rata. In this case, you all "trust" him not to screw you over and you are trusting the bank to always manage your funds and not freeze your account.

If he does not act honestly, he could forge the yearly revenue and present reduced revenues and go home with much more at the end of the year without your knowlege. The bank also could block access to your funds for some reason or deduct ridiculous amount of "charges" as per a joint account, we all have kind of been there before.

Smart contracts can tackle both these problems at once by being a trustless third party between your business and your funds. A smart contract can be built and configured to split the revenue at the end of the year 80/20, keep 20% and distribute 80% equally among the four business owners. Also, the funds in the contract are secure because all four of you can be "signatories", meaning that only one person does not have the sole power to move funds, at least 2-3 people need to sign a transaction before funds are moved. Furthermore, there is no no bank to act as the bridge or "manager" of your funds.

Interestingly, the contract is publicly available, and anyone with an internetconnected device can see it and ehatever happens within it, no one is oblivious to what is happening in the system.

See how smart contracts create a decentralized, self-executing and trustless system? That is the power behind DeFi protocols, Decentralized Autonomous Organizations (DAOs) and many blockchain applications. No need to trust a party or system, you trust the code that powers it.

Smart contracts are written with programming languages, popular ones being Solidity, Vyper, Rust. Solidity is popular within the Ethereum ecosystem and I will be starting a YouTube series soon on building smart contracts with solidity.

Top comments (0)