fahmidme / web3-transact

A Next.JS project with web3 capabilities
0 stars 0 forks source link

Web3 Transact

This projeect is created from the template Create T3 App.

Screen Shot 2022-09-18 at 8 48 15 PM Screen Shot 2022-09-18 at 8 48 25 PM

It's responsive!

Screen Shot 2022-09-18 at 8 48 50 PM

Provider

To create a base system of connecting with web3 with easy, we are using Moralis, and following the setup outlined in their documentation.

Authentication Flow

The flow of how authentication works with our system is as follows:

e773208-86aef92-authenticationflow

  1. Connect Wallet frontend sends request message to backend API
  2. Backend request message API requests Moralis to generate a challenge
  3. Generated challenge from Moralis gets sent back to frontend
  4. User signs challenge using wallet which gets sent to backend verify API
  5. Backend verify API asks Moralis to solve challenge using wallet signature
  6. Moralis solves challenge with signature signed by user and generates result with wallet address in backend

Sessions

Following the Moralis documentation, this app makes use of JWT tokens to maintain sessions. We can use this to perform wallet-related tasks in other pages.

Transaction

The code in user.tsx also calls a transfer token transaction, which makes use of Moralis V1.

Improvements

I am aware of the possible improvements in this app such as better mobile responsiveness, being able to switch networks, deployment, etc. However, due to some constraints, this is as far as I have developed it.