How to create a custom ERC20 token?

How to create a custom ERC20 token. A simple instruction by Guarda Wallets

ethereum has become the world’s second cryptocurrency, surpassing some older projects, such as Litecoin. Vitalik Buterin and his team managed to make a revolution in the financial world. The Ether is functional and innovative enough to make a real competition to Bitcoin, despite the fact that the prices of these two cryptocurrencies differ significantly. How did it happen?

The most important step towards recognition was the possibility to create one’s own custom ERC20 token. That gave an opportunity to dozens of projects to see life, though not all of them were destined to reach success.

Moreover, creating a token is a worthwhile task for a specialist familiar with relevant tools.

Let’s take a closer look at the mechanics and programming languages that could be used.

Ethereum smart contracts

The very possibility of creating a token on Ethereum along with a relative simplicity of this process are not the only strong points of the system. There is a number of other advantages, which is why lots of startups prefer ERC20. Smart contract is Ethereum’s highlight. Developed by Vitalik Buterin’s team, it had no analogs at the time of its creation.

The smart contract is an automatically executable program that has opened a way for the decentralization of the cryptocurrency world. In other words, all the decentralized applications and exchanges based on Ethereum token are built on smart contracts. The creation of smart contracts required enormous efforts, and it has paid off: today the system works efficiently.

Token standards

Ethereum ERC or Ethereum Request for Comment is a token standard on Ethereum. It implies technical requirements for a token and a smart contract. There are just a few active supported standards, but there is a significant difference between them. Namely:

ERC20

As you may know, the ERC20 standard token is among the most popular ones today. That’s not very surprising, considering that its offering dates back to 2015.

To meet this standard, a token needs to possess:

* a functionality of the token name,

* a total number of tokens available for turnover,

* an ability to get a balance of a wallet,

* a functionality of transferring cryptocurrency funds between wallets.

Another important feature of tokens on Ethereum is an inability to mine them. If you need a token, or rather a cryptocurrency that miners can mine, you should turn to a different development type.

To successfully create cryptocurrency tokens, you first need to test them. Within the usual test, functionality is not presented, and all manipulations and actions occur with money. However, there are 2 types of blockchain — testnet and mainnet. Testing should be carried out on the first one, testnet, while the second serves as the main blockchain of Ethereum.

ERC223

If there is already a very popular ERC20 standard, why do we need others? In particular, the ERC223? What is it and how does it differ from ERC20?

The functionality, or rather the token requirements of the ERC20, described above, are compatible with and for the most part are the same for the ERC223. Except for one tiny reservation, once proposed by a renowned in a narrow circle developer Dexaran. In a nutshell, he introduced a refund.

One of the biggest dangers that not only beginners, but even experienced investors meet, is an accidental transfer of money and its incompatibility. You can send coins from your Monero wallet to Litecoin and your money will go away — but will not be converted. That’s the problem the ERC223 token solves. It is absolutely compatible with all previous wallets and software, and it serves as a “foolproof”.

ERC621

This standard will definitely appeal to financial managers. After all, it is associated with issuance of additional tokens, as well as their reduction.

For example, during an ICO, you suddenly understand that you have underestimated the market. You realize that you could easily release another million of tokens that investors would grab as hot cakes. Or, vice versa, in your white paper you have indicated that all unreleased tokens would be burned.

The ERC621 token is often considered as extension functions to ERC20 or ERC223 tokens, not as an independent token type.

ERC721

Unlike the previous tokens, the ERC721 represents a unique and irreplaceable item. Do you remember all the famous Cryptokities that collected $20 million in round A? Now they work on the ERC721 token standard. It allows each token to be unique, and individual, not interchangeable.

ERC827

An add-on for ERC20 and ERC223 tokens, which allows you to give access to transfer your tokens on behalf of an external service.

For example, it can be used in centralized cryptocurrency exchanges that don’t have internal wallets in their systems, but simply request permissions to your account. It is something similar to the way Google or Facebook authorization works on external platforms. They give some of your data to an external platform. It could be a monthly subscription to your service provider or a magazine subscription.

Token creation tools

In the earliest days, Mutan used to be a tool to create custom ERC20 tokens. It is a GO-like programming language. However, these days the crypto community actively rejects the tool and condemns its use. Therefore, only three languages can be identified as suitable for work.

  1. LLL, or Lisp-like language. It is considered a tool for creating custom tokens, but it is such only formally. The fact is that it is extremely complex, therefore there are not many specialists who work with it.
  2. Serpent. A Python-like language. Python itself has recently become very popular and is used to develop thousands of different applications. However, in the case of custom tokens and Serpent, the situation is somewhat different. Why? According to Vitalik Buterin’s personal urge, the language is not recommended to use due to the lack of security guarantees.
  3. Solidity. A Javascript-like language. The most popular method for creating custom tokens. It is used to develop smart-contract applications providing fairly high level of security.

These are the three tools that can be used to create a custom ERC-20 token. However, as we have seen, only one of them is widely used. Next, let’s move on to an instruction on how to create a token.

How to create a custom ERC20 token

Creating a token can hardly take a specialist more than half an hour. Are you disappointed? Or inspired? Let’s dive into details.

You will need four main components for development, including:

  1. An Ethereum address in the Ropsten network;
  2. Ropsten-Ethereum;
  3. A text editor;
  4. A smart contract in the selected language.

Since the most common tool for creating custom tokens is Solidity, it will be the focus of our attention. Let’s start from the beginning.

  1. Address registration

A launch of a token is best done in Ropsten. The reason is pathetically obvious — it will help you to avoid the expense of Ether. First, you need to have a wallet on MyEtherWallet. When creating a wallet, you need to choose the Ropsten network. After that, you will be prompted to download the Keystore file and then you’ll get a private key.

2. Ropsten-Ether

You can get enough Ropsten-Ether to work on the https://faucet.bitfwd.xyz/ website. All you need to do is to register and pass a Captcha test. Once you do it, that’ll be sufficient for the work.

3. Text editor and contract

The work will be carried out in a text editor. In this case, it is better to choose either Atom or Sublime Text. They are best suited for this purpose. As for the contract, it must be in the language with which you are going to work. As it’s generally accepted, Solidity is the best.

4. Writing a code

A text from the contract must be copied to the editor. Now you can start the main work (editor’s choice: put on the “Eye of the tiger” to make the process more epic).

  • The name of the smart contract is written in the line number 4.
  • The token symbol is in the line 7.
  • The full name of the token is in the line 8.
  • In the line 6, you need to specify the wallet address in the Ropsten network.
  • Having done that, go to the line 102 and enter the name of your token.
  • Do the same (enter the token’s name) in the line 115.
  • The name of the token and its designation are indicated in the lines 116 and 117.
  • In the rows 120 and 121 replace the address by yours.

That’s it! Don’t forget to save the changes.

5. Contract loading

When the code is ready, you need to go to http://remix.ethereum.org/ . There’s a “ browser/ballot.sol ” field, to which you will need to copy-paste the resulting code. Then you need to go to the “Compile” tab and select “Details”. In the “ByteCode” field click on the “copy” button to save the text in the clipboard.

Then go to MyEtherWallet site. Make sure you have selected the Ropsten network. In the wallet, select the “contract” tab and the “publish” option. Insert the copied ByteCode into the appropriate field. It remains only to sign the contract and publish it.

6. Registration

The final step is to register the token. To do this, go to the “Contact Overview” tab and open the “Contact Address” item. Then look for the code item and choose “Verify and Publish”. Note that this is a step that must be taken very carefully. Any mistake cannot be fixed.

Check _v e r y_c a r e f u l l y_ the following points:

  • the coincidence of the address of the contract with the published address;
  • the coincidence of the contract name with the one specified in line №102;
  • a compiler version.

When you will see the “Optimization” field, select “No”.

You may also be interested in the “Enter the Solidity Contract Code Below” field. Here you need to paste the code from the Remix site. That’s all. Click “Verify And Publish”.

So, if you have done everything right, you’ll see a field that says “Successfully”. That means that your token is successfully registered and you can now use it.

As you can see, that wasn’t really complicated. But, still, it is better to entrust this matter to a professional who knows the code inside and out. That will reduce the risk of error in the token registration — and that’s what we want, isn’t it?

Learn more on our official site https://guarda.co/

We write about essential updates and news around Guarda Wallet Ecosystem