IITKBucks: Behind the Scenes (or Codes?)

Making-of, confessions, and bloopers.

IITKBucks was a Programming Club Project that I mentored in the Summer Camp 2020. The documentation of the project is hosted at https://iitkbucks.pclub.in. The meta repository can be found here.

Let’s begin with some confessions

I am what you might call a fraud.
- H.G. Tannhaus, Dark

Idea of the project

I did not come up with the idea. This was one of the submissions to the Google form for collecting suggestions to PClub projects (some of which I have discussed here).

Mentorship

When I decided I would be mentoring the project, I had very little knowledge of blockchains. You could say, the only thing I knew was that a blockchain is a chain of data blocks. LoL. However, I just knew that it wouldn’t take me long to learn about the concepts and that I would be ready by the time the project begins. Just to play it safe, I started looking for people who were experienced in blockchains, and I got Bhuvan and KKD as co-mentors.

Structure and Planning

One common response that I received as feedback for the project was that it was very well planned out and structured. I’ll tell you a secret: it wasn’t. I didn’t even know how to build the project, how could I have known how to plan it out properly LMAO? Most of the decisions were just ad-hoc (some of the incidents are listed below).

Making-of

The Beginning

As I mentioned before, I had not planned out anything. So I just straightaway started out with mining. Yes, that’s right, no discussions on blocks or blockchains, but BOOM: we’re mining! Unplanned max pro :p

I somehow explained what mining is. But how do I make sure people understood it? So I just randomly decided to give them a task (to mine a string), and called it Assignment 1. I didn’t know how many assignments there would be by the end of the project. I just hoped that it would be enough to justify a separate repo :p

Blooper 1

For the second discussion, I explained the structures of inputs, outputs, transactions, and blocks. And then I just asked them to start building the client! I didn’t even tell them what a “client” was. Unplanned super ultra max pro. Thankfully, we had a great discussion on the structures, and people just forgot that they had been asked to start building the client :p

More bloopers

In the next discussion, I explained about digital signatures, and gave an assignment to generate and verify signatures. I wasn’t experienced with the implementation of signatures, so I thought there were two major padding methods: OAEP and PKCS, and that we should prefer OAEP. I later found out that it is not recommended to use OAEP for signatures, and that we should use PSS instead. So I had to change the problem description for the assignment. :p

Some stability, maybe

The subsequent discussions and assignments were about the representation of transactions and block. I had to make some changes in the structure from what I had mentioned before (yes, because the earlier description was unplanned :p). There were no major bloopers this time.

A demo run!

I felt that the project was getting boring because we were just doing the assignments, and not building anything. So I decided to have an assignment to build simple messaging clients for a distributed network, and then have a demo run of it. It was amazing. People enjoyed it. We were disrupted by ngrok’s free tier limitations, but other than that, it was wonderful.

The fun part

We subsequently discussed the lifecyle of a blockchain, transaction fees, block rewards, chain reorganisation, double spending, etc. Then we started working on the actual project. Since people had already implemented most of the logic of the project as assignments, it was quite simple. They just needed to connect those parts to appropriate endpoints.

Bloopers return :(

It was all going nice. The next step was to mine new blocks. But there was a problem that I had overlooked. The mining function could run on the main thread or it would halt the server (since mining continues until either success or interruption). So we needed to do some multithreading here.

This was a serious problem, since it would be a new thing for most of the students. I had assumed that we would not face any major blockers in the project development phase since all the new concepts would have been covered before that through assignments. So I just gave them a new assignment to have a server start a miner (from the first assignment) in parallel. Also, since this too was unplanned like most of the other stuff, I forgot to tell them to make an endpoint to stop the miner. :p

Thankfully, the students were more hard-working than I had assumed. They completed the assignment and finished the miner too. But wait, there was another thing I had overlooked. The frontend! We built the nodes, but how is the end user going to communicate with that?

I would have made everyone build a web app for this, but there were just 3-4 days remaining for our end-term presentation, and we needed to complete it by then. So I gave them the choice to build either a web app, a desktop app, or a CLI frontend. The time limit was tight, but the students delivered. :')

The Deployment

I had deployed my node at https://iitkbucks.pclub.in, so that others may be able to test their applications with that. However, my node had a lot of bugs (just look at the commits on 16-17 July here :p). So did the others.

We did a demo run of the application on the evening of 18th July, and it failed miserably. There were just too many problems. And we had the end-term presentation on the next day. However, the students were nice enough to work hard and fix all the bugs by the next morning. We had another demo at noon, and it worked perfectly! Oh the satisfaction! It still seems magical to me how the students managed to fix all the bugs in their applications in such a short span of time. :D

Other interesting things

My assignment repo

I had started learning Haskell around the same time that the project started. Quite overconfidently, I decided to do all the assignments in Haskell. The resolution turned out to be an epic fail. I even complete the 2nd assignment in Haskell. :p So then I turned that repo from a Haskell-only repo to a polyglot repo, and tried out some new things in Java and Rust as well.

A shot at testing

I had decided that I’d write tests for all the parts of my main application. I even started doing that. At one point, the coverage was 89%. I gave up after that, and now the coverage lies at a meagre 18% :p This is probably because this was the first time I was writing tests, and I had no idea how to test the complex functions that depended on the state of the application besides the input.

Java <3

The students had complete freedom over the language they were going to use for their project. One of the students decided to use Java. To give him code examples and to help him fix bugs in his code, I had to write code in Java, after a gap of over a year. That was a wonderful experience for me. It was like meeting an old lover, who’s trying to allure you again. :p Java still remains my second most favorite language. <3

Channels in go

Before this project, I had never properly worked with channels in go. Through this project, I learned how to send/receive data through channels in both blocking and non-blocking ways. Maybe my current implementation does not follow all the good coding practices for channels. I hope it will improve in my future projects.

Project movie?

Antreev made a really nice video of the project in action. The video is available here.

The Feedback <3

I received some really nice responses in the feedback form. The sheet is so good that I like to revisit it sometimes, just to feel happy reading the lovely messages. Some of them mentioned that the last part of the project could have been better planned. They didn’t realize it was all unplanned, right from the beginning :p I do hope that my future projects will be better planned than this :p

Avatar
Priydarshi Singh
Software Engineer

Breaker · Builder · Engineer

comments powered by Disqus