No description
  • Rust 83.6%
  • Shell 15.4%
  • Makefile 1%
Find a file
despiegk 4591cd338c
Some checks failed
Build and Test / build (push) Failing after 12s
chore: canonicalize LICENSE
2026-05-27 19:58:47 +02:00
.forgejo/workflows Add build_lib standardization: buildenv.sh, scripts/build_lib.sh, Makefile, CI workflows 2026-02-07 09:48:08 +04:00
rhai_examples/my_simulator init 2025-12-27 20:37:54 +01:00
scripts Add build_lib standardization: buildenv.sh, scripts/build_lib.sh, Makefile, CI workflows 2026-02-07 09:48:08 +04:00
src schemas 2026-01-19 07:41:33 +01:00
.gitignore Initial commit 2025-12-27 19:18:26 +00:00
build.sh specs 2026-01-17 10:17:58 +01:00
buildenv.sh Add build_lib standardization: buildenv.sh, scripts/build_lib.sh, Makefile, CI workflows 2026-02-07 09:48:08 +04:00
Cargo.toml Update herolib dependencies to version 0.3.13 and fix package naming 2026-02-17 04:48:47 +04:00
docs.sh init 2025-12-27 20:37:54 +01:00
LICENSE chore: canonicalize LICENSE 2026-05-27 19:58:47 +02:00
Makefile Fix Makefile cargo and shell compatibility 2026-02-07 20:54:23 +04:00
README.md docs: restructure README with standard sections 2026-05-27 16:24:55 +02:00

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:

  1. Farmers provide machines
  2. Machines are split into cloud slices
  3. Cloud slices are consumed by models and agents
  4. Models generate useful work
  5. Useful work generates revenue
  6. 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.rsmysimulator binary: Rhai script executor for capacity provider simulations
  • src/lib.rs — Library root aggregating simulator components
  • src/capacityprovider_os/ — OS-level capacity provider module with Rhai bindings
  • Cargo.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.