Building my own Cryptocurrency: FreddyCoin
- Frederick Dopfel
- Aug 6, 2020
- 3 min read
Updated: Aug 9, 2020
I have been interested in blockchain technology since early 2015, when I bought Bitcoin for $600 and was working at Strategic Business Insights, in part, advising governments and large companies on the potentially wide-ranging effects of digital currencies and decentralized networks. I've tried my hand at mining as well, using NiceHash to multi-coin mine in my dorm at Stanford. My experience multi-coin mining and analysis of electricity use from my power supply led me to do a price analysis of Bitcoin with my father (analysis here) and ultimately I sold the majority of my Bitcoin at its peak at around $18,000 (a 30x return, not bad!)
However, I always thought it would be interesting to build my own digital token or cryptocurrency, FreddyCoin, that could exist on a distributed network. Two methods come to mind:
Fork an existing coin and run my very own network
Build a coin on top of another network
Option 1 is definitely the more fun option, especially since it would mean I could give away pre-configured Raspberry Pis as FreddyCoin nodes or miners to my family and friends as fun little gifts. However, learning how to fork a cryptocurrency seems like a very involved project, and after some consultation with friends, I decided it would be better to start with building a contract on top of an existing network. EOS seems like the most interesting and exciting network to launch a new contract on, but since this was my first time dipping my feet into decentralized contracts, I decided to go with the more popular ERC-20 token on the Etherium network.
ERC-20 tokens, although quite powerful, are surprisingly simple to code. You simply define the attributes of the token (total supply, symbol, divisibility, etc), the functions of sending and receiving, checking balance, and a "safe math" check to reject any falsified transfers.
Solidity (the language for writing contracts) can be programmed through the Remix Cloud IDE. I didn't have any experience in writing tokens before, so I largely followed existing guides on how to write them (Shoutout to Blocknomi for creating an excellent guide on how to build Etherium tokens). After compiling, it was time to deploy. Deploying a smart contract demands a cost in Etherium to be paid to the miners who are validating and running the network. To process this payment, or "gas", I use a browser extension called Metamask that serves as an Etherium wallet that interacts with blockchain web apps.
I didn't feel confident that my code was perfect, and didn't want to spend real Etherium on "gas" until I was sure it was ready. Instead of deploying on the main Etherium Blockchain, I instead deployed to a Testnet, using some free "fake" Eth I got from a "faucet". You can see my first test of Freddycoin on the Ropsten test network here.
Now I was ready to deploy to the main network. I thought that I would do something a little fun with my currency, and make exactly one mole of coins (for those of you non-scientists, a mole is a SI number used as a standard measure of the number of particles, especially common when working with gasses). One Mole is 6.02214076*10^23 particles, a healthy number of coins to have. Continuing with the theme, I decided that I wanted to make these coins indivisible since up until this last century, atoms were indivisible as well (most coins let you divide them up to 18 decimal places). After a rather expensive deployment fee (approximately $15), Freddycoin is now active on the Etherium Blockchain, and visible here:
As you can see, I've already been sending and sharing my coin with some of my friends. The coin has no value, and isn't offered on any exchanges, and even takes some Etherium "gas" to send between different accounts. However, I still think it is a fun little project and a cool memento to share with friends. Sometime later, I may expand this project and fork Litecoin, so that way I will have a completely independent blockchain, all mined on a network of Raspberry Pis that I share with friends and family.
Comments