A Tokeneconomics Simulator.
View Demo
Tokesim is an Agent Based Modeling tool that makes it easy to test token economic models. It's built using mesa-behaviors an extension to Mesa that makes models,agents,utility functions and strategies shareable and more extensible. The goal of Tokesim is to help developers run simulations against smart contracts, in a blockchain agnostic way, using shareable and reusable modules and libraries to do so.
Tokesim Features:
- Type hints to make agents and models extensible
- Ability to run against and simulation against your smart contracts
- An architecture to make the simulations portable to multiple chains
- ChartJS integration from Mesa framework
- Support for testing Ethereum based smart contracts directly
- node
v10.15.3
or later - npm
v6.4.1
or later - python
3.7
or later but not 3.8 ;)
Clone/ download the project, and install dependencies. For development
git clone https://github.com/tokesim/tokesim.git && cd tokesim
python3.7 -m venv venv
source venv/bin/activate
pip install poetry
poetry build
npm install -g @tokesim/tokesim-chain
# in a new terminal window
tokesim-chain --port 5554
or
pip install tokesim
npm install -g @tokesim/tokesim-chain
# in a new terminal window
tokesim-chain --port 3004
In order to run a simulation against a chain the default init will create a simulation for you to modify as you see fit. You'll need to start the chain simulation service.
# remember to activate your venv
source venv/bin/activate
pip install tokesim
# just like create react app generate template
tokesim init --dir simple-token --agents 20
#start chain simulator
tokesim-chain -c ethereum --port 3004
#run the simulation defaults to terminating after 100 steps
tokesim run --config ./simple-token/simulation.json --port 3004
By default tokesim init will generate a default application layout, that specifies the accounts used a balance for each of the agents as well as configuration file and some simple bonded token curve agents. The contracts specified are a listed here
# ./simple-token/
.
└── simple-token
└── contracts
| |── SimpleToken.bin
| └── SimpleToken_abi.json
|── accounts.json
|── config_schema.json
|── simple_token_agent.py
|── simple_token_model.py
|── simple_token_config.py
└── simulation.json
Explanation coming soon
Coming soon
How to contribute, build and release are outlined in CONTRIBUTING.md, BUILDING.md and RELEASING.md respectively. Commits in this repository follow the CONVENTIONAL_COMMITS.md specification.
Apache License 2.0