DEV Community

Nikolay Angelov
Nikolay Angelov

Posted on

Winning Next Block Blockchain Hackathon

Hello, guys :) My Blockchain team and myself participated in one of the biggest Hackathons in Bulgaria lately - Next Block Hackathon, and the professional jury selected our project – we won the first place! I wanted to share the story with you :) So here it goes.

Starting with the Plan

It’s Sunday, a few days before the beginning of the Hackathon. I presented the idea of joining the Hackathon in our team chat. As usual, everyone is sceptical about it, but still, I managed to gather and convince four people to join me and create a team called Riders on the Chain for this challenge with the idea of making a crypto training bot. Yes, that’s right - our first idea was to program a crypto trading bot. Once again, I managed to convince them all, thank God! We held a meeting, had a bunch of ideas throw on the whiteboard but the majority decided to do Car tracking system. To be honest, I didn't agree on that, but well... it was a team decision and the majority won.

The Problem

Have you ever tried buying a second-hand car?

How often have you encountered sellers who are trying to cheat you by changing the odometer data or the car service data in order to sell you a wrecked car for a high price? If you are as lucky as I am, chances are this has happened to you a lot. In our home country of Bulgaria, we tend to say that buying a car is “a matter of luck". However… what if for some odd reason you are an honest car owner who actually has a perfectly serviced car he wants to sell? Chances are, if your warranty period has expired, nobody would trust you about the car info you are providing.

We are living in an economy where car trading has turned into a trustless business, where both sellers and buyers are incentivized to cheat and lie. How about a 180 degrees change to the market?

We asked ourselves: What is next then?

It was already late Monday, we had already registered our team to the Hackathon and it was about time to start preparing since we already knew what we were going to do. We had the Car itself ready (Just a small Arduino car), but still, we lacked planning. Issues like What are we going to do with this car? How are we going to store the Data? and so on occurred. A large debate later, we figured those out and finally started working on the actual project on Thursday.

Preslav Mihaylov and Rosen Krumov started tackling whatever was necessary for the actual Car. They were quick at figuring out the pieces of Hardware for the connection with the Blockchain and got them, as well as all details in terms of Cryptography.

I wish this were the happy end of the story, but sadly…

Hardware Problems all over the place

They started working on the Car prototype and encountered many problems mainly because of our decision to keep the concept of decentralization and keep all processes in the car hardware itself. We started by connecting to our Wifi but then found it hard to make Web3 work at all with the Arduino modules.

This was a concern since the actual Web3 module written in C++ doesn’t compile in C which leads to the rewriting of almost the entire Web3 by our team member Rosen Krumov in pure C (I am so proud of him!).

We saw a truly needed light at the end of the tunnel after several hard days of work in which Preslav and Rosen figured out how the Car will communicate with the Blockchain

The car seems to work, but what is next?

Well on Wednesday it seemed that the Car will actually work, so the rest of the team used after hours time to start working on the project. I started creating the Smart Contract needed to store the data and everything we needed in a decentralized matter, while Ivan Abadzhiev and Simeon Kotashki started working on the actual website and displaying all the Data we had. It looked like those were easy tasks, but…

The day of the Next Block Hackathon

As usual, I was late for the start of the Hackathon at 8:30 but we still managed to register the entire team we instantly started working without paying too much attention to the instructions and presentation – we were eager to code.

What was ready prior to the Hackathon

We only had a Car that we thought was ready, barely anything about the Smart Contract and the actual Web page. It turned out the car wasn’t exactly working, like – barely, so half the team had to focus on the car problems and me – on the Smart Contract

Trusting your Team

If you don’t trust your team in those types of competitions, you’re usually done before even getting started. Knowing my team definitely helps – I have full trust in them, so I stayed focused on improving the Contract that we had without needing to constantly check on what everyone was doing.

This turned out to be a good strategy since everything was going very smooth till 14:00 we had the Car fully working with the Contract and we had a Frond-end that was just a mockup.

We now had 5 hours to create our JavaScript so we started gathering data from the Blockchain and populate it on our Front-end. In our experience, those are easy tasks that we accomplish on a daily basis so we took the time to relax during lunch.

Time to Make it Work

Lunch is over, we went back to our desks and started working.

I didn't have that much work, so I was slacking a bit and networking around the conference and just checked with the team if they need help on anything. It is only around 16:30 that we figured out that we want to store some more data in our Contract and change some of the mechanics, allowing us to can have a moving chart when the Car passes new Mileages. The best choice was to use Events and I needed to code them in our Contract.

This meant that we needed to redeploy things and that was not that easy process, as you needed to recompile the device code and stuff, so every time we did it we needed to be very careful, but everything went smooth.

The Disasters

We had both Smart Contract and Car fully working and we were very pleased until we tried to access our front-end and it didn't load at all. Like really – at all.

We started looking for what was wrong and we were getting very weird errors all over the places without the ability to debug them. I had made minor changes to the Contract and I was sure that it’s working correctly but the team thought the error can only be in the contract, so we spread the effort to try and debug it. Everyone messing with everything didn’t turn out to be the best team decision, quite the opposite - it just made things worse and got me nervous. I decided to go for a more selfish solution and well – I just ignored everyone.

Serbian Music saves the day

Headphones on, high volume and Semsa on (no judgment please, yes – I do like good Serbian music, I’m from Vidin near the Serbian border after all)!

I can see on my side the team going all over the place but I’m still ignoring them – let them work. I need to know why we only get a blank page.

Here we go! And I see a "console.log(test)" input by a team member who omitted to make it as a string, so it was stopping the execution of the entire page…I can still see many errors, but at least the page was loading and now I can start to do a real debug. Now it was the time to find what is really breaking the interaction between the JavaScript Web3 and the Smart Contract. Jumping into that code and reading the error it seemed like the problem was that we only estimate the amount of Gas Limit without specifying it. I changed it but… no. - it didn't fix the problem.

And here I am back at square one... Going around the code and trying to figure out what the hell is going on. Then I got the brilliant idea to check the ABI that we had, so I just went and re-copied the ABI and…. Miracle - it worked!

I have no words to describe the feeling and relief when it actually ran...

Why is ABI wrong if we didn't play with it?

Why the hell was the ABI changed at all? Well, my guess is -- between the multiple commits and pulls that we did, one of our Git clients managed to auto Merge the ABI file and messed it up very hard.

Now you might think to yourself... Wow man, this should have been the first thing that you needed to check but that is not quite true. The error that we were getting was so weird and out of place that it didn't even make sense to check for this.

Now let's go and impress the jury

Nothing could stop us from winning now. Or not exactly…

What happened is that we went to try everything with the Car and the Car was not able to send anything to our Ganache server that was running on a Google Cloud. We became nervous immediately and Rosen and Preslav started working instantly to fix it.

They had spent more than 15-20 minutes trying different things without success when we found out that the actual problem was the internet.

We were using Ivan’s phone as a Hotspot because the public network Next gave us had firewalls. It seemed like me listening to my music with his Hotspot somehow limited his internet connection and that was causing the issue. We switched to a different phone and the Car started working again. Crazy day!

Time to present

Finally, time to present and Preslav was ready with his Pitching. To be sure that everything will work we had a setup with three different phone hotspots holding all the different parts and pieces we needed.

  • One for the Preslav's laptop, so he can actually show the website
  • One for the Car connection
  • One for the Laptop that was connected to the Google Cloud and keeping the Ganache running there

Every point here was critical if any of the phones went crazy we would not be able to present. Luckily that didn't happen.

During the presentation, the people from the jury were looking interested in the project and asked many valuable questions, so we were proud of our presentation.

Other Projects on the table

Let see what the other teams did.

  • First were the guys from Automaton Network and they wanted to use their Core platform to create a hotel reservation website. They even created a way for them to Reserve rooms on random with random dates and such. It was looking good and we started getting scared.
  • The second project was about Sales Managment and to help businesses do sales and payments.
  • The third team presented a Crypto trading bot. They had a website on which you can set up multiple conditions and different rules for the Bot to follow. After that, you could just click one button and the Bot will start trading while following this rules.
  • The fourth team was from two very young guys. They created a Crypto trading bot, but they had an AI that was learning how to do it. They managed to train their model from losing a lot of money to be able to not lose any or make a small profit. Which was amazing, so congratulation to them!

The concurrence was really great and everyone definitely deserved an award!

Awards

The closing ceremony with the award was going to be during the Afterparty so we had to wait a little longer until we knew if we had impressed the jury more than our biggest concurrent– according to our own feeling – the great team with the Automaton network!

After grabbing a deserved bite, we got to the party right on time for the ceremony.

First was announced the third team which was the Crypto Bot which you could set up your own conditions. That was not that surprising as we were expecting at least one of the bots to be in the Top 3.

Time for the second place where we expected either us or Automaton to win. What followed got us all worried - they announced the second place and the other Crypto trading bot is a winner, which definitely surprised us in well not such a nice way… We knew that both us and Automaton had a big chance for the first place, so the only thing was to just wait a bit and see how it goes.

Now they announce the First place... We all stand up and could barely hold our breath… Yes, it happened! We heard our team name, we were the winners!! We yield like kids and ran to the stage to get our price.

Final Words

I want to Thank the organizers, the participants in the Hackathon and the jury for the great work. This was my very first Hackathon and it was a lot of fun. All of the projects were very good and I hope we all face each other on other Hackathons in the future :)

Of course, I want to thank my entire team for making this happen and the work. Thank you, guys!

The original article in my website: http://nikolaytech.com/winning-the-next-block-blockchain-hackathon

You can follow me on:
http://nikolaytech.com/
https://www.linkedin.com/in/thedi/
https://www.facebook.com/ghkgk

Top comments (1)

Collapse
 
yash911 profile image
yash911

This was inspiring! Thank you very much for sharing your experience in the Hackathon. Writing was so good that I felt like I attend the Hackathon! I would be greatly if you could write a tutorial about this! Thanks!