Learnings from Polygon Africa Bootcamp & Hackathon 2022
An inside scoop from the Polygon Africa hackathon’s first runner-up in the Beginner track.
Bootcamp Little Birdie
Like most young people in Nigeria, I use social media to catch up on what my friends and acquaintances have been up to. That was when I stumbled upon the Whatsapp status of my friend informing his network about the Polygon Africa Bootcamp 2022. Having seen the advertisement for the bootcamp and hackathon earlier on LinkedIn, I read through the advertisement copy, applied, and waited to be shortlisted.
Letter M is for Motivation
One might wonder what my motivation was for applying to the bootcamp and hackathon. First of all, the hackathon prizes looked juicy 😜. I imagined getting one of those prizes and all I could feel was the excitement of winning. But, applying to the bootcamp and participating in the hackathon does not guarantee that I would win any prize.
Second, I saw the bootcamp as an opportunity to upskill myself in web3. During the pandemic in 2020, one of my goals was to learn Solidity. But I wasn’t able to achieve learn Solidity due to several commitments and accomplishment of other goals such as learning about the cloud and obtaining certification from some cloud providers (I learnt about the cloud in 2020 and got certified by Google and Microsoft Azure).
Third, I viewed it as an opportunity to add a side project to my portfolio and also learn some accompanying technologies aside from Solidity.
Since my mantra is “earn and learn”, I saw the bootcamp as a good fit to both learn and most likely earn. Even if I didn’t win anything during the hackathon, I viewed listing any project I would work on in my portfolio as a win. Listing the project on my portfolio could translate to a potential increase in earning power.
Lessons Learnt
The two phases of the program, the bootcamp and the hackathon, enabled me to learn various technologies and skills.
During the bootcamp, I learnt a lot about Solidity. The concept of gas fascinated me about the development and deployment of a Solidity app to the blockchain. You see, just as most motor vehicles need gasoline to run, so does the Solidity app with gas. Aside from running a vehicle on gasoline, the vehicle’s owner is also concerned about the vehicle’s fuel efficiency. That is, the amount of fuel the vehicle guzzles per mile or kilometre. In Solidity, the developer has to ensure the application is gas efficient too. Gas efficiency helps to avoid paying exorbitant gas fees every time the application executes. I have applied this knowledge of gas fees in Solidity to other high-level programming languages by avoiding memory inefficient operations and optimizing functions for optimal memory utilisation.
During the hackathon, I chose to build the application idea using Next JS for the frontend and Nest JS for the backend. Having used React JS and Next JS for a couple of projects, it was a no-brainer for me to go with a frontend technology I was familiar with. However, compared to React JS and Gatsby JS which I was most familiar with, I had to learn some concepts in Next JS such as middleware. With middleware, I was able to implement the protected route mechanism seamlessly. Unlike in React JS where the validation to navigate to a protected route is usually performed in the frontend, I was able to leverage the middleware to authorise access to data on protected routes.
Furthermore, I used Nest JS to build the backend of the hackathon project. I utilised this opportunity to gain hands-on experience using Nest JS. The backend was hosted on Railway, an alternative to Heroku, using Docker. The mesh of these technologies enabled me learn much more about each technology.
The Project
Since I was focused on my mantra “earn and learn”, I had to think up ideas that were most likely to win. I turned to my idea book in which I have written several ideas. The idea that seemed implementable using a hybrid of Web2 and Web3 (Blockchain) was the garbage collection app idea I had written down in 2021.
Next, I had to identify how Web3 could be integrated into the garbage collection application. The aspect of tokenomics stood out. Using the concept of tokenomics, a portmanteau of “token” and “economics”, I was able to establish the issuance of the application’s native token and its utility. Not forgetting that the application was yet to be named, I called it “EcoCycle”, a portmanteau of “Ecosystem” and “Recycle”. In EcoCycle, the native reward token is called EcoToken which can be used to obtain tax credit, get discounts on items purchased from approved EcoStores, or redeem items from approved EcoStores. To get an EcoToken, you need to participate in the EcoCycle system. That is, you either need to be a recyclable waste collector or processor. Once you either sell recyclable wastes for cash or you purchase recyclable wastes to be transformed into useful materials, you are rewarded with some amount of EcoToken. For payments, crypto stable coins such as USDT, USDC, BUSD, and DAI are used. With the idea of EcoCycle taking shape, I had to look for services that support the purchase of stablecoins in local currency and the transfer of those stablecoins.
Two services that seemed to support the purchase of stablecoins in local currency and the transfer of the coins are XendFinance and LazerPay. I explored the documentation of XendFinance but found out it couldn’t fulfill most of EcoCycle’s needs. Thus, I had to turn to LazerPay. With LazerPay, most of EcoCycle’s present and future needs were already covered. However, LazerPay had a drawback too: EcoCycle couldn’t create accounts on behalf of its customers. I wanted the use of EcoCycle to be seamless such that any underlying service EcoCycle depends on such as LazerPay would be transparent to the user. The inability to register a customer on behalf of LazerPay made me design a workaround which works well but is neither user-friendly nor efficient. For the workaround, the user has to register and log into their accounts both on EcoCycle and LazerPay. Once the user can access the dashboard in LazerPay, the user needs to copy the public and secret keys, preferably testnet keys. In EcoCycle, the user navigates to the settings section and pastes the copied public and secret keys into their respective fields under the API Keys tab and saves them. In this way, EcoCycle can access and perform operations on the customer’s LazerPay account. To revoke EcoCycle’s access to a user’s LazerPay account, the public and secret keys are regenerated on the user’s LazerPay dashboard by the user.
I was not able to complete the EcoCycle application but have made significant progress in laying the foundation for the application.
Next Steps
1. The payment feature for EcoCycle is yet to be completed. I will work on it to ensure seamless payments.
2. There is a waste pickup feature that needs work. I need to add the ability to use maps to schedule waste pickup just like ride-hailing apps.
3. I need to manage a customer’s transaction history and also populate the transactions table. Although the table has been designed, it is yet to be put to use because of its core data features that need to be completed.
4. I need to optimise the website for mobile devices. Although I used Material UI to rapidly build the website, the website is currently more desktop friendly than mobile.
5. Error messages need to be user-friendly. I will need to do some work on error handling and error messages.
6. Automated tests. The Next JS frontend and the Nest JS backend lack tests. I will begin including tests in both codebases. Furthermore, I will add API documentation, probably Swagger, to the NestJS backend.
7. I need to tidy up EcoCycle’s codebases as there are some code duplicates in the repositories. Furthermore, I intend to explore domain-driven architecture for the Nest JS backend as described in this article.
You can view the EcoCycle website at https://eco-cycle.vercel.app/. You may experience issues signing up or creating an account, especially towards the end of the month. The service outage is likely to be caused by an exhaustion of the free credits I got from Railway which hosts EcoCycle’s backend. Railway is a hosting platform which gives free $5.00 of credit or 500 hours of usage per month for each user. I find Railway to be a good alternative to Heroku since Heroku stopped offering its services for free. You can check out EcoCycle’s codebase on github here.
First-runner Up Announcement
On 19th December 2022, the winners of the hackathon were announced and my project, EcoCycle, came second in the beginner category. You can read the blog which listed the winners per category here. Also, you can watch the recorded winner announcement session in the video clip below.