Skip to main content

System Architecture & Ecosystem Topology

LearnWay operates a clear dual on-chain model:
  1. Backend Smart Contract Execution: The core backend (learnway-backend) drives platform state changes (XP, Gems, Badges, Certificates) through the LearnWay Manager smart contract, using learnway-transaction-processor as the dedicated transaction relayer.
  2. Client-Side ERC-4337 Account Abstraction: The mobile app (learnway-mobile/) uses smart accounts for user-initiated transactions. It gets gas sponsorship from the backend’s VerifyingPaymaster and dispatches UserOperations directly to the self-hosted Alto Bundler (/alto).

Dual On-Chain Execution Model

1. Backend Relayer Pipeline (learnway-transaction-processor)

  • Scope: All automated and platform-driven smart contract interactions.
  • Flow:
    • Learner completes a lesson, quiz, battle, or course on the mobile app.
    • learnway-backend verifies completion and calls internal contract services (LearnWayManagerService, XpContractService, GemContractService, BadgesNftService, CertificateNftService).
    • learnway-transaction-processor acts as the relayer: manages server wallet nonces, estimates gas, submits transactions to the LearnWay Manager contract on Lisk L2, and monitors block confirmations.

2. Frontend ERC-4337 Account Abstraction (ai_mentor/ + /alto)

  • Scope: Exclusively used on the client (mobile) side for user-initiated smart account transactions.
  • Flow:
    • Mobile client creates a UserOperation.
    • Mobile client requests sponsorship from POST /paymaster/rpc/:chainId (VerifyingPaymaster).
    • Backend signs paymasterAndData if the request meets policy/whitelist checks.
    • Mobile client sends the signed UserOp to the self-hosted Alto Bundler (/alto).
    • Alto bundles and executes the operation via the ERC-4337 EntryPoint contract on Lisk L2.

Ecosystem Subsystem Summary