modc2/mod

4

stars

3

commits

Rust

primary language

Sep 10, 2026

updated

README

 _____ _______ ______
|     |       |      \
| | | |   -   |   -  |
|_|_|_|_______|______/

mod

A modular runtime for building, registering, and monetizing software on-chain.

Python 3.11+ Solidity 0.8.20 Base License: MIT


Write a module. Register it on-chain. Set a price. Get paid every time someone calls it.

You write code ──> Register on-chain ──> Users call it ──> You get paid

Install

git clone https://github.com/modc2/mod.git
cd mod
./setup.sh        # installs node, pm2, rust, mod, commune

Deploy

Three scripts standardize all deployment: setup.sh, start.sh, stop.sh.

Local

./setup.sh        # one-time: installs all dependencies
./start.sh        # starts API + App via PM2
./stop.sh         # stops all servers
./stop.sh api     # stops a specific server

Docker

./start.sh --docker              # build + run (image: mod, container: mod)
./start.sh --docker myimg mycon  # custom image/container names
./stop.sh --docker               # stops the mod container
./stop.sh --docker mycon         # stops a specific container

Scripts

ScriptPurpose
setup.shInstalls node, pm2, rust, mod (editable), commune
start.shStarts API + App locally, or --docker for containerized
stop.shStops all mod servers (PM2) or --docker for container

Usage

CLI

m mods                        # list all 218 modules
m info agent                  # inspect a module
m serve agent                 # start its API server
m kill agent                  # stop it

Python

import mod as m

agent = m.mod('agent')()                              # load a module
result = m.fn('agent/chat')({'message': 'hello'})     # call a function
m.serve('agent')                                       # start server

Calling a function from the CLI

m agent/chat message="hello"    # calls agent.chat(message="hello")
m safe/balance                  # calls safe.balance()

Arguments are auto-coerced: ints, floats, bools, JSON all just work.

Architecture

Three layers: Orbit (modules), Core (engine), Chain (on-chain protocol).

┌──────────────────────────────────────────────────────┐
│  ORBIT  218 modules                                  │
│  agent · claude · safe · bridge · uniswap · ipfs     │
│  goldfi · prefi · hyperliquid · venice · zcash · ... │
└──────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────┐
│  CORE   mod.py (1800 lines, 210+ methods)            │
│  module loading · routing · crypto · storage · cli   │
└──────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────┐
│  CHAIN  StakeTime Protocol (Base)                    │
│  registry · market · treasury · staking · oracles    │
└──────────────────────────────────────────────────────┘

Directory layout

mod/
├── core/
│   ├── mod.py          # the engine — module loading, crypto, storage, 210+ methods
│   ├── utils.py        # networking, async, system helpers
│   ├── chain/          # Solidity contracts (StakeTime protocol)
│   ├── app/            # Next.js frontend
│   ├── api/            # module registry, IPFS, blockchain ops
│   ├── server/         # process management
│   ├── store/          # encrypted KV store (AES-256)
│   ├── key/            # key management (ED25519, ECDSA, SR25519)
│   ├── cli/            # the `m` command
│   ├── router/         # API gateway
│   └── gate/           # auth & token gating
│
└── orbit/              # 218 modules
    ├── agent/          # AI agents with memory & planning
    ├── claude/         # Claude integration
    ├── safe/           # Gnosis Safe multisig
    ├── bridge/         # cross-chain (Across, Squid, Hyperlane)
    ├── uniswap/        # Uniswap v3
    ├── hyperliquid/    # perpetual DEX
    ├── goldfi/         # gold-backed stablecoin
    ├── ipfs/           # decentralized storage
    └── ...             # 210 more

Modules

Every module lives in mod/orbit/<name>/ and contains:

FilePurpose
mod.pyThe module class — all logic lives here
config.jsonName, ports, contracts, schema, endpoints
skill.mdCapability docs, usage examples, API table

Notable modules

ModuleWhat it does
agentAutonomous AI agents with memory, skills, multi-step planning
claudeClaude API — Rust backend + React UI
safeGnosis Safe multisig via ethers.js + ABI
bridgeCross-chain bridges (Across, Squid, Hyperlane)
uniswapUniswap v3 — swaps, LP, analytics
goldfiGold-backed stablecoin (XAU-pegged)
prefiPrediction markets with AMM
hyperliquidHyperliquid perps integration
ipfsIPFS/Filecoin storage
veniceVenice AI models
zcashPrivacy transactions

Browse all: mod/orbit/

StakeTime Protocol

The on-chain layer. Modular primitives for registration, payments, staking, and consensus — each deployable independently, composable together.

Chain: Base (EVM L2)  |  Contracts: Solidity 0.8.20 + OpenZeppelin

Contracts

ContractPurpose
RegistryModule registration, metadata, versioning
MarketPricing, purchases, instant withdrawals
TreasuryRevenue distribution, multi-token splits
BlocTimeTime-weighted staking, governance weight
TokenGateToken-gated access control
PermsRole-based permissions
OraclesPrice feeds (Chainlink, Pyth)

Payment flow

Register module → Set price → User calls function → Payment to treasury → 80/20 split → Withdraw anytime

Developer gets 80%. Protocol gets 20%. No vesting, no delays.

Deploy contracts

cd mod/core/chain
npx hardhat node                                        # local
npx hardhat run scripts/deploy.js --network localhost   # deploy local
npx hardhat run scripts/deploy.js --network base        # deploy mainnet

Full protocol spec: docs/whitepaper.md

CLI Reference

# discovery
m mods                        # list modules
m info <mod>                  # inspect module config, endpoints, deps
m code <mod>                  # view source
m dp <mod>                    # get module directory path

# servers
m serve <mod>                 # start API server (wraps module class)
m serve <mod>.app             # start API + Next.js frontend
m servers                     # list running servers
m kill <mod>                  # stop server
m restart <mod>               # restart server

# development
m test <mod>                  # run tests
m build <mod>                 # build (Docker, npm, etc.)
m deploy <mod>                # deploy to registry
m logs <mod>                  # tail logs

# git
m push "message"              # add + commit + push
m status                      # git status
m diff                        # git diff

Python API

import mod as m

# modules
agent = m.mod('agent')()
result = m.fn('agent/chat')({'message': 'hello'})
info = m.info('agent')

# servers
m.serve('api', port=8000)
m.kill('api')

# crypto
key = m.get_key('my_key')
sig = m.sign({'data': 'value'}, key='my_key')
encrypted = m.encrypt('secret', key='my_key')

# storage
m.put('user:1', {'name': 'alice'})
user = m.get('user:1')
m.put('api_key', 'secret', encrypt=True)

# AI
response = m.ask('explain this', model='claude')

Stack

LayerTech
ContractsSolidity 0.8.20, Hardhat, OpenZeppelin, ethers.js v6
BackendPython 3.11+, FastAPI, Redis
FrontendNext.js 14, React, TypeScript, Tailwind
ChainBase (EVM L2)
AIClaude, OpenAI
StorageIPFS, AES-256 encrypted KV

Docs

DocContents
docs/cli.mdCLI reference
docs/modules.mdModule system
docs/orbit.mdOrbit module guide
docs/api.mdAPI & endpoints
docs/contracts.mdSmart contract spec
docs/keys.mdKey management
docs/storage.mdStorage system
docs/whitepaper.mdStakeTime protocol paper

License

MIT — see LICENSE.


Code is capital.

Contributors

einsum69

2 commits

agimarx42

1 commits

modc2/mod

4

stars

3

commits

Rust

primary language

Sep 10, 2026

updated

README

 _____ _______ ______
|     |       |      \
| | | |   -   |   -  |
|_|_|_|_______|______/

mod

A modular runtime for building, registering, and monetizing software on-chain.

Python 3.11+ Solidity 0.8.20 Base License: MIT


Write a module. Register it on-chain. Set a price. Get paid every time someone calls it.

You write code ──> Register on-chain ──> Users call it ──> You get paid

Install

git clone https://github.com/modc2/mod.git
cd mod
./setup.sh        # installs node, pm2, rust, mod, commune

Deploy

Three scripts standardize all deployment: setup.sh, start.sh, stop.sh.

Local

./setup.sh        # one-time: installs all dependencies
./start.sh        # starts API + App via PM2
./stop.sh         # stops all servers
./stop.sh api     # stops a specific server

Docker

./start.sh --docker              # build + run (image: mod, container: mod)
./start.sh --docker myimg mycon  # custom image/container names
./stop.sh --docker               # stops the mod container
./stop.sh --docker mycon         # stops a specific container

Scripts

ScriptPurpose
setup.shInstalls node, pm2, rust, mod (editable), commune
start.shStarts API + App locally, or --docker for containerized
stop.shStops all mod servers (PM2) or --docker for container

Usage

CLI

m mods                        # list all 218 modules
m info agent                  # inspect a module
m serve agent                 # start its API server
m kill agent                  # stop it

Python

import mod as m

agent = m.mod('agent')()                              # load a module
result = m.fn('agent/chat')({'message': 'hello'})     # call a function
m.serve('agent')                                       # start server

Calling a function from the CLI

m agent/chat message="hello"    # calls agent.chat(message="hello")
m safe/balance                  # calls safe.balance()

Arguments are auto-coerced: ints, floats, bools, JSON all just work.

Architecture

Three layers: Orbit (modules), Core (engine), Chain (on-chain protocol).

┌──────────────────────────────────────────────────────┐
│  ORBIT  218 modules                                  │
│  agent · claude · safe · bridge · uniswap · ipfs     │
│  goldfi · prefi · hyperliquid · venice · zcash · ... │
└──────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────┐
│  CORE   mod.py (1800 lines, 210+ methods)            │
│  module loading · routing · crypto · storage · cli   │
└──────────────────────────────────────────────────────┘
┌──────────────────────────────────────────────────────┐
│  CHAIN  StakeTime Protocol (Base)                    │
│  registry · market · treasury · staking · oracles    │
└──────────────────────────────────────────────────────┘

Directory layout

mod/
├── core/
│   ├── mod.py          # the engine — module loading, crypto, storage, 210+ methods
│   ├── utils.py        # networking, async, system helpers
│   ├── chain/          # Solidity contracts (StakeTime protocol)
│   ├── app/            # Next.js frontend
│   ├── api/            # module registry, IPFS, blockchain ops
│   ├── server/         # process management
│   ├── store/          # encrypted KV store (AES-256)
│   ├── key/            # key management (ED25519, ECDSA, SR25519)
│   ├── cli/            # the `m` command
│   ├── router/         # API gateway
│   └── gate/           # auth & token gating
│
└── orbit/              # 218 modules
    ├── agent/          # AI agents with memory & planning
    ├── claude/         # Claude integration
    ├── safe/           # Gnosis Safe multisig
    ├── bridge/         # cross-chain (Across, Squid, Hyperlane)
    ├── uniswap/        # Uniswap v3
    ├── hyperliquid/    # perpetual DEX
    ├── goldfi/         # gold-backed stablecoin
    ├── ipfs/           # decentralized storage
    └── ...             # 210 more

Modules

Every module lives in mod/orbit/<name>/ and contains:

FilePurpose
mod.pyThe module class — all logic lives here
config.jsonName, ports, contracts, schema, endpoints
skill.mdCapability docs, usage examples, API table

Notable modules

ModuleWhat it does
agentAutonomous AI agents with memory, skills, multi-step planning
claudeClaude API — Rust backend + React UI
safeGnosis Safe multisig via ethers.js + ABI
bridgeCross-chain bridges (Across, Squid, Hyperlane)
uniswapUniswap v3 — swaps, LP, analytics
goldfiGold-backed stablecoin (XAU-pegged)
prefiPrediction markets with AMM
hyperliquidHyperliquid perps integration
ipfsIPFS/Filecoin storage
veniceVenice AI models
zcashPrivacy transactions

Browse all: mod/orbit/

StakeTime Protocol

The on-chain layer. Modular primitives for registration, payments, staking, and consensus — each deployable independently, composable together.

Chain: Base (EVM L2)  |  Contracts: Solidity 0.8.20 + OpenZeppelin

Contracts

ContractPurpose
RegistryModule registration, metadata, versioning
MarketPricing, purchases, instant withdrawals
TreasuryRevenue distribution, multi-token splits
BlocTimeTime-weighted staking, governance weight
TokenGateToken-gated access control
PermsRole-based permissions
OraclesPrice feeds (Chainlink, Pyth)

Payment flow

Register module → Set price → User calls function → Payment to treasury → 80/20 split → Withdraw anytime

Developer gets 80%. Protocol gets 20%. No vesting, no delays.

Deploy contracts

cd mod/core/chain
npx hardhat node                                        # local
npx hardhat run scripts/deploy.js --network localhost   # deploy local
npx hardhat run scripts/deploy.js --network base        # deploy mainnet

Full protocol spec: docs/whitepaper.md

CLI Reference

# discovery
m mods                        # list modules
m info <mod>                  # inspect module config, endpoints, deps
m code <mod>                  # view source
m dp <mod>                    # get module directory path

# servers
m serve <mod>                 # start API server (wraps module class)
m serve <mod>.app             # start API + Next.js frontend
m servers                     # list running servers
m kill <mod>                  # stop server
m restart <mod>               # restart server

# development
m test <mod>                  # run tests
m build <mod>                 # build (Docker, npm, etc.)
m deploy <mod>                # deploy to registry
m logs <mod>                  # tail logs

# git
m push "message"              # add + commit + push
m status                      # git status
m diff                        # git diff

Python API

import mod as m

# modules
agent = m.mod('agent')()
result = m.fn('agent/chat')({'message': 'hello'})
info = m.info('agent')

# servers
m.serve('api', port=8000)
m.kill('api')

# crypto
key = m.get_key('my_key')
sig = m.sign({'data': 'value'}, key='my_key')
encrypted = m.encrypt('secret', key='my_key')

# storage
m.put('user:1', {'name': 'alice'})
user = m.get('user:1')
m.put('api_key', 'secret', encrypt=True)

# AI
response = m.ask('explain this', model='claude')

Stack

LayerTech
ContractsSolidity 0.8.20, Hardhat, OpenZeppelin, ethers.js v6
BackendPython 3.11+, FastAPI, Redis
FrontendNext.js 14, React, TypeScript, Tailwind
ChainBase (EVM L2)
AIClaude, OpenAI
StorageIPFS, AES-256 encrypted KV

Docs

DocContents
docs/cli.mdCLI reference
docs/modules.mdModule system
docs/orbit.mdOrbit module guide
docs/api.mdAPI & endpoints
docs/contracts.mdSmart contract spec
docs/keys.mdKey management
docs/storage.mdStorage system
docs/whitepaper.mdStakeTime protocol paper

License

MIT — see LICENSE.


Code is capital.

Contributors

einsum69

2 commits

agimarx42

1 commits

Languages

Rust

53.3%

TypeScript

21.1%

Python

17.3%

JavaScript

2.4%

CSS

1.7%

Solidity

1.5%

HTML

1.1%