
Let’s explore:
What ERC-20 tokens are.
How to create and deploy your own token.
Understanding functions like transfer, approve, and allowance.
> It stands for “Ethereum Request for Comments.”
> A cryptocurrency token on ETH that follows a specific standard set of rules.
> All tokens are identical and interchangeable, just like 1USD = 1USD no matter where you are!
Set up the environment (preferably Remix IDE).
Write the ERC-20 contract (using OpenZeppelin’s library).
Breaking it Down.
Deploying on Sepolia Testnet.
Test the token by transferring it between two accounts.
Visit Remix IDE.
Create a new file called Token.sol.
Here’s the code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Importing OpenZeppelin's ERC-20 library
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Token is ERC20 {
// Constructor is run once when the contract is deployed
constructor() ERC20("Web3Book", "W3B") {
// That Mints 1000 tokens to the deployer's address
// 1 Token = 10^18 smallest units (wei)
_mint(msg.sender, 1000 * 10 ** decimals());
}
}Import OpenZeppelin’s Library
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
This gives access to all the standard functions of an ERC-20 token (like transfer, approve, etc.), no more reinventing the wheel!.
2. Contract Declaration
contract MyToken is ERC20 {}
Specifies that our contract inherits all the ERC-20 functionalities from OpenZeppelin library.
3. Constructor
constructor() ERC20("Web3Book", "W3B") {}
Setting the name (Web3Book) and symbol (W3B) of the token.
4. Minting Tokens
_mint(msg.sender, 1000 * 10 ** decimals());
Mints 1000 tokens (with 18 decimals by default) to the deployer’s (our ) wallet when the contract is deployed.
Compile the contract in Remix.
Go to the “Solidity Compiler” tab and click Compile Token.sol.
2. Deploy using Injected Provider (MetaMask).
Switch your MetaMask to the Sepolia network. please!
Go to the “Deploy & Run Transactions” tab.
Select Injected Provider — MetaMask or Use WalletConnect to connect to Metamask and then deploy the contract.
3. Minted Tokens
Now Check your MetaMask wallet — 1000 W3B tokens will appear under the assets section!
You’re rich now! (by knowledge ofcourse!).
Transfer Tokens
Call the transfer function (with correct parameters!) to send tokens to another wallet.
2. Add Token to MetaMask
Copy the contract address and add it in MetaMask as a custom token to view your token balance.
The transfer function is used to send tokens from your wallet to someone else's wallet.
The approve function allows someone (a spender) to spend a certain amount of your tokens on your behalf.
The allowance function checks how many tokens a spender is allowed to spend on your behalf.
It returns the token balance of a given Ethereum address.
This was it for your first very basic Smart Contract!

Let’s explore:
What ERC-20 tokens are.
How to create and deploy your own token.
Understanding functions like transfer, approve, and allowance.
> It stands for “Ethereum Request for Comments.”
> A cryptocurrency token on ETH that follows a specific standard set of rules.
> All tokens are identical and interchangeable, just like 1USD = 1USD no matter where you are!
Set up the environment (preferably Remix IDE).
Write the ERC-20 contract (using OpenZeppelin’s library).
Breaking it Down.
Deploying on Sepolia Testnet.
Test the token by transferring it between two accounts.
Visit Remix IDE.
Create a new file called Token.sol.
Here’s the code:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
// Importing OpenZeppelin's ERC-20 library
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract Token is ERC20 {
// Constructor is run once when the contract is deployed
constructor() ERC20("Web3Book", "W3B") {
// That Mints 1000 tokens to the deployer's address
// 1 Token = 10^18 smallest units (wei)
_mint(msg.sender, 1000 * 10 ** decimals());
}
}Import OpenZeppelin’s Library
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
This gives access to all the standard functions of an ERC-20 token (like transfer, approve, etc.), no more reinventing the wheel!.
2. Contract Declaration
contract MyToken is ERC20 {}
Specifies that our contract inherits all the ERC-20 functionalities from OpenZeppelin library.
3. Constructor
constructor() ERC20("Web3Book", "W3B") {}
Setting the name (Web3Book) and symbol (W3B) of the token.
4. Minting Tokens
_mint(msg.sender, 1000 * 10 ** decimals());
Mints 1000 tokens (with 18 decimals by default) to the deployer’s (our ) wallet when the contract is deployed.
Compile the contract in Remix.
Go to the “Solidity Compiler” tab and click Compile Token.sol.
2. Deploy using Injected Provider (MetaMask).
Switch your MetaMask to the Sepolia network. please!
Go to the “Deploy & Run Transactions” tab.
Select Injected Provider — MetaMask or Use WalletConnect to connect to Metamask and then deploy the contract.
3. Minted Tokens
Now Check your MetaMask wallet — 1000 W3B tokens will appear under the assets section!
You’re rich now! (by knowledge ofcourse!).
Transfer Tokens
Call the transfer function (with correct parameters!) to send tokens to another wallet.
2. Add Token to MetaMask
Copy the contract address and add it in MetaMask as a custom token to view your token balance.
The transfer function is used to send tokens from your wallet to someone else's wallet.
The approve function allows someone (a spender) to spend a certain amount of your tokens on your behalf.
The allowance function checks how many tokens a spender is allowed to spend on your behalf.
It returns the token balance of a given Ethereum address.
This was it for your first very basic Smart Contract!
Share Dialog
Share Dialog
Subscribe to The Web3 Book
Subscribe to The Web3 Book
The Web3 Book
The Web3 Book
<100 subscribers
<100 subscribers
No activity yet