Creating your own (ERC-20) CryptoToken

If you don’t know what to search, you will end up in the wrong place:

Lots of results turn up when you google "how to create a cryptocurrency”, but very few detail what the specific mechanics are in implementation. Existing articles do a relatively good job outlining a basic ideological framework, but I want to take it one step further than vague jargon such as “make your cryptocurrency legal”, and “promote your project” (it is worth noting, this is the #1 indexed result in google). Both of these steps are essential, but it would require a textbook worth of information on each to produce any type of actionable insight. Most importantly, both are wholly irrelevant if you are not able to launch a coin (in this case a token) in the first place. This article details exactly what the process of creating an ERC-20 token (a token issued using Ethereum’s blockchain) looks like.

A dead horse:

Before getting into the nitty gritty specifics, we have to get through my least favorite part of any blockchain related article. The dreaded “blockchain overview” section - these are often inaccessible to someone completely unfamiliar with cryptography, and more or less all say the same thing. For this reason, I’m keeping this intentionally brief. My best attempt at describing blockchain to someone completely unfamiliar is:

A blockchain is a long, continuously growing digital receipt, where every “transaction” on the network is both publicly visible and peer validated (without the use of a central intermediary).

Potentially a better summary than my attempt above.
Potentially a better summary than my attempt above.

A technology initially thought to be exclusively a currency for drug dealers is currently proving out a very broad range of use cases. Blockchain today lies at the intersection of cryptography, finance, currency, technology, art, social interaction, and communication. While many existing projects are still in early adopter stages, it is my personal belief that we are at the precipice of a platform shift akin to the advent of the internet, or the change from desktop to mobile.

Dead horse pt. II (Key Terms)

  • Coin vs. Token: A “coin” refers to what you likely associate the term “cryptocurrency” with. Examples include Bitcoin, Ethereum, and Solana. Specifically a “coin” is launched on its own underlying blockchain. Anything that is built on an existing blockchain falls under the umbrella of a token. Examples include Chainlink, DAI, or Dogecoin.
  • Node: Each individual in the peer-to-peer network of computers that comprise the computing power of the entire blockchain.
  • Consensus algorithm: The type of cryptographic algorithm employed which serves to validate every single transaction on the network.
  • Public / private keys: all “digitally signed” information is “signed” by a user’s public key. A public key corresponds to a specific private key which is tied to a specific individual. This is how the network knows exactly who is who, and how participants remain pseudo anonymous. Any network observer can see the public keys involved in transactions, however they cannot identify the corresponding private key.
  • Public Ledger: The chain of blocks where transaction details are recorded (once they are validated).
  • Transaction: The atomic unit on a blockchain platform, each individual occurrence of the “thing” that your platform does. These are subsequently written to the public ledger in the form of a block.
  • Block: A group of transactions that (once validated by the selected consensus algorithm) are “written” to the public ledger. Blocks can’t be “undone”, and as transactions continue over time, each newly validated block is chained to the existing ones (Aha! now the name makes a bit more sense).

Before implementation:

Prior to launching a tokenized project for a real use case, several steps should be taken. The first (and the most frequently overlooked) occurs before a whitepaper, before a business plan, and before any kind of ideation about your new business idea/venture:

Why is this done better on blockchain than existing technology?

This is one of the problems with the blockchain community in its current form. Everything cannot be done better on blockchain, but for many reasons (I posit this is a symptom of many investors pattern matching while lacking the underpinning technological understanding) if a startup is using blockchain it is automatically more attractive to investors. Thinking about this question critically is the most important step in this process, as you will ultimately end up wasting your own time even if you raise money from investors.

The current state of the world.
The current state of the world.

Clearly defined business idea

Once it is clear that an idea should have an applied blockchain solution, the next step is to articulate why and how. This should take the form of a whitepaper, if you intend to issue a token and sell it to anyone, you need to be able to clearly and concisely articulate what value your token is going to provide. While this is not a hard and fast requirement, if you launch a token with the explanation of “haha this is a funny joke token” you likely will not have much success. (Many notable exceptions exist -- The total market cap of these linked tokens is $54.5 Billion USD as of 11/22/21 🤮)

Mechanically, how do you create your own token?

To create your own ERC-20 token (A token on Ethereum’s blockchain network) We’ll break down the required steps below:

Add Metamask wallet chrome extension:

After downloading it here.

This allows you interact with Web3 applications from within your browser.
This allows you interact with Web3 applications from within your browser.
  • In Metamask, set your network to a test ETH network
Change from the "Main Ethereum Network" to a Test Network.
Change from the "Main Ethereum Network" to a Test Network.
  • Get TestNet Ethereum here. This requires you to copy the public Key of your metamask account, make a post on social media (twitter or facebook), and post a link to the post (as shown below).
Depending how congested the network is, this process can take up to a couple hours for test ETH to be delivered to your wallet.
Depending how congested the network is, this process can take up to a couple hours for test ETH to be delivered to your wallet.
  • While waiting for this ETH to be delivered, it’s the perfect time to create the required solidity files using Remix. Remix is a browser based compiler and IDE used to create Ethereum smart contracts, programmed in Solidity.
The Source code for my "BlogToken"
The Source code for my "BlogToken"

For Test net deployment you can use any ERC-20 token source code. Here is the link to the “BlogToken” source code I used, tweaked from the (no longer working) deprecated source code originally published by Gilad Haimov.

The Last step:

Finally, we are ready to deploy and run our newly created ERC-20 smart contract token. Make sure that the environment is “Injected Web3” if you want to deploy the contract to the live test network. Once you select deploy, metamask will confirm the transaction (a few dollars worth of the fake test net Ethereum) for the smart contract to execute, creating our new token.

Lastly, deploy and run your new ERC-20 Token.
Lastly, deploy and run your new ERC-20 Token.

How is this different than a real ICO?

The only difference is that we deployed this contract on the Ethereum Test Network. If you wanted to issue and subsequently sell tokens, this initial deployment would need to occur on the Ethereum Mainnet.

Alternatively if you wanted to create your own NFT through a similar process, here is an article that goes into detail on that topic.

Conclusion

Compared to launching an ERC-20 token on the Ethereum Mainnet this article was grossly simplified. Once a smart contract has been deployed it is live, and immutable (cannot be changed). If you wanted to change major features of the launched token, you would need to deploy an entirely new ERC-20 token. For this reason, significant additional consideration must be given to:

  • Node Design
    • Public vs. Private, on-prem vs. Cloud hosting, required hardware, Default OS
  • Determining Internal Architecture
    • Permissions (who can access what data, who can perform transactions, who can validate transactions)
    • Address formats (wallet identifiers)
    • Key Formats (the keys used to sign transactions)
    • Initial Asset Issuance (rules for creating tokens, total supply)
    • Key Management system to store public + private keys
    • Multi-signature functionality (how many keys a blockchain needs in order to validate a transaction)
    • Atomic Swaps (Smart contracts that enable the exchange of one cryptocurrency for your newly launched currency)
    • Parameters
      • Maximum block size, rewards for mining each block, what transaction limits are imposed, etc.
      • Handshaking (how nodes operating within the network will identify one another)
  • API Infrastructure (external or internal)
  • Design of Interface (both admin and user)
Subscribe to James Burns
Receive the latest updates directly to your inbox.
Verification
This entry has been permanently stored onchain and signed by its creator.