Skip to content

Meta issue #2

@0xbok

Description

@0xbok

System design: https://excalidraw.com/#json=curpA9Oidkvos4QTQHqET,KHZ4Y8j9aN3HbSmJ6N-kyw

Send flow

  • 1. GraphQL (GQL from here on) endpoint for users to initiate send (I (sender) want to send x eth to receiver) user_balance db #3.
  • 2. Check user balance is enough user_balance db #3.
    • a. Create a SQL table user_bal: (address, balance)
    • b. Query that sender.balance >= x user_balance db #3 .
  • 3. Find relevant leaves in state merkle tree: Given sender and x eth, find the leaves owner by sender in merkle tree that have total balance >= x eth.
  • 4. Prepare message for sender authorization and reply to the GQL request with these messages.
  • 5. Send API to receive the leaf, coin and receiver info along with signature from sender add pre-image table with merkle tree #5 update pmtree dependency to arcpay org #7.
  • 6. validate signature, update merkle tree, fetch merkle proofs add proofs to queue message #8.
  • 7. Enqueue all information in "send request queue" add proofs to queue message #8.
  • 8. API receive an ACK from queue and returns promise to the caller.
  • 9. Collect n messages from queue and batch prove them.
  • 10. Validate these messages.
  • 11. Update the state of a "proven merkle tree" after these n messages.
  • 12. Create a transaction object and call an Owner to sign it.
  • 13. Broadcast this tx on chain.

Mint flow

  • watch mint events.
  • update "state merkle tree".
  • push event to queue.

Withdraw flow

  • API
  • Update merkle tree and send to queue.
  • Consume the message, prove it, and update the proven merkle tree.

Proving remains a blocker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions