System Architecture & Ecosystem Topology
LearnWay operates a clear dual on-chain model:- Backend Smart Contract Execution: The core backend (
learnway-backend) drives platform state changes (XP, Gems, Badges, Certificates) through the LearnWay Manager smart contract, usinglearnway-transaction-processoras the dedicated transaction relayer. - 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’sVerifyingPaymasterand dispatchesUserOperations 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-backendverifies completion and calls internal contract services (LearnWayManagerService,XpContractService,GemContractService,BadgesNftService,CertificateNftService).learnway-transaction-processoracts 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
paymasterAndDataif the request meets policy/whitelist checks. - Mobile client sends the signed
UserOpto the self-hosted Alto Bundler (/alto). - Alto bundles and executes the operation via the ERC-4337
EntryPointcontract on Lisk L2.
- Mobile client creates a