Search…
⌃K
Links

What is a smart contract?

Simply put, a smart contract is code that determines the rules for something on the blockchain. Someone who creates a smart contract is creating an application for the blockchain. Of course, most people consider smart contracts in the context of tokens and NFTs, but many others are exploring how smart contracts can be applied in a variety of other situations, like legal contracts, ownership of real-world assets, and record-keeping. For our purposes, we will consider smart contracts as they relate to cryptocurrencies.
You can see the code for a smart contract using a smart chain explorer such as BscScan. For example, you can take a look at the Bridge$ token code here. You’ll notice that there are multiple files of code that make up the contract, and that each file ends in .sol. The file extension .sol means that the code is written with the Solidity programming language.
If you’re familiar with programming, you can take a deeper look into the code and try to understand how smart contracts work. If you’re not someone with coding knowledge, there are still a few things we can take away from here.
The first thing you need to know is that smart contracts cannot be changed once they are deployed on the blockchain. That means that a developer needs to be sure that their code is working before they deploy it. Any fixes or updates would require launching a new smart contract and migrating all of the token holders to a new version of the token.
Next, notice that on BscScan there are two more options next to Code: Read Contract and Write Contract. The smart contract contains functions that allow you to read data or write data to the blockchain, governed by the smart contract’s rules. Read functions don't change the blockchain, and therefore don't cost anything to execute. Write functions are the functions that change the blockchain, and therefore need to be validated. ​An example of a write function would be sending crypto to your friend. All of the information about that transfer needs to be updated on the blockchain in order to move tokens from your wallet to their wallet. It’s hard to understand what all these functions do just by looking at the BscScan interface, and indeed this is mostly only used by developers.
There are some things that you may want to do as a holder though. In the example of Bridge$, you could for example manually withdraw your dividends. Since using BscScan is too complicated for most people, developers build interfaces, such as the Bridges Dashboard, where you can interact with contracts. In fact, that’s exactly what an exchange is.
Whenever you are using a decentralized exchange, you are using a website as the interface to interact with a series of smart contracts that allow you to swap, farm, and more.
In the next section, we’ll talk about the one thing you need in order to interact with smart contracts and the blockchain: a wallet.