Noosphere is an on-chain framework for requesting off-chain compute workloads, receiving results on-chain, and managing subscription lifecycle and billing on EVM-compatible chains.
This repository contains the protocol primitives, developer-facing client base contracts, and tooling to integrate recurring or one-time off-chain compute into your smart contracts.
- Request off-chain compute from EVM contracts (transient or recurring).
- Receive results on-chain with proof and delivery metadata.
- Subscription lifecycle management (create, cancel).
- Billing & escrow primitives for payments and fee settlement.
- Highlights
- Foundry
- Quick start
- Usage
- Contracts & architecture
- Developer guide — client interfaces
- Project structure (typical)
- Tests & CI
- Deployment
- Contributing
- License
- Acknowledgements (brief)
- Support for transient and recurring (scheduled) off-chain compute requests.
- Commitment-based request lifecycle: create request → off-chain fulfill → on-chain delivery.
- Billing and escrow primitives for payment/settlement management.
- Developer-facing base contracts:
ScheduledComputeClient— for recurring subscriptionsTransientComputeClient— for transient callback jobsComputeClient— shared base utilities
This project uses Foundry for development and testing.
Components used:
- Forge: testing & building.
- Cast: CLI for interacting with contracts & nodes.
- Anvil: local development node.
- Chisel: Solidity REPL.
Documentation: https://book.getfoundry.sh/
Clone and install dependencies (if you use git submodules for libs):
git clone https://github.com/hpp-io/noosphere-evm.git
cd noosphere-evmmake buildmake testmake formatmake snapshotanvilKey components and responsibilities:
- Router — contract registry/resolver and main entry point for protocol discovery and routing.
- Coordinator — orchestrates commitment lifecycle and validates deliveries.
- Billing — fee calculation, commitment mapping, and settlement helpers.
- SubscriptionsManager — create and manage subscriptions (period, frequency, redundancy).
- Wallet / WalletFactory — escrow/payment wallet management.
- ScheduledComputeClient / TransientComputeClient / ComputeClient — developer-facing client base contracts for receiving compute outputs.
- Verifier (optional) — hook to perform proof verification when using a proofing layer.
Design aims:
- Single responsibility per contract to reduce audit surface.
- Clear access control for callback/delivery entrypoints (e.g.,
onlyCoordinator). - Minimal and reusable client base classes so application contracts implement only business logic.
Implementation files are under src/v1_0_0/.
Integrate by inheriting one of the client base contracts depending on your use case.
// SPDX-License-Identifier: BSD-3-Clause-Clear
pragma solidity 0.8.23;
import {ScheduledComputeClient} from "src/v1_0_0/ScheduledComputeClient.sol";
contract MyScheduler is ScheduledComputeClient {
constructor(address router) ScheduledComputeClient(router) {}
}import {TransientComputeClient} from "src/v1_0_0/TransientComputeClient.sol";
contract MyTransientClient is TransientComputeClient {
constructor(address router) TransientComputeClient(router) {}
}- Use access modifiers like
onlyCoordinatorto restrict callback endpoints. - Keep decode/processing logic concise; use events to signal off-chain or indexable state.
- Prefer idempotent handlers where possible (e.g., ignore duplicate deliveries by requestId).
- The
ComputeClientbase provides helpers for registry lookups, request creation helpers, and common events.
.
├─ src/v1_0_0/ # Contracts (Router, Coordinator, ScheduledComputeClient, TransientComputeClient, Wallet, Billing, etc.)
├─ test/ # Foundry tests
├─ scripts/ # Helper scripts
├─ webapp/ # Web application source
├─ Makefile # Build / test / deploy helpers (make deploy)
├─ lib/ # Third-party deps (openzeppelin, forge-std, etc.)
├─ foundry.toml
└─ README.md
- Run tests locally:
forge test. - CI pipeline should at minimum run:
forge buildforge testforge fmt --check
This project includes an automated end-to-end testing suite that simulates a full interaction between a client, the smart contracts, and a compute node (agent).
First, install the required Node.js dependencies:
npm installExecute the entire test suite with a single command:
npm run test:e2eThis command automates the following steps:
- Starts a local
anvilnode. - Deploys all necessary smart contracts using
make deploy. - Starts the
agent.jsscript to listen for compute requests. - Runs the
client.jsscript to create a subscription and request a compute job. - After the client script successfully completes, it automatically shuts down all related processes.
This repo uses a Makefile helper to standardize deployment. make deploy wraps forge script with environment variables for the private key and RPC endpoint.
To configure the project, create a .env file in the root directory and add the following content:
PRIVATE_KEY=0xYOUR_PRIVATE_KEY
RPC_URL=https://sepolia.hpp.io
make deployAdd this snippet (or similar) to your Makefile:
- Never commit private keys to the repository. Use environment variables or CI secret stores.
- Prefer hardware signers or secure key management for production deployments.
- Add
dry-run/simulation options to your Makefile for preflight checks (e.g.,--skip-simulationor local fork simulation). - In CI, set
PRIVATE_KEYandRPC_URLas encrypted secrets and use a gated workflow for production deployments.
We welcome contributions.
- Fork the repo and open PRs with clear, focused changes.
- Run
forge fmtandforge testlocally before opening PRs. - Keep API changes backwards-compatible where possible; if not, include a migration note.
When referencing design ideas or architecture that were inspired by other public projects, a short mention in your PR description is appreciated.
This repository is licensed under the BSD 3-Clause Clear License.
The design and architecture of Noosphere were informed by several public projects in the decentralized compute space. We thank the teams behind these projects, including:
- Ritual / Infernet SDK — referenced for its approach to managing off-chain compute jobs and SDK structure.