Create your own Cryptocurrency, it is easier than you might think

Andrianina Rabakoson

Andrianina Rabakoson / March 17, 2022

14 min read

Cryptocurrency is one of the words you can’t avoid these days. It is still at its very early stage and you might think it's an overhyped trend that will fade in a few years, but that is also what people thought about the internet in the mid-90s. The question is : why people are so enthusiastic about it?

In this article, you will have a solid grasp on what cryptocurrencies are, why do they matter, how do they work and even create your own cryptocurrency in the Ethereum blockchain.

Disclaimer !!! this is not a financial advice but rather for educational purposes only. I do not incite the reader to buy the cryptocurrency we're about to create. The reader should make further researches before investing real money in cryptocurrencies.

Table of Contents

Prerequisites

No technical nor financial background is required in order to follow along. Explanations are beginner friendly. Interest in the topic would be very helpfull.

The truth about our financial system

People kept trying to create their own little market environment to grow their business. Let's say we run a grocery store, we want to create our own means of purchase (our own currency) to lock-in our customers from competitors. However, doing so is illegal, at least in the countries that I know exist. You can’t exchange goods and services for currencies other than Euro in the Eurozone, they would even sue you for creating a so called "fake money". This is because you are part of a large financial system that is centralized and controlled by your government. Even private banks cannot settle transactions with each other without the government's central bank money which is pointed to be the only legal currency in the country. Our store would then introduce kinder versions of currencies such as gift cards and fidelity points to avoid sinking our boats in the sea.

Cryptocurrencies to the rescue

Although currency is just a fancy word for "medium of exchange", it's hilarious that you're not allowed to create your own. Here's where cryptocurrency comes into play. As opposed to the centralized nature of our current financial system, cryptocurrencies aren't, by any means, controlled by banks or government. They run on a network of decentralized computers made for the people, by the people. This array of computers, as widely known as the blockchain, runs some specific software to do cryptographical calculations (hence the word crypto) that process and validate millions of transactions without the intervention of a middle-man (like banks) whatsoever. Transactions in the blockchain are transparent, predictable, pseudo-anonymous, fast (from 15 minutes to milliseconds), extremely secured (nearly impossible to hack) and trustless, which means you don't have to think about whether or not to trust the network because everything there happens as it should be. This is however a complex mathematical property that the blockchain uses and we won't explain here but it's something you can further investigate if you're interrested in this concept with this very good video explanation from Anders Brownworth which I highly recommend you watch. Cryptocurrencies are then the money that runs the blockchain, a new and digital form of a financial system for the people.

Now you may ask, all of this is cool but how do we even create those crypto things? I am not a computer person, how can you even say it's easy?

Coins vs Tokens

Well, a blockchain is, in itself, its own currency zone. Like many countries, there are many blockchains (differentiated by the software they run) with their own native currency. The Bitcoin blockchain for instance uses Bitcoin as their main currency, while Ether is for the Ethereum blockchain. As per the grocery store example, we simply want to create our own currency that has value compared to the government's, not move to an island and build our own government and country. That is what differentiates cryptocurrency coins from cryptocurrency tokens.

Cryptocurrency coins are made by creating a brand new blockchain or by forking an existing one (copying an existing blockchain software and making customizations). It is comparable to creating a new currency zone. These are native currencies like Bitcoin and Ether. At the time of this writing, one Ether is worth $2,774 like any other exchange rates between currencies. Cryptocurrency tokens on the other hand are currencies built on existing blockchain protocols that has value compared to their native currency (which are a perfect match for our grocery store). These are currencies such as DAI and UNI which are tokens on the Ethereum blockchain. At the time of this writing, a DAI is worth 0.000358 ETH, which brings to its respective amount of US dollars. This is however a very general comparison between the two but it can cause a major headache if frequently overlooked.

Demand and Supply

The value of these cryptocurrencies comes from the duality of demand and supply. If our grocery store were to sell the only covid vaccines in the world and only with our cryptocurrency token, our token would automatically gain value due to people buying it (exchanging it for US dollars) to be vaccinated, this is demand. The price of our token would automatically rise if we burn (destroy) a good amount of it to a fewer number than people wanting to buy it, making our token worth thousands of dollars, this is supply. Conversely, it will only be kept back low if we mint (create) more of our token than there would be people willing to buy it.

Create your own token

If something has to be clear, is that yes, cryptocurrency coins are difficult to create but tokens aren't.

Now is the fun part, we want to create our own token which we name CVO (just to sound like covid 😉) . It will be the token people will buy our vaccines with and make us millionaires 🤑. We will create the CVO token whithin the Ethereum blockchain protocol which it's native currency Ether is the second to Bitcoin in terms of market capitalization (The total market value of a cryptocurrency's circulating supply).

ERC-20 Token standard

Under the hood, every token are just code deployed to the blockchain, they are known as smart contracts. With Ethereum, we can make our smart contracts do whatever we like as they are Turing complete. However, we just want our token to be purchased by our customers, exchanged between them, minted and burned. Thankfully, some smart guys from OpenZeppelin designed standards to follow for a number of token use cases. We are particularly interested in the ERC-20 token standard which best suits our cryptocurrency as a fungible token.

ERC-20 Wallet

Now that we are dealing with ERC-20 tokens, we have to first obtain our ERC-20 token wallet to manage them all (sending, receiving and storing our erc20 tokens). Do note, however, that you'll have the feeling of storing your tokens in your wallet. Though, if you enter into the technical details, you'll understand that tokens are just an accounting of all of your transactions on the blockchain. You do not really own your tokens but just the private key.

The most popular ERC-20 wallet on the market is Metamask. Go to their website and install the respective extension for your browser. After the installation, follow the instructions to create your metamask account and you should end up with the following fresh account :

Metamask

Contracts Wizard

Now that you have Metamask installed, head over to the OpenZeppelin Contracts Wizard page. This wizard creates the code for our token from a graphical interface. With the ERC-20 section selected, enter the name of our token (which will be the same as the symbol), enter the premint value (the initial amount of tokens when we first deploy it to the blockchain). In the Feature section, check Mintable (Privileged accounts will be able to create more supply), Burnable (Token holders will be able to destroy their tokens) and Ownable (Makes sure we, the deployer, can mint or burn some CVOs). You can always play around with the wizard and customize your token as you like.

OpenZeppelin contracts Wizard

Remix editor

Just right above the wizard, click the Open in Remix button. It will open a tab for the Remix IDE containing our code. Do not panic, this is just a tool to facilitate our task of deploying our token to the blockchain.

Head over the Solidity compiler tab of the IDE and click on the Compile contract button. Compilation is just a fancy word for translation. It translates our human readable code of the token to machine language that a computer can understand, the Ethereum software in our case. Leave everything as default and after your compilation is successful (green checkmark on the compile tab), go to the last Deploy & run transactions tabs. Switch the environment option to injected web3, it will open your metamask wallet and ask you to connect from it. Click Next and Connect.

Injected web3

Transaction gas and fees

We're now inches away from deploying our CVO token to the Ethereum blockchain. However, there are some very important elements of the blockchain we did not tackle yet and that is : gas and fees.

Like we already know, the blockchain is run by a network of computers of people like you and me. Making any transactions in the blockchain requires them to keep their computers running. They are in charge of their own maintenance cost, electricity bill, internet connection and so on. So to keep the network liquid, those people, known as validators or miners (prior to the Ethereum 2.0 upgrade), are rewarded proportionaly to the amount of computational effort they offer to execute specific operations on the Ethereum network, this measurement is called gas.

You can think of a gas as 1Mo of ram. If you run heavy programs on your computer, it eats a lot of your ram and you have to pay more on electricity. If your transaction is too complex, it can cost you more gas to run it.

Then it's up to the person making the transaction to value a unit of gas to whatever amount of Ether he likes, that is what fee stands for. So if you are willing to make a 30,000 gas worth transaction and place your fee to 0.000001 ETH, you will pay a roughly 30,000 x 0.000001 ETH = 0.03 ETH to run your transaction.

Do note, however, that validators are incentivized to first pick the transactions they can benefit from the most, so if you want your transaction to settle quick, you should bump your fees and if you can't afford much on fees, your transaction may end up pending all nights.

When the network is congested, fees are high. You can have a glimpse of how much are the trending fees to place for a certain transaction speed at any moment in this website.

Mainnet vs Testnet

If you understood the concept of gas and fees, you should immediately be aware that deploying our CVO token will cost us some money because deployment is already a transaction of its own. The thing is we don't want to spend money with our CVO meme currency, do we? 😉. Neither do we developers when running some bigger and complex smart contracts to the blockchain for test. That's why testnets exist.

Testnets are just fake blockchain where 1 Ether is worth nothing at all. But the whole system works the same as the mainnet (the real blockchain), perfect for testing. So we are using the Rinkeby testnet to deploy our CVO token but you can always deploy your token to the mainnet if it's a serious project and the process will look the same.

Head over to your Metamask wallet and make it point to the rinkeby testnet. In the network dropdown above, click show/hide test networks and enable the show test network radio button. Now your Metamask wallet should have the Rinkeby testnet listed on the network dropdown. Select it.

Testnets

Rinkeby faucet

Testnets work exactly the same as the mainnet, we should then always have some test Ether to deploy our token to the testnet. You can claim some in the Rinkeby faucet page on Chainlink. Go to the website, on the upper right click the Connect wallet button, make sure you have the Rinkeby testnet selected on Network, send request and now wait for your transaction to complete.

Rinkeby faucet

Once your transaction is complete, you can open your Metamask wallet and see your hard-earned 0.1 test Ether in it. Click the transaction under Assets tab and in Receive click View on block explorer.

View on block explorer

This link will lead you to the popular Etherscan website, a block explorer where you can see all the information about your transactions and even of others which enforces the transparency nature of the blockchain.

Deploying the token

Finally we're here. We have enough test Ethers now to deploy our CVO token so go ahead and return to the Remix IDE tab. You can see that it already pointed to the rinkeby testnet below the environment option, make sure you select the CVO contract in the Contract dropdown and click the Deploy button. You will see a confirmation dialog with Metamask and confirm the transaction. Metamask will automatically fill an acceptable amount of gas price (fee) to send to.

Confirm deployment

After you confirmed the transaction, open your wallet again and in contract deployment under the Activity tab, click View on block explorer. Wait for your transaction to have the green success label. When your transaction completes, copy the To address, it's the address of your newly deployed token. Yes tokens (contracts) also have addresses, you can learn more here;

Token deployed

Open Metamask again and above the Assets tab, click on Import tokens. Paste in the token address, it will automatically detect its name and import the token.

200 cvo

We did it 🎉, we just deployed our own cryptocurrency to the Ethereum blockchain using the ERC-20 standard. Deploying to the mainnet is no different. We automatically have 200 amounts of CVO which refers to the premint value we typed in the wizard because we are the minter of this token. We can now send it to our customer for US dollars by just having to know their wallet address. Open the wallet, click on send, paste in the customer's wallet address, choose our CVO asset and type in the amount to send.

sell

You can also go to the Remix IDE and in deployed contract we can easily perform minter only operations like minting or burning tokens to manipulate the price of our token 😈.

mintersonly

Conclusion

You can see from this article that creating cryptocurrencies can be done from a click of a button. Understanding at every level how they work is the thoughest task overall. Nevertheless, this article was a compilation of loads of information about this game changing but least understood innovation of our century. As always, this is not a financial advice at all. Creating tokens are for elaborated fintech companies that has experts and lots of engineers in their disposition. We just explored the tip of the iceberg. I hope the reader have learned a lot from this article. This entire blog is open source. It is always appreciated if you make contributions by creating pull requests, writing comments, sharing posts to social media or even just leaving reactions below. I see you on the next.