paint-brush
Create your own Ethereum Token.by@Nico_Vergauwen
16,119 reads
16,119 reads

Create your own Ethereum Token.

by Nico VergauwenJanuary 12th, 2018
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

We are all familiar with ICO’s (Initial coin offering) by now. Many projects rake in millions of $ from investors with the promise of a revolutionary technology through smart contracts that will change the world.

Company Mentioned

Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Create your own Ethereum Token.
Nico Vergauwen HackerNoon profile picture

We are all familiar with ICO’s (Initial coin offering) by now. Many projects rake in millions of $ from investors with the promise of a revolutionary technology through smart contracts that will change the world.

Quite often there is only that, a promise, along with a white paper and a website and the MVP will be developed after the crowdsale. At this stage (and many projects may never get past this stage) the ‘revolutionary’ smart contracts all look somewhat similar and offer no functionality but a crowdsale.

In this article we’ll demonstrate how easy it is to actually make your own ERC20 token for the Ethereum blockchain. Make sure to check out our dApp tutorial as well.


Create your first Ethereum dAPP with Web3 and Vue.JS (Part 1)_Welcome to yet another tutorial! In this tutorial we’ll dive into creating a simple reactive decentralized application…_itnext.io

(This article is for educational purposes only)

Step 1: The ERC20 Interface

In Solidity, the programming language for Ethereum, an interface is a piece of reusable code that defines constraints for functions and events, without implementing the function itself. A contract with the ERC20 interface must have implemented all functions defined in the interface.

Luckily we do not have to write all of this code ourselves and we can just copy it from the following repository: https://github.com/OpenZeppelin/zeppelin-solidity/tree/master/contracts/token

To get started open https://remix.ethereum.org and make two files: SafeMath.sol and ERC20.sol paste in the code below into each of the respective files.

Step 2: Implementing our functions

Great work, or building blocks are almost set. Now we have to implement the functions we have defined in our interface. For this we will combine BasicToken.sol and StandardToken.sol from OpenZeppelin into one file called StandardToken.sol .

Here’s a high level overview of what these functions do:

balanceOf : returns the token balance of an Ethereum address.

transfer : transfers an amount to an address of our choosing.

approve : sets an amount of tokens a specified address is allowed to spend on our behalf

allowance : check how much an address is allowed to spend on our behalf

transferFrom : specify an address to transfer from if we are allowed by that address to spend some tokens.

event Transfer and event Approval will log an output event onto the blockchain.

Step 3: Add your own touch

Congragulations! That was the hardest part. Now all there’s left to do is specify a name, symbol and supply for our token.

Because we tweaked things a little bit we do not have to actually code this! We can just enter the parameters we want when creating the contract in remix. Next to the create button enter a name, symbol, # decimals and total supply in that order (see example below) and press create.

Example

Well done ! You have succesfuly created your first token. Now you can test the functions by sending tokens to the addresses you’ll find in the dropdown menu next to ‘account’ in remix.

You can also deploy this to one of the test networks if you install Metamask.

The full gist can be found here: https://gist.github.com/anonymous/9eabd0015ca7dd431992a522aa8c51cd

Make sure to check out part 2 !


Create your own Ethereum token (Part 2: ERC223)_Part 1: ERC20 Token_medium.com


If you enjoyed this article please leave a tip : BTC — 1DNKXrLfesJ5iN8nbYzbNUejQcshoHCcVV_ETH —_ 0x6d31cb338b5590adafec46462a1b095ebdc37d50_LTC —_ LLC8PWSeDMiH5GLDgVZNq361Lm6iaQNDnj