In this article, I will give you a recipe to create your own simple cryptocurrency with little effort and pretty much no programming experience! To keep things straightforward, we will be using Ethereum based ERC-20 token. ERC stands for Ethereum Request for Comments. To learn more about ERC-20 standard take a look at this wiki page. We will be creating AMANCOIN (ticker AMAN) with unlimited original supply. I’ll peg one Ether (ETH) to 2,000 AMAN for first two weeks of ICO (bonus for early adopters!) and 1,000 AMAN thereafter. Essentially, once the contract has been deployed, you could send Ethers to the Contract Address and get AMANs instead at the above rate.
Alright, so here are the ingredients you need for this recipe:
- Metamask: Metamask is a browser-based wallet and has extension available for all major browsers including Chrome and Firefox. To get started with Metamask watch this. Quick tip: Store your wallet seed at a secure location! I’ll be using Chrome for this tutorial.
- Remix: Remix is an IDE (Integrated Development Environment) for Solidity – Ethereum contract language. If you’ve any programming experience think Eclipse but for Solidity instead of Java. Else, just consider it as an editor we will use to edit our smart contract.
- Smart Contract: You can clone the smart contract code from Git or just download zip from here.
- Ethereum Wallet: We will use MyEtherWallet to create a new wallet. This will be used to store all our ethers.
Now that you have all the ingredients let’s start cooking:
- Create Ethereum Wallet Address: Go to MyEtherWallet and create a new wallet. Make sure you select Network Rinkeby (etherscan.io) on top right corner (see screenshot). There are detailed steps on how to do that. Generally speaking, below are the three main steps:
- Enter a password. Hit Create New Wallet.
- Download Keystore file. Hit I understand. Continue.
- Hit Print Paper Wallet and save it as a PDF. You don’t want to take screenshot here because we’ll have to copy the address and private key.
2. Import account in Metamask using recently generated private key by clicking Import Account.
3. Request test Ethers from Rinkeby faucet: We will be deploying our contract to Rinkeby (not the Stockholm subway station), which is a test net for Ethereum. You can pretty much follow the same steps for deploying contracts on Ethereum Main Net if you are interested in releasing an actual Initial Coin Offering (ICO). Only difference is you would be spending real Ethers to deploy your contract on main net. Since I ain’t no wanna spend my real Ethers, we will stick to Rinkeby. In order to get test Ethers you need to make a social media post (facebook or twitter) containing your wallet address. Copy link to that address and paste it on the faucet to request some test Ethers. Once you’ve ethers in your account it will look as follows.
4. Next, you need to make changes to the code you just downloaded. Replace “amancoin” in line 82, 96, and 98 to your `tokenName`. Change symbol in line 97 to your coin symbol.
5. Alright, we’re all set to deploy our contract! Head to http://remix.ethereum.org/ and paste the code you just modified. Click on Run. Change environment to “Injected Web3”. The beauty of MetaMask is it will automatically sync your account address and Rinkeby test-net as soon as you select the environment. Change function to be deployed from dropdown to your `tokenName`. Hit deploy! Click submit if MetaMask pop-up shows up.
6. Now, that you’ve deployed the contract. Click on Contract Address link and you should see something like this:
7. Next, Click on Code tab, and hit Verify and Publish. Be careful with entering all the details on this page, because contracts are as rightly said by Sir Vitalik are:
a. Make sure the contract address is same as the one you created.
b. Update Contract Name to `tokenName`.
c. Compiler can be extracted from remix url. Most probably it will be v0.4.24+commit.e67f0147.
d. Select No for optimization.
e. Copy all the code in amancoin.sol to Solidity Contract Code.
f. Hit Verify and Publish.
If everything went well and your contract is verified. You’ll get a page like this:
Yay! You did it!
Yo Dawg, you own your own currency now!
For testing, you can transfer Ethers by creating another test account to your Contract Address. You can also send me some test Ethers. My contract address (on Rinkeby test-net) is: 0x2D5F12668ac6aD3f70C133321BD99E0814AD2074
You can also add custom token on Metamask by using Contract Address. This will add your token as currency in MetaMask wallet. For example, I transferred 2 Ethers to the ICO address and got 4,000 AMANs in return!
References:
Get freshly brewed hot takes on Product and Investing directly to your inbox!