Author

Topic: create your own erc20 cryptocurrency - full guide (Read 65 times)

member
Activity: 966
Merit: 14
Tontogether | Save Smart & Win Big
Thanks for sharing the knowledge for free. But honestly, not everyone would want to create a token. Speaking for myself, I don't have that kind of ambition of owning an ERC 20 token.
But anyways, thanks .
member
Activity: 1134
Merit: 10
your tutorial is very useful, just for knowledge it's okay, who knows one day there will be an opportunity to run a project, there is already knowledge from you, in making erc20 tokens, but it must be reviewed, for certainty and accuracy, keep working mate, review then for how to make tokens for other networks, you are one step ahead of crypto lovers, for tokens based on erc20 very expensive shipping costs, if indeed you have a solution to minimize costs, shares are highly expected.
hero member
Activity: 966
Merit: 755
jr. member
Activity: 34
Merit: 1
should i do a tutorial how to create an ico token next time ?

I do not know how it will be useful for newbies or general users. Because everybody doesn't need to create an erc20 token. It is not something that you eat or need for any purpose if you are not starting a project. But every project hires a developer to create their token and smart contract because it's not that expensive for a project that is aiming for millions of dollars in market cap. Also, it can also be found on google so few will be interested.



my intention is to use my knowledge to help other newbies on the forum
hero member
Activity: 1498
Merit: 537
should i do a tutorial how to create an ico token next time ?

I do not know how it will be useful for newbies or general users. Because everybody doesn't need to create an erc20 token. It is not something that you eat or need for any purpose if you are not starting a project. But every project hires a developer to create their token and smart contract because it's not that expensive for a project that is aiming for millions of dollars in market cap. Also, it can also be found on google so few will be interested.

jr. member
Activity: 34
Merit: 1
should i do a tutorial how to create an ico token next time ?
jr. member
Activity: 34
Merit: 1
here i come with a new tutoral. how to create an erc20 cryptocurrency. it took me a while to write it.

How to create your own cryptocurrency simply?

 The goal of this article is to show how to create an ERC20-like cryptocurrency in as little time as possible.

Let's start with the basics: what is an ERC20 token? In recent years, the ERC20 token specification has become the de facto standard for Ethereum tokens (or Ethereum-derived blockchains). In other words, most of the Ethereum contracts available today are ERC20 compliant.

This guide details how you can create your own ERC20-like token on the Ethereum blockchain, but before we get started, let's take a closer look at the ERC20 standard.


What makes ERC20 tokens so attractive and successful?

There are several factors at play: ERC20 tokens are simple and easy to deploy, as you will see in this tutorial.

The ERC20 standard solves an important problem, as blockchain-based markets and crypto-wallets need a single, standardized set of commands to communicate with the range of tokens they manage. This includes the rules of interaction between the different tokens, as well as the rules of token exchanges.


It was the first popular specification to propose the standardization of tokens on the Ethereum blockchain. It was by no means the first, but thanks to its popularity, it quickly became the industry standard. Just like other Ethereum tokens, ERC20 tokens are implemented as smart contracts and run on the Ethereum virtual machine (EVM) in a decentralized manner (on the blockchain). Solidity: the programming language of "Smart Contract" or Smart Contracts Ethereum smart contracts are written in Solidity. Although there are alternative languages, almost no one uses them for this purpose. Solidity is similar to JavaScript, so if you have some knowledge of JavaScript, or even Java and other C-type languages, you shouldn't have a hard time understanding what a piece of code in Solidity does, even before you master Solidity enough to use it.


This is where the fun begins, as you should be able to start creating a simple ERC20 contract in no time. This is a simple task, simple enough for this article to explain how to write and deploy an ERC20 token in less than an hour. The token we will create in this demonstration will be a simple ERC20 implementation, without too many bells and whistles. However, I have seen many similar simple tokens in the real world, and they tend to work well.


Presentation of the ERC20 token standard What is an ERC20? Simply put, the ERC20 standard defines a set of functions to be implemented by all ERC20 tokens in order to allow integration with other contracts, wallets or cryptocurrency markets. This set of functions is rather short and basic.

Code:
function totalSupply() public view returns (uint256);

function balanceOf(address tokenOwner) public view returns (uint);

function allowance(address tokenOwner, address spender) public view returns (uint);

function transfer(address to, uint tokens) public returns (bool);

function approve(address spender, uint tokens)  public returns (bool);

function transferFrom(address from, address to, uint tokens) public returns (bool);


The functions of ERC20 tokens allow an external user, for example a crypto-wallet application, to know a user's balance and transfer funds from one user to another with appropriate authorization. The smart contract defines two specifically defined events:



Code:
event Approval(address indexed tokenOwner, address indexed spender,
 uint tokens);

event Transfer(address indexed from, address indexed to,
 uint tokens);

 
 These events will be invoked or issued when an account is granted the right to withdraw tokens from an account, and after the tokens are actually transferred. In addition to the functions of standard ERC20 tokens, many ERC20 tokens also have additional fields and some have become a de facto part of the ERC20 standard, if not in writing, in practice. Here are some examples of these fields.
 

Code:
string public constant name;

string public constant symbol;

uint8 public constant decimals;

Here are some points about ERC20 and Solidity: A public function is accessible outside the contract itself, view means essentially constant, that is, the internal state of the contract will not be modified by the function. An Event is how Solidity allows customers, e.g. your app, to be notified of specific events in the contract. Most Solidity language constructs should be clear if you already possess the essential Java/JavaScript skills.


Write an ERC20 token in Solidity Now that we've outlined the basics and explained what it takes to create an ERC20 token, it's time to start writing logic. First, we need to define two mapping objects. Here is the notion of Solidity for an associative or key / value array:


Code:
mapping(address => uint256) balances;

mapping(address => mapping (address => uint256)) allowed;

Write an ERC20 token in Solidity Now that we've outlined the basics and explained what it takes to create an ERC20 token, it's time to start writing logic. First, we need to define two mapping objects. Here is the notion of Solidity for an associative or key / value array:


As you can see, the value field of the authorized mapping is in itself a mapping of the tracing account address with its approved withdrawal sum. These mappings as well as all other contract fields will be stored in the blockchain and will be exploited, which will cause the changes to spread to all user nodes in the network. Blockchain storage is expensive and the users of your contract will have to pay, one way or another. Therefore, you should always try to minimize the storage size and writes in the blockchain. Now that we have the required data structures in place, we can start writing the ERC20 logic in the appropriate functions.
Jump to: