Do you know that you can create your own ERC20 token from an already existing smart contract on Etherscan? First, smart contracts are open source, permissionless, transparent and trustless. This is what allows the Blockchain space to grow so quickly because developers don’t have to build from scratch. Therefore, you can create and build your project from existing codes.
Shiba-Inu is one of the best-known ERC-20 tokens with a market capitalization of around $20 billion. They kind of branded themselves as the Dogecoin killer, but that’s quite different from Dogecoin. Dogecoin has its own native blockchain, it’s a bit different in terms of technology. Dogecoin is not a token that must rely on the Ethereum blockchain. On the other hand, Shiba-Inu is a token that lives on another blockchain: the Ethereum blockchain.
What we are going to do in this article is understand how their smart contract works, interact with functions, deploy it and create our own token. You can pretty much do this with any other existing ERC-20 smart contract: go to CoinMarketCap to find the token’s smart contract address, click on the address to open Etherscan, search for the contract, copy it , make your own modifications (change name, supply, etc.) and deploy!
IMPORTANT: If this is your first time deploying a smart contract, you will need a few things before you start: 1) a Metamask wallet, 2) getting Gest Ether, 3) knowing some basics about Remix Ethereum. You can get all these details on the article below:
and by the way, this article below also contains really useful information to learn how to properly create an Ethereum token:
Finally, if you want to learn more about smart contracts, check out this course.
Let’s find the Shiba-Inu contract on Coinmarketcap
Search Shiba-Inu on the website. You can copy the deployed contract address of Shiba-Inu as shown in the image below:
Once you click on the address, you will see the token details on Etherscan where you can see the details of the token holders, the total supply created for the token, and even the contract code by selecting the “contract” tab. See below:
One of the ways to find out how the contract works is to deploy it ourselves. All we have to do is copy the contract code from Etherscan and paste it on Remix where we can test the functions and modify them to create our own token.
On Remix, create a new file and name it Something.ground. Copy-paste the smart contract code into the new file.
Make sure the compiler version in the code is the same as in Remix Ethereum.
Following! We’re going to deploy our contract using the Rinkeby testnet (or any other testnet, really).
First, you must have installed a non-custodial wallet, for example metamask. Metamask is the gateway that holds user accounts and also allows us to explore blockchain applications in seconds.
Once the metamask has been successfully installed, go to settings -> advanced -> show test networks. Here you can find the Rinkeby network among others. Now, let’s fund our Rinkeby account. If you don’t already have faucet (test) funds in your Rinkeby account, copy your Ethereum address and you can get faucet funds here.
By the way, if you want to try the Kiln testnet (fusion testnet), check this:
Verify your Rinkeby account on Metamask and Here is! you are 0.1 ether richer!
Agreed! Back to business.
Now let’s deploy or deploy the new ERC-20 smart contract
Let’s go back to Ethereum Remix where you copy-pasted the smart contract code.
To deploy to the blockchain, we need to switch to “Injected web3” and select the “TokenMintERC20Token” file which allows us to create our own ERC20 token and deploy it.
Here we see a list of functions to create our own token… you can edit these functions: you can name it any breed of dog you like, total offer, etc. :
Click on make a transaction. It will ask for your Metamask and you need to click approve and pay the gas fee (in Ether test). Wait a few seconds and once approved…
We hit our “dog” token and can now see transactions on Etherscan. YAY! Congratulations! Was it simple?
Now that you have deployed the smart contract, you can use the left pane of Remix to view functions and interact with the smart contract. Now let’s take a look at each function and understand how they work:
- Approve(): This method gives access to a spender to spend an amount when called. It requires the spender’s address and amount.
- Transfer(): Once a token is approved, the token can be transferred/withdrawn by the spender.
- Transfer from(): Gives the authority for a token to be spent on behalf of the token’s owner.
- Allocation(): the allocation function returns the amount of the remaining token. The spender is authorized to withdraw from the owner’s account.
- balanceOf(): This method gets the current balance of the token by taking the token’s address as a parameter.
- Decimals(): the unit defined by the token owner
- isContract(): confirms the address of the contract
- name(): the name of the token.
- Symbol(): displays the symbol of the token as it is defined in the code.
- TotalSupply(): the total supply of the token as defined in the code.
In the following article, we will deploy another Ethereum token using OpenZeppelin. Subscribe so you don’t miss a thing!
If you like to learn this kind of still, you should also take a look at this: