How to create a token?

¿Cómo crear un token?
10 min read

If you are passionate about cryptocurrencies and blockchain technology, you will already be aware of all the tokens that have come on the market since the beginning of bitcoin until today.

So much so that we can say with great satisfaction that, as of today, there are almost 5,000 different tokens on the market. 

If you didn’t know, now you have found out. And it would also be good for you to know that there are several kinds of tokens. The main ones are:

  1. Governance tokens
  2. Platform tokens
  3. Security tokens
  4. Transactional tokens
  5. Utility tokens

If like me, you have wondered a thousand times how to create a token and if it is too difficult to launch your own digital currency in the crypto market, today I will have the pleasure to delve into the subject and perhaps help you launch what will be the most popular token in modern history. Are you ready?

Difference between cryptocurrency and cryptographic token    

Before getting to the point, it is important for you to know that in the world of cryptocurrencies there are several types of crypto assets and there is more than one difference between cryptocurrencies and crypto tokens. Let’s see what they are.

CRIPTOCURRENCIE: First and foremost, cryptocurrencies are assets that have their own blockchain or transaction log. A key example is Bitcoin which has its own blockchain, protocol and token (BTC).

TOKEN: On the other hand, tokens use another blockchain instead of their own. A popular example is ERC20 tokens that use the Ethereum (ETH) blockchain.

So why are some assets tokens and not cryptocurrencies? The answer is almost obvious… surely it is much easier to build on an existing platform than to build one from scratch. 

In other words, if you decide to create a cryptocurrency, you will have to do it by creating your own blockchain and this will take a lot of work, time and costs. On the other hand, creating a token from scratch is much faster and easier since it is created on an existing platform.

How to create your own token

So, if you don’t want to create your own blockchain, the most practical solution is to develop a token using an existing blockchain, such as Ethereum or Bitcoin.

Before launching into the development of your token, you will have to have a purpose, that is, your token will have to bring value to the crypto ecosystem or it will be destined to fail. Along with this point, you will have to build a community that follows you and believes in your project/purpose and, finally, you will have to have some technical knowledge to know and understand how your token has to work.

Once you are clear on these points, you will need to decide on which platform to launch your token. Most tokens come created on the Ethereum blockchain as ERC20 tokens, because Ethereum was the first to offer this service.

Another popular platform that allows you to use its blockchain to create applications and tokens is NEO, which uses the NEP-5 Standard token. 

The advantage of Ethereum is that it is the most popular platform for creating tokens and is trusted, whereas with NEO you can use a wide variety of programming languages, including C++ and Java, while Ethereum only allows you to create tokens using its own programming language: Solidity.

In the following paragraphs we will show you how to create a token on the most popular platform for token creation: Ethereum.

How to create a cryptographic token step by step

To create your token in Ethereum you will need to:

  1. Implementation of a new Smart Contract 

Download the Ethereum wallet, Mist, which also allows you to mine or develop ERC20 tokens.

Once you have downloaded and opened Mist, fill it with ETH funds. 

Go to the WALLETS tab, click on the “CONTRACTS” tab and then click on “Deploy New Contract”. Where it says “Select Contract to Deploy”, click on the drop down menu and select “MyToken”.

Enter this code in the Source code field of the Solidity contract that appears:

contract MyToken {

/* This creates a matrix with all balances. */

mapping (address => uint256) public balanceOf;

}

Where “Mapping” links balances to addresses, which are in hexadecimal format (e.g. 0xab7c74abC0C4d48d1bdad5DCB26153FC8780f83E) and “Public” means that anyone will be able to see the token balances of other addresses.

  1. Decide on the supply of your token

After the code added above, you will need to add another line of code indicating the supply or limit of tokens you want to be created:

function MyToken() {

balanceOf[msg.sender] = 2100000;

}

The number that is underlined indicates that you want a token supply of 21 million, but you can change it and configure it as you wish.

You now have a smart contract linked to your token.

  1. Enable the sending of your token

Now you will have to configure the token so that it can be sent. So, add this code to the end of the Solidity Contract Source Code field:

/* Send coins */

function transfer(address _to, uint256 _value) {

/* Checks sender for balance and overflows */

require(balanceOf[msg.sender] >= _value && balanceOf[_to] + _value >=

balanceOf[_to]);

/* Add and subtract new balances */

balanceOf[msg.sender] -= _value;

balanceOf[_to] += _value;

}

This code allows you to send, add (to the receiving addresses) and subtract your tokens (from the sending addresses). In addition, to prevent users from sending more tokens than they have, a line of code is added to check if the sender has a balance and if there are overflows.

  1. Configure the name, symbol and decimal units of your token

To change the name, symbol and decimal units of your token, add this code:

/* Initializes the contract with initial supply tokens for the contract creator. */

function MyToken(uint256 initialSupply, string tokenName, string tokenSymbol, uint8 decimalUnits) {

balanceOf[msg.sender] = initialSupply; // Gives the originator all initial tokens

name = tokenName; // Configures the name for display purposes

symbol = tokenSymbol; // Configures the symbol for display purposes

decimals = decimalUnits; // Number of decimal places for display purposes

}

  1. Create a token transfer event

To let ETH wallets know when transfers of a token are made, add an event via the following code :

event Transfer(address indexed from, address indexed to, uint256 value);

In addition, add the following code (the red text) to the transfer function in step 3 to notify you with a notification that the transfer took place:

/* Send coins */

function transfer(address _to, uint256 _value) {

/* Checks sender for balance and overflows */

require(balanceOf[msg.sender] >= _value && balanceOf[_to] + _value >=

balanceOf[_to]);

/* Add and subtract new balances */

balanceOf[msg.sender] -= _value;

balanceOf[_to] += _value;

/* Notifies all listeners that this transfer was performed */

Transfer(msg.sender, _to, _value);

}

If you want to copy the full code to create an ERC20 token on the Ethereum platform, you can copy it from the Github page and save it in a text editor.

6. Launch your token!

If you’ve made it this far, you’re in luck, you can now launch your ERC20 token!

All you need to do is set up a fee to send your token contract transaction, and, once your token is active, click on the Send tab in Mist to send your token to whomever you want. 

Create a token with MetaMask

There is another option to implement and launch your new token and that is by using the MetaMask wallet instead of the Mist wallet.

Once you have downloaded the MetaMask extension in your browser, you will have to put inside an amount of ETH, as we did with Mist, to pay for the deployment of the contract.

In this case, you will have to copy the smart contract code that we placed earlier in the  Remix main window.

Click the “Execute” tab, so that the Smart-Contract can be implemented on the Ethereum blockchain. The total number of tokens defined in the Smart Contract Code must be associated and maintained in the MetaMask Wallet.

By clicking on “Deploy”, the Smart-Contract can be deployed. Once the transaction has been confirmed by the Ethereum Blockchain, the number of tokens issued should appear in MetaMask Wallet, ready to be sent to any ETH wallet.