ERC20 rule For Ethereum Blockchain

Ahmad Raza Khokhar
Coinmonks
Published in
2 min readJun 24, 2024

--

Ethereum is a known mostly for its coins but its main purpose was to target the web 3.0 developers. Ethereum provides a robust main-net/test-net layers for programmers, It uses Solidity as a programming language and Remix IDE as a virtual machine and also a code editor.

Community Rules for Tokens

Ethereum community tests and debug the logics for new rule set or you can say the format for tokens code. It has defined the community standards for every developer to follow, you can modify the code but can’t exploid the main rules like (balanceOf(), transferTo(), etc.,). You must be thinking, Who is Ethereum Community? well, if you are a solidity and ethereum developer, then you are also a part of this community!

There are some standards to be set that everyone needs to follow, if you make a token that is against the community rules, that won’t be deployed publicly but can be used only local blockchain.

Common Rules for TOKENS

  1. ERC20 — Fungible Token
  2. ERC720 — Non Fungible Token (NFT)
  3. ERC1155 — Semi Fungible Token

ERC 20 (Fungible Token) code for implementation

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract AhmadToken is ERC20{
constructor(uint256 initialSupply) ERC20("Gold", "GLD") {
_mint(msg.sender, initialSupply);
}
function transferToken(address _to, uint256 _value) external{
this.transfer(_to, _value);
}
function checkOwnerBalance() external view returns (uint256) {
return this.balanceOf(msg.sender);
}
function checkReceiverBalance(address _receiverAddress) external view returns (uint256){
return this.balanceOf(_receiverAddress);
}
}

We can connect this decentralized api to frontend frameworks like React Js, Angular Js, etc., In case of react, the respective stack would be called BERN Stack and for Angular it would be BEAN Stack.

Thanks for reading the article,

Ahmad Raza Khokhar

--

--

Ahmad Raza Khokhar
Coinmonks

A passionate Full Stack Developer. I am expert in MERN Webapps and WordPress Websites development.