- Rust 83.6%
- Shell 15.4%
- Makefile 1%
|
|
||
|---|---|---|
| .forgejo/workflows | ||
| rhai_examples/my_simulator | ||
| scripts | ||
| src | ||
| .gitignore | ||
| build.sh | ||
| buildenv.sh | ||
| Cargo.toml | ||
| docs.sh | ||
| LICENSE | ||
| Makefile | ||
| README.md | ||
my_simulator
What this is
A simulator for the Mycelium Grid that models how value and profit are created in distributed compute infrastructure. It is both a learning tool and the foundation for a transparent calculator that shows how real economics emerge from shared compute infrastructure and AI workloads.
The simulator is built around a Rhai script executor (mysimulator) that runs capacity-provider simulations, enabling programmatic exploration of node specifications, resource allocation, and economic outcomes.
What the Simulator Models
The Mycelium Grid has two clearly separated layers:
1. Infrastructure Layer — Cloud Slices
At the bottom layer, physical machines are sliced into small, usable units called cloud slices.
A cloud slice represents:
- A portion of CPU or accelerator time
- A defined amount of memory
- Storage capacity
- Network bandwidth
- Energy consumption
Think of this as:
One physical computer → many independent, sellable micro-resources
The simulator models:
- How many slices a machine can produce
- The cost of running those slices (energy, depreciation, maintenance)
- The base revenue generated per slice
- Utilization over time (idle vs active capacity)
This is the ground truth economics of the grid.
2. Intelligence Layer — Models & Agents
On top of the cloud slices lives the intelligence layer:
- Large Language Models
- Smaller task-specific models
- Agentic systems that run continuously
These workloads consume cloud slices.
The simulator shows:
- How AI workloads translate into slice demand
- How different models consume different resources
- How higher-value workloads generate higher returns
- How coordination and orchestration increase efficiency
This layer is where raw compute turns into economic value.
How the Economic Model Works
The simulator connects both layers into a single economic flow:
- Farmers provide machines
- Machines are split into cloud slices
- Cloud slices are consumed by models and agents
- Models generate useful work
- Useful work generates revenue
- Revenue is distributed back to:
- Farmers
- Operators
- The grid itself
The key insight the simulator makes visible:
Profit is not created by hardware alone, but by how intelligently slices are used.
The Calculator Vision
This repo is the foundation for a visual, interactive calculator that lets farmers answer questions like:
- How many machines should I run?
- What happens if utilization goes from 40% to 70%?
- What kind of workloads generate the best returns?
- How does AI demand affect my monthly income?
- Where are the break-even points?
The goal is clarity, not hype:
- Transparent assumptions
- Simple inputs
- Honest outputs
What this repository contains
src/main.rs—mysimulatorbinary: Rhai script executor for capacity provider simulationssrc/lib.rs— Library root aggregating simulator componentssrc/capacityprovider_os/— OS-level capacity provider module with Rhai bindingsCargo.toml— Package manifest
Usage:
mysimulator <script_path>
Example scripts can be found in src/capacityprovider_os/examples/ and rhai_examples/my_simulator/.
Dependencies:
- herolib_core — Core types and utilities
- herolib_os — OS abstractions
- herolib_virt — Virtualization tools
- rhai — Scripting engine for simulation logic
Role in the stack
This component provides the economic modeling and capacity-planning foundation for the Mycelium Grid. It helps farmers and operators understand infrastructure economics, optimize resource allocation, and forecast returns from compute and AI workloads.
Relation to ThreeFold
This technology is used within the ThreeFold ecosystem and was first deployed on the ThreeFold Grid. The component itself is designed as reusable infrastructure technology and should be understood by its technical function first, independent of any specific deployment.
Ownership
This repository is owned and maintained by TF-Tech NV, a Belgian company responsible for the development and maintenance of this technology.
License
This project is licensed under the Apache License 2.0 — see the LICENSE file for details.