Simulation Sandbox

Test with Simulated Agents

Run multi-agent simulations locally to test task coordination, oracle attestation, and settlement flows before deploying to real robots.

Getting Started

Clone the repository and run the Python simulation swarm

1. Clone the Repository

bash
git clone https://github.com/dexbotics/market_prod.git\ncd market_prod

2. Navigate to Python Simulation

bash
cd sims/python

3. View the Simulation Code

swarm.py
import random
import time
import json

def simulate():
    agents = [f"robot-{i:02d}" for i in range(5)]
    for t in range(8):
        agent = random.choice(agents)
        evt = {
            "t": t,
            "assignee": agent,
            "proof_hash": "0x" + "07" * 32
        }
        print(json.dumps(evt))
        time.sleep(0.05)

if __name__ == "__main__":
    simulate()

4. Run the Simulation

bash
python swarm.py

5. Example Output

json
{"t": 0, "assignee": "robot-02", "proof_hash": "0x070707..."}
{"t": 1, "assignee": "robot-04", "proof_hash": "0x070707..."}
{"t": 2, "assignee": "robot-01", "proof_hash": "0x070707..."}

Simulation Features

Multi-Agent Coordination

Spawn multiple simulated robots that compete for tasks, submit proofs, and settle on-chain

Oracle Network Simulation

Run simulated oracle nodes with configurable attestation types and stake weights

Dispute Scenarios

Test edge cases with contested tasks, oracle disagreement, and evidence submission

Performance Metrics

Track throughput, latency, success rates, and gas costs in real-time