June 8, 2023
Featured Articles Learn Press Releases

Blockchain and Smart Contracts 101

Polygon-Times-News-Article-Graphic-10

Whether it’s your first time interacting with a DeFi protocol or the 100th time this week, this article is designed to help you learn a little bit about what you’re actually doing when you’re clicking buttons on the screen and collecting ”magic internet money” on a decentralized application like Crystl.Finance!

Many potential DeFi users can be put off by the seemingly “magic” nature of internet money, especially those who are skeptical of its legitimacy. This is something that is incredibly important to overcome if DeFi is ever going to achieve mass-adoption. In this article, we will attempt to give readers an idea of how all the various pieces of a decentralized application fit together!

Let’s start with two little questions!

Where am I?

In this article, let’s assume you’re on the Polygon blockchain, an Ethereum based blockchain that was designed to provide similar services as the Ethereum mainnet. Polygon runs on a side chain with higher throughput, but is quickly growing to be a powerhouse blockchain within the NFT, Gaming, and DeFi sectors. If this sounds like a lot, that’s okay, we’ll explain!

What am I doing?

Using your cryptocurrency “wallet” to interact with smart contracts and decentralized applications.

Brief Rundown On Blockchains

Basics of a blockchain

A blockchain is a type of database or ledger. It tracks information in small blocks of data that are chained together – very creative name, isn’t it? A blockchain is unlike a conventional database that stores a massive amount of information. Rather than being stored on some sort of server, blockchain exists on a multitude of connected computers comprising a decentralized network. You can think of the blockchain as the primary “roadway” that is used in DeFi.

In the graphic above, you can see how transactions are posted to the block chain. Each block’s data contents are validated by a network of decentralized computers, called “nodes” or “validators” before they are posted to the chain. Once a block of data has been confirmed to be accurate by the validators, this data is then posted to the blockchain. The act of validation is incentivized through transaction fees (referred to as gas). After all, why would anyone operate computers for the sake of processing data? Validators are incentivized to operate their computers and provide the processing of data as a service, by earning gas fees paid by users transacting on the blockchain network.

Polygon, Sometimes Still Known As $MATIC

The Polygon network is a blockchain that was constructed to solve the issues of scaling the Layer 1 Ethereum chain. Why you may ask? Well Ethereum has become notoriously known to be extremely expensive as well as quite slow to use. In contrast, Polygon offers miniscule fees and is very speedy for validating transactions.

Wallets

A wallet, much like that leather-bound bad boy ripping a hole in your jeans, is a place for you to store money, but a crypto wallet also lets you interact with smart contracts and also acts as your digital identity.

MetaMask, a popular web based or “hot” wallet, meaning it is always connected to the internet.

The example shown above is MetaMask. For help installing the extension for Chrome (and most other browsers), click here.

As you can see, there is a balance in a number of tokens, the option to send and receive, as well as your wallet’s public key, which is under the title “Ledger 1” (obscured for privacy purposes). It’s important that you know that anyone with your public key can see any of your transactions, and how much of a balance you hold. Be wary! This is a property of the blockchain, a public ledger where anyone can tell which address sent what and where!

A portion of code from an ApeSwap Smart Contract

Smart Contracts

Now that you’ve got a rough understanding of the “roadway” that we’re talking about, we’ll explain the basics of a smart contract.

At its core, a smart contract is a computer program that can execute itself when rules are met. You can tell the computer to exchange tokens for tokens, it can accept deposits and say “reward user X this number tokens per block” based on deposit size, and keep track of your holdings in a special contract address while removing them from your wallet. The possibilities of smart contracts are endless, and they are by far the most exciting thing about DeFi.

You’re probably wondering how they relate to what you see on screen! Below is a rough breakdown of what all of that button clicking you’ll be doing actually does. For example, swapping some tokens at a decentralized exchange (or dex) like ApeSwap.

Above, you can see some of the source code for the ApeSwap router contract, and below is a flowchart of what is actually happening when you exchange tokens by interacting with this smart contract in your web browser!

What happens behind the scenes when interacting with Smart Contracts

A lot of this stuff seems like something you’d never need to know about, but a lot of the beauty of DeFi comes from the ability to audit every single transaction, and follow the footsteps of your money every step of the way. A high degree of comfort can come from knowing where one’s funds are and where they are going!

For instance, when you interact with certain smart contracts, your tokens are moved out of your wallet, and onto the blockchain to gain rewards, like Crystl.Finance Pools, where your tokens are actually removed from your wallet and stored inside of a smart contract on the blockchain to collect rewards.

Once you’re able to grasp what’s actually happening behind the scenes, troubleshooting becomes so much easier, and the fear factor of crypto really does begin to melt away when it doesn’t seem like it’s all magic!

We hope this brief breakdown helps to begin clarifying those basic building blocks, so that you can make more informed decisions about your cryptocurrencies!


Disclaimer: This is a paid press release, PolygonTimes does not endorse and is not responsible for, or liable for any content, accuracy, quality, advertising, products or other materials on this page. Readers should do their own research before taking any actions related to the company. PolygonTimes is not responsible, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with the use of or reliance on any content, goods or services mentioned in the press release.

X