What are Ethereum Tokens and How Can You Make Your Own?
Ethereum tokens are the backbone of the decentralized finance ecosystem, and may one day be the backbone of the global financial system, however are widely misunderstood. Let’s look at what exactly a token is and how anyone can create their own with zero programming experience.
When Ethereum was released in 2015, one of its most revolutionary features was the ability to create and publish smart contracts on its blockchain. For context, traditional contacts are written in regular language and enforced by the laws of a specific country. This means that people engaging in contracts trust that the legal system and the country they reside in will protect them in the case that one party in the contract does not hold up their end of the deal.
On the other hand, smart contracts are written in code and have self-executing properties, meaning that the correct outcome will always occur if it is programmed correctly. So even if one of the parties engaged in the contract tries to act maliciously, they will be unable to and the contract will execute as intended. There are limitless possibilities for smart contracts and how they can make business, finance, and other industries more efficient, trustless, and secure.
One of the most common uses of smart contracts is to create cryptocurrencies. For example, someone could create a smart contract, and in the code of that smart contract they could write a line that makes them the owner of 100 XYZ coins. When this is published to the blockchain, it will also be published that the owner has given themself 100 XYZ coins. Even though this person simply made up this coin and it has no value, they could now use it for many different applications, like trading with friends, holding as a collector’s item, or even create a company and give out the coin like they are shares in the company. In fact, this is similar to the goal of company tZERO, who are trying to tokenize shares of companies so that they can be traded and exchanged on the blockchain.
Many of the largest cryptocurrencies either started or are still tokens on Ethereum. For example, Tron was only a token on Ethereum’s blockchain until their own mainnet went live. Other examples of tokens include Chainlink, all stablecoins, Shiba Inu, and FTX Token.
Now that we know a bit about tokens and their history, let’s learn how to create our own with no coding experience required.
The first step is to download and setup a MetaMask Wallet. This can be done at https://metamask.io/. MetaMask is a browser-based Ethereum wallet that allows us to interact with the blockchain. When going through the setup process, make sure to write down your private key, as it is the only way to access your wallet if you lose your computer. When the setup is done, your MetaMask should look something like this:
Next, change the network to the Ropsten testnet. Since everything put on the Ethereum blockchain is final and has economic implications, there are test networks where developers can deploy smart contracts with a free version of Etheruem. To do this, click the “Ethereum Mainnet” button at the top of MetaMask, click “show/hide test networks,” and choose the Ropsten testnet.
Now we need to get some of the free Ethereum to use to create a token. To do that, go to https://faucet.dimensions.network/, enter your Ethereum address, and wait 5–10 minutes for the Ethereum to show up in your wallet.
Now, we are ready to code! To start, head to https://remix.ethereum.org, which is an online developer environment for creating and publishing smart contracts. Then, click the “create new file” icon immediately above the contracts folder, and name it “TokenName.sol.” To get the token created, copy and paste the following code in:
//SPDX-License-Identifier: UNLICENSED
pragma solidity >=0.4.22<0.9.0;
import “@openzeppelin/contracts/token/ERC20/ERC20.sol”;
contract TestCoin is ERC20 {
constructor() ERC20(“TestCoin”, “TEST”) {
_mint(msg.sender, 100000000000000000000000000);
}
}
You can change the name from “TestCoin” and “TEST” to whatever you like, as well as modifying the initial supply, which is the large number next to the “mint” function.
Finally, hit control + s on your keyboard to save and compile the code, then click the icon on the side of the screen to open the deployer.
Here, change the environment from JavaScript VM (London) to Injected Web3, and connect your MetaMask when prompted. The final step is to choose the contract you just created from the ‘Contract’ drop-down menu and click deploy.
Now, if you go to https://ropsten.etherscan.io, and search for your address, you will now be able to see your new tokens in your account, and you can do whatever you want with them. Congratulations!
By Lincoln Murr