HOW TO CREATE YOUR OWN ETHEREUM CURRENCY

ABHISHEK KUMAR
7 min readJan 20, 2018

--

Here we will create our own Ethereum token that would be viable to sell on an exchange. ICOs are all the rage these days, and I see them as a valuable avenue to raising funds for important projects in the world.

This token will be a standard ERC20 token, meaning you’ll set a fixed amount to be created and won’t have any fancy rules. I’ll also show you how to get it verified.

Let’s get started.

Step 1: Decide what you want your token to be

In order to create an ERC20 token, you need the following:

  • The Token’s Name
  • The Token’s Symbol
  • The Token’s Decimal Places
  • The Number of Tokens in Circulation

Decimal places are where things can get tricky. Most tokens have 18 decimal places, meaning that you can have up to .0000000000000000001 tokens.

When creating the token, you’ll need to be aware of what decimal places you’d like and how it fits into the larger picture of your project.

For me, I wanted to keep it simple and wanted people to either have a token or not. Nothing in between. So I chose 0. But you could choose 1 if you wanted people to have half a token, or 18 if you wanted it to be ‘standard’.

Step 2: Code of the Contract

Here is a contract that you can essentially “Copy/Paste” to create your ERC20 token. Shoutout to TokenFactory for the source code.

//Token.sol
pragma solidity ^0.4.4;

contract Token {

/// @return total amount of tokens
function totalSupply() constant returns (uint256 supply) {}

/// @param _owner The address from which the balance will be retrieved
/// @return The balance
function balanceOf(address _owner) constant returns (uint256 balance) {}

/// @notice send `_value` token to `_to` from `msg.sender`
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transfer(address _to, uint256 _value) returns (bool success) {}

/// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from`
/// @param _from The address of the sender
/// @param _to The address of the recipient
/// @param _value The amount of token to be transferred
/// @return Whether the transfer was successful or not
function transferFrom(address _from, address _to, uint256 _value) returns (bool success) {}

/// @notice `msg.sender` approves `_addr` to spend `_value` tokens
/// @param _spender The address of the account able to transfer the tokens
/// @param _value The amount of wei to be approved for transfer
/// @return Whether the approval was successful or not
function approve(address _spender, uint256 _value) returns (bool success) {}

/// @param _owner The address of the account owning tokens
/// @param _spender The address of the account able to transfer the tokens
/// @return Amount of remaining tokens allowed to spent
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {}

event Transfer(address indexed _from, address indexed _to, uint256 _value);
event Approval(address indexed _owner, address indexed _spender, uint256 _value);
}

You’re going to want to replace everything in the area where it says “CHANGE THESE VARIABLES FOR YOUR TOKEN”.

So that means, change:

  • The token name
  • The token symbol (I’d go no more than 4 characters here)
  • The token decimal places
  • How much you as the owner want to start off with
  • The number of tokens in circulation (to keep things basic, make this is the same amount as the owner supply)

Some things to keep in mind:

  1. The supply that you set for the token is correlated to the number of decimal places that you set.

For example, if you want a token that has 0 decimal places to have 100 tokens, then the supply would be 100.

But if you have a token with 18 decimal places and you want 100 of them, then the supply would be 100000000000000000000 (18 zeros added to the amount).

  1. You set the number of tokens you receive as the creator of the contract.

That’s what this line of code is:

balances[msg.sender] = NUMBER_OF_TOKENS_HERE;

Whatever you set here will be sent to the ETH wallet or wherever you deploy the contract. We’ll get to that in a few.

But for now, just set this equal to the supply so that you receive all the tokens. If you’re wanting to be more advanced with the token logic, you could set it with different rules, like different founders of your projects would receive different amounts or something like that.

Once you have all the variables in, it’s now time to deploy it to the blockchain and test it.

Step 3: Test The Token on The TestNet

Next, we’re going to deploy the contract to the Test Net to see if it works. It sucks to deploy a contract to the MainNet, pay for it, and then watch it fail.

I may have done that while creating my own token….so heed the warning.

First, if you don’t have it already, download MetaMask. They have an easy-to-use interface to test this.

Once you’ve installed MetaMask, make sure that you’re logged in and set up on the Ropsten test network. If you click in the top left where it says ‘Main Ethereum Network’ you can change it to Ropsten or any other test network.

To confirm, the top of your MetaMask window should look like this:

This Wallet is going to be the ‘Owner’ of the contract, so don’t lose this wallet! If you’d like it not to be Metamask, you can use Mist or MyEtherWallet to create contracts as well. I recommend using MM for simplicity, and you can always export your private key to MyEtherWallet for usage later.

Now head to the Solidity Remix Compiler — it’s an online compiler that allows you to publish the Smart Contract straight to the blockchain.

Copy/Paste the source of the contract you just modified into the main window. It’ll look something like this:

Now, go to settings on the right and select the latest release compiler version (NOT nightly), as well as unchecking ‘Enable Optimization’.

So it should look something like this:

Keep note of the current Solidity version in the compiler. We’ll need that later to verify the contract source.

Now go back to the Contract tab and hit ‘Create’ under the name of the Token function that you created.

So you’d hit ‘Create’ under ‘TutorialToken’.

What will happen is MetaMask will pop up asking you to hit ‘Submit’ to pay for the transaction.

Remember, this is the Ropsten test net, so it’s not real Ether. You can double-check to make sure you’re on the test network in MetaMask before you hit submit just to be sure.

When you hit Submit, it’ll say ‘Contract Pending’ in MetaMask. After that, it will show the contract published.

Now go running tab

There u will get create address

I’m going to add that to MetaMask ‘Tokens’ tab:

When I click the “+” button, I can paste it in there and it’ll automatically insert the information of the token, like so

Let’s hit ‘Add’.

Sweet! It says I have the 100 tokens that I created — it worked!

Now I can send those tokens, or sell them on a market if I decide to do so.

Step 4. Get it on The Main Net

Now that everything’s working, it’s time to deploy it on the MainNet and let other people use it.

This part is simple.

Just do steps 3 & 4, but instead of being connected to the Ropsten Test Network, you want to be connected to the MainNet. Make sure your MetaMask account is in Mainnet mode.

You’ll need to fund your contract with real Ether to do this. This cost me ~$30 USD when I did this for The Most Private Coin Ever

You can see how my token is verified by how it has the logo and it doesn’t say “UNVERIFIED” next to it.

Click here to see what I mean

To do this you’ll need to go to the Etherscan Contact Us Page) and send them an e-mail with the following information:

To do this you’ll need to go to the Etherscan Contact Us Page) and send them an e-mail with the following information:

1. Ensure that you token contract source code has been verified

2. Provide us with your Official Site URL:

3. Contract Address:

4. Link to download a 28x28png icon logo:

So yes, you’ll need to have a website with a stated purpose of the token.

They’ll get back to you and let you know if they’ll verify it or not. Remember, Etherscan is a centralized service so it’s very possible that they will not verify your token if they don’t deem it worthy.

You now have a token on the ETH MainNet that other people can use. It’s now primed to be sent to others and received.

--

--

ABHISHEK KUMAR

DevOps/Cloud | 2x AWS Certified | 1x Terraform Certified | 1x CKAD Certified | Gitlab