polymorpher / sms-wallet

SMS Wallet - non-custodial wallet bound to phone number
https://smswallet.xyz
6 stars 4 forks source link

MiniServer: basic mini-wallet operator functionality #5

Open johnwhitton opened 2 years ago

johnwhitton commented 2 years ago

Overview

Enable SMS controlled Mini-wallet operator functionality for pay and transfer triggered by SMS messages from the user.

See this Internal demo

Description

This enhancement enables mini-wallet functionality via the API's. Including operator functionality (pay and transfer) as well as end user functionality (deposit, withdraw, authorize). Users can trigger pay and transfer functionality by sending SMS messages to the operators twilio managed phone number.

Simple Process Flow

We will start with the native token flow and then add other tokens in a separate issue.

  1. User Deposits funds into the miniWallet
  2. User Approves Funds funds for a creator(developer) in the MiniWallet
  3. User Receives a request for Payment for Funds to a creator.
  4. User Pays the creator(developer)

Assumptions a. All user interactions can (and probably will) also be implemented using i. From Creator Apps integrating with the sms-wallet client approve screen as explained in the demo ii. By additional client functionality for deposit, approve and payment (to be developed separately).

b. Request for Payment will handled separately.

Technical Description

The focus for this enhancement is triggering a payment by the user to the creator via SMS (item 4) above. Specifically creating the foundational building blocks which can then be further enhanced.

Technical Flow

  1. User sends an sms to the operator phone number to trigger payment
  2. Twilio server receives the message and triggers a call to the sms-wallet-server via webhook
  3. The server validates the signature of the request is from twilio.
  4. The server reads the payload to decide which action should be taken

Technical Components

Following is an overview of the technical components to be implemented

Approach We will start with a minimum viable product (MVP) to ensure the infrastructure is in place, parsing logic will be added later. The mvp will upon receiving a message from a user the operator will pay an amount on their behalf to an approved recipient.

Go Live Checklist (for discussion)

Optional Enhancements

Standalone Local Environment

Harmony Testnet Environment

Harmony Mainnet Environment

References

polymorpher commented 2 years ago

"AssetManager Administrative" components are not needed. One can simply do it in a console. Client API is not needed either. It will be entirely performed on the client side directly interfacing the blockchain.

Token tracking and NFT identity tokens seem to have higher value than the other proposed Future Enhancements

johnwhitton commented 2 years ago

Based on Feedback from @polymorpher we will focus on enabling operator mini-wallet functionality triggered by SMS messages from the user for the first phase. As such the original design above will be updated.

Here is a copy of the original design for posterity

Overview

Increase server functionality to support the SMS controlled Mini-wallet.

Description

This enhancement enables mini-wallet functionality via the API's. Including operator functionality (pay and transfer) as well as end user functionality (deposit, withdraw, authorize). Users can trigger pay and transfer functionality by sending SMS messages to the Operators Twilio managed phone number.

Technical Description

Following is an overview of the technical components to be implemented

Technical Components

Future Enhancements

Following are optional future enhancements that may be addressed under separate issues

References

johnwhitton commented 2 years ago

Status Update: Have configured Twilio test account to send test messages to sms-server running on localhost

johnwhitton commented 2 years ago

Design Notes

johnwhitton commented 2 years ago

Updates

Have tested with the following flow Note : User actions are currently created using the demo page with contract calls to AssetManager Note: Creator actions are triggered by sms messages using the Twilio CLI Note: All tests are currently local using a local ganache instance

  1. User Deposit 10 ETH
  2. User Approve 1 ETH for the creator
  3. Creator Checks Balance: twilio api:core:messages:create --from "+14158401410" --to "+17372327333" --body "balance
  4. Creator Requests Operator to Pay 1 ETH: twilio api:core:messages:create --from "+14158401410" --to "+17372327333" --body "pay"
  5. User withdraws 1 ETH
johnwhitton commented 2 years ago

Internal Demo Video

johnwhitton commented 2 years ago

Have forked PR https://github.com/polymorpher/sms-wallet/pull/7 in PR https://github.com/polymorpher/sms-wallet/pull/8 Can either merge miniserver functionality first (https://github.com/polymorpher/sms-wallet/pull/7) and progress smart contract enhancements after (https://github.com/polymorpher/sms-wallet/pull/8) or ignore https://github.com/polymorpher/sms-wallet/pull/7 and just merge https://github.com/polymorpher/sms-wallet/pull/8.