How to Mint ERC-20 Tokens

How to Mint ERC-20 Tokens | Carnomaly

From gaming to logistics, artificial intelligence to car buying, it seems there’s no end to the possible application of blockchain technology in business. In truth, the possibilities truly are limitless. Wherever there’s a need for decentralization, blockchain technology gives developers and dabblers alike the ability to get in on the action.

 

The Ethereum blockchain, along with its cryptocurrency known as Ether (ETH) and the new ETH-based “tokens” that are created every day, are primarily responsible for the widespread adoption of blockchain technology in business.

 

Today we’re breaking down the wildly popular standard of tokens known as ERC-20 Tokens and walking you through the steps we took to mint new ERC-20 tokens.

What are ERC-20 Tokens?

For many, the Ethereum blockchain and its currency Ether (ETH) is simply that — a currency. But there’s more to it.

 

Much more, in fact.

 

Ethereum is also an environment in which many different activities occur via DApps (Decentralized Applications). Each of these DApps may use its own token instead of merely using ETH. You can think of it as a native currency, with the token itself being a digital asset built using the Ethereum blockchain.

 

In the Ethereum universe, tokens can represent any number of different digital assets. Shares in a company, proof of ownership, or as is the case with CARR, our ERC-20 Token, membership in an automotive loyalty program.

 

Much like your MagicBand at Disney World, purchased with cash, allows you access to the parks and rides; your token, purchased with ETH, allows you access to a particular DApp.

Mint ERC-20 Tokens | How we created CARR Tokens | Carnomaly

What is ERC-20?

ERC-20 is a set of standards designed to ensure that any tokens minted are compliant and compatible with the Ethereum blockchain. As the first widely adopted type of specification to provide standardization for the Ethereum token, the popularity of ERC-20 eventually dictated that it become the gold standard.

 

One of the main differences between ERC-20 tokens and all others is that the ERC-20 standard provides a way for all tokens to interact with each other easily. That eliminates the nightmare scenario of having to devise protocols for interaction between every possible token out there.

 

That interoperability is one reason why some tokens have become so valuable that they have been listed among the top cryptocurrencies currently being traded.

 

So what is an ERC-20 Token in a nutshell? It’s simply a token created using the ERC-20 standard and deployed to the Ethereum blockchain to act as a native currency for a particular Decentralized Application (DAPP).

What are Mintable ERC-20 Tokens?

 Mintable ERC-20 tokens are tokens that are entirely compatible with the ERC-20 structure but have an additional feature that sets them apart from other tokens. Mintable tokens allow for the creation of new tokens at any time, which are then added to the existing supply.

 

Standard ERC-20 tokens lack the mintable feature, and that means they must remain part of a fixed supply.

Why Create Mintable ERC-20 Tokens?

There are many reasons to create ERC-20 tokens. One popular reason is to fund a project via a crowdsale, Initial Coin Offering (ICO), or Initial Exchange Offering (IEO), similar to CARR Token’s current IEO.

 

ETH is exchanged for your project’s newly minted ERC-20 compatible token in either of these scenarios over a set period. The difference is that almost anyone can participate in a public ICO. For an IEO, however, only members of a specific exchange would be allowed to purchase tokens. 

 

It is for the purpose of a crowdsale that mintable ERC-20 tokens are most often used.

 

Once the crowdsale begins, new tokens are minted whenever an investor decides to purchase the ERC-20 token by sending ETH to the crowdsale contract. Generally, once the crowdsale ends, no new tokens may be minted, thereby protecting investors’ share of token holdings from being diluted.

CARR Tokens were created as an ERC-20 Token within the Ethereum blockchain | Carnomaly

How to Mint New ERC-20 Tokens

There are essentially two possible tracks to follow when choosing to create an ERC-20 Token. You can go it alone or use a deployment service or token generator tool.

 

The route you choose will largely depend on your familiarity with Smart Contracts and your proficiency with Solidity.

Solidity

Solidity is the coding language supporting Ethereum and other blockchains. Using Solidity, you can build and deploy Smart Contracts to the blockchain for a number of purposes, including minting ERC-20 tokens.

 

It is similar to Javascript and other C languages, making it relatively easy for developers or tech-minded individuals with experience in those languages to master.

Smart Contracts

Just like when putting pen to paper to sign a contract in business, Smart Contracts lay out an agreement’s rules. Unlike regular contracts, however, with Smart Contracts, the rules are laid out in code as part of the blockchain.

 

It’s these Smart Contracts that allow blockchain technology to be truly automated and decentralized.

 

Developers proficient in Solidity use Smart Contracts to build and deploy new DApps (decentralized applications) for an ever-expanding list of purposes. DApps can be used for anything from role-playing games to asset tracking and just about anything else a developer can dream up, including creating new ERC-20 tokens.

Steps to Create and Mint ERC-20 Tokens

Regardless of whether you choose to do it yourself or use a service designed specifically for the purpose, there are a few decisions that need to be made and outlined in your Smart Contract in order to create a new mintable ERC-20 token.

Deploy a Smart Contract

In order to create a truly ERC-20 compliant token, there are a few rules that need to be followed when creating your Smart Contract – some mandatory and others optional.

 

You’ll need to be sure your Smart Contract covers the following mandatory functions:

 

  • “totalSupply” indicates the total supply of tokens in circulation.
  • “balanceOf” refers to the balance of a particular account.
  • “transfer” is a function that transfers a number of tokens from an owner account to a different account.
  • “transferFrom” gives a spender account the ability to transfer tokens on behalf of the token owner to a different account.
  • “approve” defines permissions for transferring tokens.
  • “allowance” defines the number of tokens the owner has approved to transfer to a spender’s account.

 

Additionally, you may choose to include the following:

 

  • Token Name – While not required, it’s generally a good idea to give your token a unique name to differentiate it from other tokens. “CARR” represents our brand while also alluding to our focus in the automotive industry.
  • Symbol – Much like the dollar sign, choosing a symbol for your token is a way to represent your token visually. It’s also highly recommended for the purposes of branding.
  • Decimals – Choose the number of decimal places you’d like to allow for your token, up to 18.

 

One of the biggest challenges of taking the DIY route is that, with few exceptions, once a Smart Contract is deployed to the blockchain, it cannot be altered. If a mistake is made, an entirely new contract will need to be created and deployed. For that reason, attention to detail is essential. It’s recommended that you thoroughly test your code on a test network before deploying it to the mainnet.

Add Additional Functionality to Mint New ERC-20 Tokens

Unless your new token is intended to have a fixed supply, additional tokens can be minted by deploying a new Mintable Token contract, which augments the original contract with additional functionality.

 

Using Solidity, minter roles can be added, renounced, and transferred. It is only possible to mint new tokens from an address that has been defined as having a “Minter” role. If no address is currently in the minter role, you will not be able to mint new tokens and have them deployed to the blockchain.

Carnomaly uses Blockchain Technology and ERC-20 Tokens to create its fleet of tech solutions | Carnomaly

Examples of ERC-20 Tokens

There are over 300,000 ERC-20 Tokens in existence today. Here are just a few of them:

 

  • DAI – this is built on the Ethereum blockchain structure, and it has a $1 USD equivalent, which is sustained via automatic pricing mechanisms that have been coded into the Smart Contracts. It is a decentralized but stable coin that is widely used in the MakerDAO system. Users have the capability of locking their ETH assets inside a MakerDAO contract and receiving DAI tokens in return. New DAI tokens are minted each time ETH gets locked into a collateralized debt position.

 

  • CARR – Carnomaly has minted ERC-20 tokens (CARR) to fund a rewards program, which will be offered on our consumer platform Carnomoly.com. Carnomaly members are all token-holding individuals. These members will accrue rewards for buying or selling new or used cars through the Carnomaly marketplace. The CARR tokens themselves will aid in the ongoing development of additional services and platforms we’ll be offering in the future.

 

  • SNT – known as Status Network Token, SNT is an open-source platform for messaging and interface capable of interacting with Ethereum blockchain applications. The token itself is a utility type of token that drives a decentralized notification market, management of the Status client, and curation of the content generated by users on the network.

 

  • MANA – a virtual reality platform that is fueled by the Ethereum blockchain network and which permits users to create, use, and monetize applications and content. The users own this platform, and they create goods and services that can be traded for MANA tokens since the tokens are both mintable and burnable. MANA tokens are often used in conjunction with LAND tokens. The ERC-20 MANA token must be burned in order to acquire the ERC-721 LAND tokens.

Conclusion

While the ERC-20 standard has been extremely popular to this point, it is certainly not without its flaws, and some other standard like ERC777 may eventually replace the ERC-20 standard. However, for the time being, ERC-20 rules the roost and enjoys widespread acceptance and usage which is largely why we selected this standard for Carnomaly.

 

Given that it is likely to retain its status as the most widely-used Ethereum standard for quite some time yet, it makes sense to have a good familiarity with how ERC-20 tokens are used and what they can do for you. 


Questions about our minting process? Chat with our team on Telegram.

Share this Blog