Inspiration

Today, 191 million people in India are still unbanked. One of the major reasons why people don't open bank accounts is that banks have a minimum balance that you must keep to be eligible. Otherwise, you will be charged with a fine. A lot of people in the country who are living hand to mouth find it impossible to maintain this minimum balance and hence fail to open accounts. Other reasons for not using banks include high fees in some modes of payments when transferring funds and also bank systems shutting down!

Blockchains like Flow solve all these problems! You don't need minimum balances, systems never go down because they are decentralised and the fees are really low. Moreover, Flow also

  1. Has a multi-node architecture which makes it extremely scalable to handle payments for a country like India
  2. Has wallets like Blocto which can be used to set up accounts using only your email and hence can be used by the masses

What it does

FlowPay in one sentence allows you to send INR money to anyone in India using your Flow tokens. This means you don't need to hold physical cash or have a bank account to send money digitally. You can simply

  1. Login to FlowPay using your Blocto wallet
  2. Scan the QR code of the merchant or your friend to whom you want to send the money (this is the UPI QR code which is used all over India to make payments).
  3. Enter the number of flow tokens/INR amount you want to send and click on Pay
  4. That's it, we'll receive your Flow tokens and will ensure an equivalent amount of INR money reaches the user!

How we built it

User Interface

User Flow

  1. The web app is built using Next.js and React.js. We started from the fcl-nextjs-quickstart repo as this was the first time we were building on Flow as well.
  2. We used the @onflow/fcl library to allow the user to connect his/her Blocto wallet
  3. Once the wallet is connected, we use basic query and mutate functions to fetch balances and send funds to our Flow account.
  4. We use "react-qr-reader" library to scan QR codes
  5. The web app has been hosted on Amplify

Server side

Server Flow

  1. We have hosted our backend on an AWS EC2
  2. We have set up an Event Bridge that sends an event to our backend service every second to look for new deposits.
  3. If the service finds a new deposit, it detects the recipient and sends the INR equivalent of Flow tokens received to the end user. The INR money is sent from the float we keep.

Challenges we ran into

There were a lot of things we were doing for the first time in this hackathon and so they were multiple challenges we faced. Some of these include

  1. Learning the basics of Go and Cadence to interact with the Flow blockchain. In fact there was a time on 8th June when the Flow testnet was down and our app stopped working as well and we were confused for a lot of time if this was our mistake.
  2. Building the polling server and deploying it on AWS. We wanted the payment experience to be instant and also the backend to be stateless. Listening to events would have been instant but not stateless as if our backend went down at any time, it would fail to make payments for events fired during the time it was down. As a result, we finally decided to use EventBridge. AWS EventBridge allows you to make cron jobs for up to every second. We used these jobs to fire our server every second and check for new records and send payments if needed. As a result, if the backend ever went down, it would not send the payment at that time. However, when it would come up again, it would get a message from EventBridge and check if there's a new deposit now. (it would consume the pending events from SQS if they didn't got to the DLQ)

Accomplishments that we're proud of

Our main achievement, as mentioned above, was building the backend polling as a stateless and efficient machine. Apart from this technical achievement, we are really happy that we were able to put together the frontend, backend and infra for this project within the weeks of the hackathon itself. We were surprised that we were able to do this all while also learning about Flow for the first time and managing our day-to-day work.

What we learned

As mentioned above, one of the main things we learned was how the Flow blockchain functions. Specifically, we got to delve into

  1. The basics of Go and Cadence
  2. The multi-node architecture that allows Flow to scale to more than a thousand TPS
  3. Upgradeable contracts
  4. Email wallets and account structure in Flow

Apart from this, we also learned a few things about Event Bridges and Amplify deployments on AWS.

What's next for FlowPay

As a next step for FlowPay, we want to get this into colleges. The knowledge of web3 amongst Indian students has been on the rise over the years. A lot of new college students don't even have bank accounts and often need to get cash from their homes or repeatedly ask their parents to make payments. We feel FlowPay can be a great fit over here!

We can onboard these students to set up accounts on Flow and add funds. And the most beautiful part about FlowPay is that we don't need any changes on the vendor/merchant side. The same old QR code that students already use for payments will still continue to work with FlowPay! Once one college adopts this, we can easily expand to a lot of other colleges as we would have proof of work to show.

Built With

Share this project:

Updates