DEV Community

Cover image for Introduction to my PoW based Cryptocurrency
Vitalik-Hakim
Vitalik-Hakim

Posted on

Introduction to my PoW based Cryptocurrency

Antimony Project

This is my first post on Dev.to.

I started a programming project in school last year. I planned on researching Blockchain Technology and its applications. I also dug into the theory side too.

I proposed a final project of making a series of videos with detailed explanation of Blockchain and the Genesis of Blockchain the Bitcoin. I found out a lot and also learned a lot from this project. I was tasked to produce a product as an end goal.

I decided to use the detailed videos I made, explaining Blockchain's History and its use. However, I felt that would be a little weak for an end product. Most students in my school had their products as videos and it was a pretty common and effective thing to do. But I wanted otherwise or both.

I therefore thought about making a Blockchain Application entirely just to demonstrate how the concept works. I won't go into the details of what a Blockchain is because I don't want to bore you with the same things you have heard over and over again. Well, A Blockchain is a decentralized ledger of transactions. I believe that if you are reading this, you should know more about a Blockchain more
than me.

So fast forward, I had done all the paperwork of documenting the process of making this product. Which in reality I could have done in a week but It took me months because of debugging, Missing Libraries, Outdated servers and most importantly laziness xD. Seriously, I went on an internet quest to find these libraries. I would break these files down later in this post. But in all I learned how to use Debian, SSH, Ubuntu(Which I already used), Gitian Builder and many others. I really learnt a lot or I feel like I was learning a lot.

So at this point I had made up my mind on what coin/Blockchain I should make. I had a hard time of 5mins coming up with a name for it. I didn't want it to be generic or the usual way we know Blockchains as coins. Example Bitcoin, Litecoin, FeatherCoin ... and so many others that end in coins. I wanted mine to be like Ether or Stellar. No coin suffix. So guess what, I was in a
chemistry class and I thought maybe some elements may have some cool names and be unique like my coin. I initially chose radium☢ (You get it? because it is rare :) ). But I changed it because of the radioactivity and some long history. Long story short I chose Sb(Antimony), because Blockchain is against Fiat or what normal people call money. So "Anti-Money" project was on. I had tasked one of my friends and business partner who was a UI/UX designer to make a logo for me. And the Coding began.

The Technical details

So first of all, you guys don't want me to code a functioning PoW Blockchain from scratch do you?, Even Coblee (Charlie Lee). Forked Bitcoin Project to make Litecoin. [Thanks to Satoshi Nakamoto]. Who am I to start from scratch and risk security and years of hard coding and debugging. So I also forked Litecoin to make Antimony. Easy right? Wrong!. It was a nice journey of learning and debugging in that nice Ubuntu Bionic OS. So first of all, I cloned the GitHub of Litecoin, specifically the 0.8 version. I remove a bit of error that would prevent you from compiling your almighty Coin. Then with a little regex I found and replaced all instances of Litecoin in the code with Antimony!. I changed the Litecoin Port Numbers to my own Port numbers. For both Testnet and main net. Next was cleaning up some things and specifying the necessary details of Antimony. I made the total supply to be 5Million (Anty). Anty is the ticker symbol for my coin. Just like Bitcoin has BTC or Litecoin has LTC.

Replacements and Coding

I went on with more other coding things like replacing the Epic time and also the Timestamp. Like Bitcoin has a headline in its genesis Block. Litecoin one has a headline from the time of the death of Steve Jobs. RIP. I generated a new Merkle root and before that I had gone through a tedious task of replacing the Public key Hex which was separated by colons! ugh!. That part was sheer focus and concentration. I managed to do it though without any errors in both testnet and main net. I made a rookie mistake when changing the peer magic in my coin. I knew it was hexadecimal but I insisted on adding a letter 'g' in it. Imagine and it kept giving me a segmentation fault! Core it bloodily Dumped! I was so frustrated at that time. As any linux user, we know if you have a problem the only way to solve it is by reinstalling a new OS and starting all over again. I don't think this may sound sensible to Mac and Windows users but that's exactly what I did. I installed a new Ubuntu 18.04 or Bionic. I found the problem and solved it anyway.
Difficulty readjustments were done and reward per block was set to 25 ANTY. Everything was going well you think. No, I have a whole battle ahead of me.

Internet file finding Quest

So as I mentioned I made this coin in Ubuntu and I don't think people in y school or my Project Coordinator uses a Linux Distro. So I had to make an Almighty windows executable to share my little Application with the world or more realistically, my school. When I researched on how to do it. I found out I needed to use a new distro for the first time. Which was Debian!. Woohoo! I was getting closer and closer to using Archlinux. So Debian was installed and I couldn't copy and paste freely. What a pain in the foot. That is where an SSH client comes in. I have used Putty before for my Raspberry Pi 4. To connect to SSH, so this wasn't new. But I chose Bitvise SSH client because of the SFTP feature that allows you to download files to the host machine from the distro through an SFTP window. Pretty easy and powerful. So Bitvise was installed. I used a Gitian builder to build the architecture for the windows. At this point I am abstracting the details for better understanding. But Gitian builder is used to Build packages in a secure deterministic fashion inside a VM. Apart from that I needed some files with specific versions to be precise. These files where:

  • miniupnpc-1.9.20140401.tar.gz
  • openssl-1.0.1k.tar.gz
  • db-4.8.30.NC.tar.gz - Berkeley DB
  • zlib-1.2.8.tar.gz
  • libpng-1.6.8.tar.gz
  • qrencode-3.4.3.tar.bz2
  • boost_1_55_0.tar.bz2
  • qt-everywhere-opensource-src-4.8.5.tar.gz
  • boost-mingw-gas-cross-compile-2013-03-03.patch None of them are easy to find either using Wget magic or any other thing. I can bet you that. I took some internet searches and forum scouring to find these files. They are currently in my possession so if you need one of them just send me an email at aremeyaw_a@soshgic.edu.gh. I will be glad to deliver them to you. I don't want anyone to go on such an internet pain quest.

Contribution to Open Source

So I also faced errors even after finding these bad boys. I kept getting a system error but I solved that using help from stack overflow and some Linux forums. Bitcoin.org too was also my close friend. The error was that I haven't started apt-cacher-ng yet. so after solving that I got a new error. With this error it took about three days to find a solution because it was a problem with the code or not with the code but the Ubuntu server location. Ubuntu has moved some archive files from Archive.ubuntu to old-releases.ubuntu. But the gitian builder was still fetching from that place. So as a normal bug solver. I edited the code on GitHub and sent a pull request for DevRandom to review. Guess what MY PULL WAS CORRECT SO HE MERGED ITT!!!! I was soo excited that day that I showed it to all my friends whether they understood or not. I was happy that I had contributed to the software which is literally the backbone of all Altcoins who build through Gitian. I was also happy that I had contributed to the same repository as the names like Gavin Andresen, Luke Dashjr , Hebasto and other prominent developers in the Bitcoin Development community. The link of my two pull request can be found here

I was in heaven that day, my school day was very light. I was a bitcoin superstar but nobody knew sadly :(. Anyways I look forward to making great contributions to open source like this.

When this was fixed I managed to go through the process of making an exe file for windows successfully but it took time.

Here is a screenshot of the Build/out folder

Image description

Fast forward the present and future

I managed to run the client on windows and sent myself some Anty coins from Ubuntu to windows and to some of my friends. I didn't mention I hard coded some Ip addresses into the code to make some friends servers or nodes on the network and its working fine. I am yet to submit the product and I have mined at least 30,000 Anty for myself. I have sent a few hundred for my friends. I have also set up a normal Block Explorer using the Iqidius Block explorer. I am thinking of setting up dns Seeds but that will be after the project.
Here is a screenshot of my stash of AntY.

Image description

The Official Repository to Antimony is here.
It has the Windows Binary. So make sure you download and connect to a node. Mine some Anty for yourself. Have a good day

Top comments (2)

Collapse
 
atomicpie profile image
Atomicpie

Great Job bro

Collapse
 
vitalikhakim profile image
Vitalik-Hakim

Thank you very much