Architecture
General flow diagram of 4Mica
4Mica MVP Call Flow
Participants
Client (C)
Server (S)
Facilitator (4Mica Core Service) (F)
Vault (4Mica Core Contract) (B)
1. Deposit
Client deposits
valto Vault (B).Vault emits
"deposit"event to Facilitator (F).The facilitator adds collateral for the client.
Vault at the alpha release is the core contract of 4Mica, and in later releases, would be a capital-efficient vault.
2. Transaction Phase
0th Request
Client requests service from Server.
Server responds with
402 Payment Requiredand atab_id.Client records
start_ts.
ith Request
Client sends service request with a signed promise.
Server verifies promise via Facilitator.
If promise is invalid → decline.
If insufficient funds → decline.
Else:
Facilitator aggregates and locks promise.
Server executes the service request.
Client receives answer.
3. Settlement (Client Pays Server)
Client pays server on-chain (
val,tid,req_id).Facilitator monitors blockchain for transactions.
If transaction matches promise:
Record payment, update collateral lock.
Notify Vault to register payment.
Vault updates status.
4. Remuneration (If Client Fails to Pay)
Server triggers timeout and requests remuneration from Vault.
Vault verifies request:
Invalid → error.
Valid → pays server from client deposit.
Facilitator unlocks the locked collateral that was used to back the line of credit for the tab.
Vault emits
"remunerated"event.
5. Withdrawal
Client requests withdrawal from Vault.
If
val > deposit→ error.Otherwise, Facilitator reserves funds.
After
WITHDRAWAL_LATENCY:Client executes withdrawal:
If valid → transfer funds and update deposit/collateral.
If invalid → error.
Client may cancel withdrawal request:
Vault and Facilitator remove reservation.
Last updated