Web3: Create Your Own Ethereum Token in Under 5 Minutes
Getting started with web3 development can be a scary thing. There are so many chains, so many terms, and frankly a lot of BS. Couple this with the fact that web3 moves at a faster pace than almost anything else, it’s hard to keep up. In this tutorial we hope to get you up and running so quickly it will still all be relevant info by the time you’re done.
Before we get started, you need to download a few tools:
- NPM: Node Package Manager
- Dapploy: Swiss army knife for smart contracts
- Metamask: A web3 browser extension that acts as a wallet
- Dapper: An app for interacting with smart contracts
Before we start writing any code lets cover some basic terms that we want to make sure you have down. Part of the problem with web3 is that we insist on using new and complicated terms for things that already exist. We’ll do our best to keep this tutorial jargon free!
- Smart Contracts: Code/Scripts that are hosted on a blockchain network’s Virtual Machine
- Ethereum: The most popular blockchain network for developers, it uses the Ethereum Virtual Machine to run smart contracts.
- EVM: Ethereum Virtual Machine
- Solidity: Smart Contract programming Language for the EVM
- Transaction: Any signed messages executed by the EVM that changes state and costs gas
- Gas: The fee to process a transaction on the EVM
- TestNet/MainNet: “Net” in TestNet refers to the network of nodes, miners and wallets. A Testnet mimics the experience of interacting with the MainNet without charging real fees.
Now that we have a better idea of the terms we’ll be using, let’s dive into making our first token, even if it’s only on a Testnet, for now…
Now that we have our tools and terms down, let’s start building our first smart contract! Because we have already installed Dapploy, this is extremely easy. In your terminal, simply type:
dapploy init my-first-coin -s ERC20
This will initialize a new Dapploy project using the ERC20 Token standard. Next you’ll want to cd into the “my-first-coin” repository you just created.
Thanks to the wonderful folk at Open Zeppelin, you’ve just invoked the latest version of their ERC20 standard Token Contract on your local machine. And thanks to the power of Dapper & Dapploy, we are able to customize and publish our token in just a few more steps.
From the root of your folder in the command line run :
This will compile the erc20 contract you’ve just invoked. Once complete run the same command, but with the “-p” flag
Once that’s done you will get a link that looks like this:
Once you have “YOURIPFSHASH” copied, you’ll want to use dapper to interact with it. To do that, simply add your hash to this URL:
Using Dapper, you can now deploy this contract to the testnet!
*If you haven’t already, get some testnet eth from a faucet:
Once you have some testnet gas make sure your MetaMask is set to that testnet, for example the Kovan Net.
Now you can simply click the “Add ABI” button on the bottom of the page to load up your smart contracts into Dapper. The final step is almost too easy, select the “ERC20 Adapter” from the dropdown menu on the left of the screen.
Next you’ll want to click the “Deploy Contract” button underneath the dropdown.
On the right hand side a form should pop up, the only fields you have to fill out are, “Name, Symbol, Decimals, Supply”. (It’s easiest to just set to decimal place to 18)
If you’re confident in your details click “Deploy Contract” and confirm the transaction with your metamask account.
That’s it! You’ve deployed a token to an Ethereum Testnet!
If you want to see your tokens in your wallet you can follow this tutorial to add them to your metamask account: