What Are Smart Contracts Used For?
How Smart Contracts are used to create tokens

Prerequisite: Work through Getting Started With Your First Smart Contract, explaining the basic concepts behind them, and how to write a simple ETH wallet contract.
Now that we know that Smart Contracts can hold, send, and receive ETH, what else can they do?
What Is the Point in Smart Contracts?
The first major use case for Smart Contracts came to prominence in 2017 in the form of tokens. Many of the top 100 coins in play at that time were, in fact, tokens on the Ethereum blockchain. For example, Tron and Binance Coin were both tokens built on Ethereum before they developed their native blockchains.
How Do You Make a Token?
Tokens are defined in Smart Contracts. Once deployed, a Token Smart Contract keeps track of every address that owns tokens, and how many. It also provides functions to let addresses transfer tokens attributed to them to other addresses.
The amount of tokens owned by each person is held in the Smart Contract, not the underlying Blockchain itself, in contrast to ETH. So to find out how many tokens an address has, we need to query the Smart Contract. This is a distinction we need to recognise.
When we’re querying how many ETH an address has, we query the Blockchain.
When we’re querying how many of a Token an address has, we query that Token’s Smart Contract.
Therefore, to know how many ETH and Tokens a wallet has, it needs to know all the addresses of where the Token Smart Contracts are deployed on the blockchain.
Sample Token Code
Let’s assume we want to deploy a token and give it a name, a symbol, determine how many decimal places it has, and the total supply. We want holders to be able to transfer their tokens to other addresses, so we need a transfer function. We also want to be able to query how many tokens any address has.
This is what that contract would look like.





