Naveen

Posted on Feb 12, 2022Read on Mirror.xyz

A Case On How Smart Contracts Drive Token Economy

Tokens are arguably one of the most powerful tools in the blockchain right now. A token can be a representation of anything on-chain — be it voting weight, shares in the company, or virtual assets (aka NFTs). A smart contract stores who has what token and how much of it. It also takes care of the business logic of transfers, trades, loans, etc. Tokens are nothing but a mapping of what token belongs to what address (or account) inside the smart contract. So, when you transfer your token to someone else, that mapping changes so that the traded token maps to the receiver’s address.

The beauty of the token representation is that tokens can be transferred/traded from one user to another without the need of any third party, acting as middleman or broker, moderating that everything is fair (given we “trust” the third party) & chopping off a nice amount from that trade as a fee. Ah! the token economy! But how can we guarantee everything will be fair without a trusted third party? That is what Smart Contracts ensure.

Smart Contracts

But, first, let’s imagine a scenario to get the essence of it. Consider you want to purchase & have ownership of a piece of land to build your home sweet home. Now, you have two options -

Case 1: Traditionally, go through some contract paperwork involving a middleman, to put the proof of ownership on paper.

So, you got the real estate for your dream home, eh? You’ve planned everything and are just about to start construction works after a cozy Christmas. But just a week after some shady guy (you could tell by the looks of it!) comes to the plot with authorities to falsify your ownership of land you purchased. This guy claims the land to be his. But you got the papers documents…right? To your dismay, your documents do not convince authorities. It is not in compliance with the official registry of ownership of lands! The official registry is favoring the other guy.

Bad things happen, like this one (at least, where I do live) where you’ve got to trust a third-party person who might be malicious & greedy. Maybe, the broker favored the shady guy, cheating you by registering wrong info, or some ill-natured official got you using forged documents.

Even the best-case scenario here would possibly involve you in a series of lawsuits.

You are rekt anyway 😔.

Case 2: Acquire ownership of land by holding a token that represents that particular land on the blockchain.

Suppose the same shady guy, like in case 1 above, trots to your land again, claiming the ownership with his archaic papers! But, this time you had acquired a token on blockchain representing the land, in your account/address. This is where the fun begins. You quickly sign in to your wallet on blockchain. You query your record from a smart contract that lays the ownerships of lands. To your relief, your account still holds that land token, that you show confidently. And everyone from anywhere can see that this token belongs to an account/address to which you have the key. Smart contracts ensure that as long as you have this secret key (aka private key) of yours, only you can execute/sign the transfer of ownership of land — not some third party or even any authority!

You might be wondering — can’t smart contracts be forged? Almost impossible.

Smart Contracts are computer programs on blockchain and once a smart contract is live on the blockchain at a unique address, it is immutable. No one can change the code to alter it in such a way that it favors any particular entity, not even the developers who coded it.

Even if someone tries somehow to alter the data, they will fail miserably because of the cryptographically secure nature of blockchains. They will have to, in turn, alter every historical data transaction (land trade here) that came before yours, to make sense. It will be like if someone robs your home at night they’ll have to rob each & every person’s home in your country to devour the theft! Not practical, almost impossible. This is why blockchains are referred to as immutable ledger of records. So basically,

‘’Code is the Contract’’

which apart from being immutable, is also public. Anyone can query blockchain to read its code & verify that it isn’t malicious.

In our case, one such smart contract manages the land ownerships & transfers — acting as an absolute source of truth. And since it’s an immutable computer program, it can’t go wacky or greedy someday & compromise everyone’s assets.

Note that smart contracts are not only limited to ensuring and verifying token ownership. It is actually “smart” — or in other words, programmable, automatically executing an operation in response to something without the intervention of any external factor or human motive. What is programmed into an immutable smart contract is up to your imagination & translating that into code.

Smart contracts have enabled all sorts of applications & platforms — mostly decentralized, permissionless counterparts to centralized ones.

These include -

  • DEXs (decentralized exchanges) like Uniswap, Sushiswap, 1inch exchange.
  • Lending Protocols — e.g. Aave, Compound.
  • NFT platforms such as Foundation, Rarible & OpenSea. The land example here best fits in the NFT landscape.
  • The metaverse platforms like The Sandbox and Decentraland.

And this is just the beginning of the new frontiers — many more are yet to come.