Introducing PAViC: Payment App for Vitcoin Cryptocurrency!

Introducing PAViC: Payment App for Vitcoin Cryptocurrency!

ยท

7 min read

Hello everyone! ๐Ÿ‘‹

Stoked to present to you, my submission for Auth0 x Hashnode Hackathon! โšก

Introduction

Introducing PAViC, a simple, easy-to-use and a hassle-free app for making fast and secure payments using your mobile phone, powered by blockchain. It uses its own cryptocurrency called Vitcoin (named after my alma mater VIT, Pune.๐Ÿ˜‰๐Ÿซ). Based on a completely decentralized platform, PAViC stores all your personal and sensitive financial data in a distributed fashion with strict access controls. The app makes sure that it's only you who has the right to access to your sensitive data and nobody else. There is no central entity in control, hence, gone are the days of abuse of your personal information. Read on to find out more!

TL; DR

Things you can do on PAViC:

App Walkthrough

  • One click signup powered by Auth0โšก. Create free account! ezgif.com-gif-maker (3).gif

  • Get a reward on signup! ๐Ÿ’ฐ

222.png

  • Make hassle free payments. ๐Ÿ’ธ ezgif.com-gif-maker (4).gif

  • Mine transactions and earn rewards! โœจ

333.png

  • View your transaction history. ๐Ÿ“ƒ

Presentation1 - Copy.png

What's more?

  • Powered by Blockchain Tech!
  • 100% secure, with privacy at its core! ๐Ÿ’ฏ
  • Built for the community, powered by the community! No single person in-charge!

What are the objectives of the app?

  • Build a decentralized cryptocurrency network and maintain a distributed database on mobile devices. 1.png

A decentralized mobile network illustrated.

The first objective is to build a network of mobile devices which will be able to communicate with each other in a decentralized fashion. The transactions (ledger) and blockchain data would be distributed and stored with every mobile device in a decentralized manner. The transactions data contain the amount and the parties involved in that transaction, and every transaction is associated with a specific block on the blockchain.

  • Enable payment transactions and implement a reward system. ๐Ÿ’ฐ

Through this decentralized channel, any mobile device would be able to make a payment to another mobile device on the network. We need to verify these transactions to maintain the integrity in the network. As there is no central third party involved to verify (mediate) any transaction, this job of verification is performed by any mobile device on the network itself. For this job, that user is rewarded with a sum.

How PAViC Works? ๐Ÿ’ก

PAViC system is based on a network of mobile devices. These mobile devices have the ability to communicate with one another. Every time a user wants to make a payment, he/she has to enter the details in the app such as the name of the recipient and the amount, and this transaction data gets broadcasted to all other mobile devices on the network, since, this is a decentralized financial system. But the other mobile devices would not be able to see the information contained in this broadcast, hence, privacy is preserved!

Screen Recording 2021-08-26 at 09.09.29.09 PM.gif

A transaction getting broadcasted.

Every mobile device stores the transaction data in a 'pending transaction' buffer. Mind you, the payment is not complete at this point. The money has not exchanged hands yet. The transaction in this buffer has to be verified (mined). This verification task can be done by any user on the network, even the person who's made the payment in the first place! This can be accomplished by simply tapping a button in the app, which runs a verification algorithm behind the scenes. After the verification is done, the transaction gets completed, the money exchanges hands and the user responsible for verifying pending transactions gets a reward!

How I built this app? ๐Ÿ‘จ๐Ÿปโ€๐Ÿ”ง

This is my first app! My first time ever building an end-to-end product! The journey was full of challenges, setbacks, drowning in docs and rewarding experiences at the end! Here's a brief summary of my journey...

Planning Phase ๐Ÿ“

As I had figured out the main objectives, I needed to plan a way to implement them into the app. I divided the whole development procedure into phases. Firstly, I worked on system design and then proceeded onto the implementation phase. Trello was my best friend through this whole procedure, it helped me keep a track of everything and stay organized.

Design Phase ๐Ÿ‘จ๐Ÿปโ€๐Ÿซ

Database Design

There are 4 main entities in put system, viz., users, transactions, pending transaction and blocks. I made a table for each of the entity. I chose to go with a SQL database for this one. This is the schema design of the database: SDP PPT.png

UI Design

The design part of the app was the toughest for me to figure out as I lack the knack for coming up up good design ideas. I looked for inspiration and templates all over the internet, especially on dribbble. I wanted the design to be very minimal, intuitive and dead easy to use and figure out. This process also consists of trying to come up with a color scheme. The proven way was to go for Tailwind CSS color palette. How can you go wrong, eh?๐Ÿ˜‰ I went with the blue palette for mainly one reason. My app comes under finance category and the color blue signifies freedom, confidence and trust. These characteristics go perfectly together with what a cryptocurrency is supposed to be. So everything just fell in place together perfectly!

I used Excalidraw to create wireframes of the screens in the app. The main app consists of 3 screens: Untitled-2021-08-04-1553.png

Implementation ๐Ÿ› ๏ธ

Tech Stack ๐Ÿ’ป

  • React Native - Framework for mobile app development ๐Ÿ“ฑ๐Ÿ› 
  • Auth0 - One stop for all your User Authentication needs! ๐Ÿ›ก๏ธ๐Ÿ”
  • SQLite3 - The deployed and trusted local database for mobile โšก
  • Socket.io & Node.js - For communication between mobile devices

Authentication ๐Ÿ›ก๏ธ

Auth0 provides user authentication API with docs and guides that's dead easy to follow and implement. For someone like me, who's not familiar with the ins and outs of configuring their own custom authentication flow greatly appreciates this. ๐Ÿ˜‰

It provides a great feature called Universal Login, which comes with its own login infrastructure and a whole set of features. Hence, I did not need to create my own login page in the app. So every time a user wants to sign-in, he/she is directed to Auth0's secure login page. It has a clean and customizable UI, in which I configured my own logo. Auth0 made integrating social login providers such as Google superbly easy. There's a whole host of features that I have yet to tinker with such as Multi-factor Authentication and Passwordless Connections. Definitely in the future some time...

Communication ๐ŸŒ

The channel through which the mobile devices communicate and share data is created using socket.io.

Challenges that I faced ๐Ÿฅถ

I worked with JavaScript and React Native for the first time. Almost everything seemed challenging, and the initial period of development was full of rookie mistakes. Here's a highlight of a few of them:

  • I'm not awfully fluent when it comes to writing SQL queries. I ended up making a good deal of mistakes at the beginning and, in turn, created so many bugs. So I had to go back to the docs again to rectify these mistakes. ๐Ÿ˜›
  • Configuring the event listeners in the socket.io was a little tough for me in the beginning. But with their docs and stackoverflow to the rescue, I had it figured out in no time.
  • Certain features such as calculating a user's balance or verifying transactions are asynchronous. Hence, I had to wrap my head around the concepts of Promises and async/await to get them working correctly.

What's next? โœจ

  • Phone book like interface for quickly selecting contacts while making payments.
  • QR Code Scanning for quick transactions.
  • Support for other cryptocurrencies.
  • A web-app for browser for accessing your account. (Will offer me a chance to work with React.js as well๐Ÿ˜‰)

Useful Links ๐Ÿ”—

GitHub Repositories

Winding up...

Thanks a ton for making it till here. ๐Ÿ™Œ๐Ÿป I would absolutely love to hear what you think about PAViC, so let me know down in the comment section and while you are at it, also drop a like. ๐Ÿ˜‰

ย