System design: https://excalidraw.com/#json=curpA9Oidkvos4QTQHqET,KHZ4Y8j9aN3HbSmJ6N-kyw Send flow - [x] 1. GraphQL (GQL from here on) endpoint for users to initiate send (I (`sender`) want to send `x` eth to `receiver`) #3. - [x] 2. Check user balance is enough #3. - [x] a. Create a SQL table `user_bal`: (address, balance) - [x] b. Query that `sender.balance >= x` #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. - [x] 5. Send API to receive the leaf, coin and receiver info along with signature from sender #5 #7. - [x] 6. validate signature, update merkle tree, fetch merkle proofs #8. - [x] 7. Enqueue all information in "send request queue" #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. - [x] 12. Create a transaction object and call an Owner to sign it. - [x] 13. Broadcast this tx on chain. Mint flow - [x] watch mint events. - [x] update "state merkle tree". - [x] push event to queue. Withdraw flow - [x] API - [x] Update merkle tree and send to queue. - [x] Consume the message, prove it, and update the proven merkle tree. **Proving remains a blocker.**
System design: https://excalidraw.com/#json=curpA9Oidkvos4QTQHqET,KHZ4Y8j9aN3HbSmJ6N-kyw
Send flow
sender) want to sendxeth toreceiver) user_balance db #3.user_bal: (address, balance)sender.balance >= xuser_balance db #3 .state merkle tree: Givensenderandxeth, find the leaves owner bysenderin merkle tree that have total balance >=xeth.senderauthorization and reply to the GQL request with these messages.nmessages from queue and batch prove them.nmessages.Mint flow
Withdraw flow
Proving remains a blocker.