Application Flow

App Flow

1. User Interface & Onboarding

  1. Build Request UI Developers log in with their Sui wallet and GitHub account, then pick a repository, branch/commit, and define their pipeline (build/test commands, artifact paths). The web app packages this into a JSON job descriptor and submits it to the backend.

  2. Upfront Payment UI Before the build starts, the user tops up their build-credit vault on Sui. The frontend invokes Wormhole’s Native Token Transfer (NTT) API to lock tokens on the user’s home chain and mint equivalent credits on Sui.


2. Payment Processing

  1. Token Lock/Burn The NttManager contract on the source chain locks or burns the specified amount (e.g., LogiToken or a stablecoin).

  2. Wormhole VAA Emission A cross-chain message is emitted containing {amount, recipientChain: SUI, recipientAddress}.

  3. Guardian Validation Wormhole’s guardian network observes the lock event, verifies it, and signs a Verifiable Action Approval (VAA).

  4. VAA Relaying A relayer submits the VAA to the Sui NttManager via complete_transfer(VAA).

  5. Credit Minting The Sui NttManager mints or unlocks the user’s build-credit tokens, updating their on-chain balance.


3. Backend Orchestration

  1. Webhook & API Listener The backend (Node.js/Express) listens for GitHub push/PR webhooks or manual “start build” API calls. It verifies the user’s on-chain credit and persists the job descriptor (including config CID).

  2. Runner Selection It queries the RunnerRegistry Move module to list active runner operators, filtering by minimum stake, geographic proximity, and historical performance metrics.

  3. Job Assignment The backend writes a BuildJob object to the JobQueue Move module on Sui, embedding {repo, commit, configCID, requesterAddress}. This on-chain object triggers runner nodes to pick up the job.


4. Runner Operator Node

  1. Node Registration & Staking Operators run a CLI command that calls RunnerRegistry::register_runner(operatorKey, stakeAmount), locking SUI tokens and emitting a RunnerRegistered event.

  2. Job Polling & Execution The runner polls Sui for new BuildJob events via RPC. Upon detecting a job, it clones the repo at the specified commit, spins up a sandboxed container, and runs the configured build/test commands.

  3. Artifact Hashing & Attestation After completion, it computes a Merkle root of all output files, signs the payload using its operator key, and calls Attestation::create_attestation(jobId, artifactRoot, signature). The Move module stores a tamper-proof record and emits an AttestationCreated event.


5. On-Chain Attestation Storage

  1. Attestation Recording The Attestation module on Sui writes the signed record into its ledger, ensuring immutability.

  2. Cross-Chain Message Emission In the same transaction, it publishes a Wormhole message carrying the attestation payload for cross-chain distribution.


6. Cross-Chain Verification

  1. Guardian Signing Wormhole’s guardians observe the attestation message and produce a signed VAA.

  2. Relaying to Target Chains A relayer delivers the VAA to consumer contracts on other chains (e.g., Ethereum), where they verify the guardian signatures and store the attestation for local verification.


7. Final Billing & Settlement

  1. Usage Calculation After the build, the Billing module on Sui calculates actual resource usage (CPU-seconds, memory, storage).

  2. Comparison & Top-Up / Refund

    • If actual usage exceeds the upfront payment, the frontend triggers an additional NTT transfer for the difference.

    • If usage is below the upfront payment, the excess can be retained as credit or refunded.

  3. Settlement The Billing module finalizes the job by deducting the exact cost from the user’s vault and distributing payments to the runner’s payout vault.


Key Insights

  • Decoupled Compute vs. Settlement: Build execution happens off-chain; staking, attestations, and billing are all on-chain in modular Move contracts.

  • Economic Incentives: Operators stake SUI to participate; users prepay to guarantee resource availability and prevent abuse.

  • Cross-Chain Interoperability: Wormhole NTT ensures seamless, secure token transfers for billing, while Wormhole Messaging propagates attestations across chains.

  • End-to-End Verifiability: Every build, payment, and attestation is recorded on-chain and/or via VAA, allowing trustless verification anywhere in the ecosystem.

Last updated