{"id":24054637,"url":"https://github.com/cardinal-cryptography/traffic-maker","last_synced_at":"2025-08-18T09:14:10.005Z","repository":{"id":103035617,"uuid":"464823437","full_name":"Cardinal-Cryptography/traffic-maker","owner":"Cardinal-Cryptography","description":"Fabulous bots making some noise on Substrate-based chains","archived":false,"fork":false,"pushed_at":"2023-07-13T10:41:30.000Z","size":509,"stargazers_count":3,"open_issues_count":1,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-22T20:50:45.635Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Cardinal-Cryptography.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-01T09:19:41.000Z","updated_at":"2024-09-03T21:47:38.000Z","dependencies_parsed_at":"2023-07-24T07:00:22.380Z","dependency_job_id":null,"html_url":"https://github.com/Cardinal-Cryptography/traffic-maker","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Cardinal-Cryptography/traffic-maker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ftraffic-maker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ftraffic-maker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ftraffic-maker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ftraffic-maker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Cardinal-Cryptography","download_url":"https://codeload.github.com/Cardinal-Cryptography/traffic-maker/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Cardinal-Cryptography%2Ftraffic-maker/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270969266,"owners_count":24677286,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-18T02:00:08.743Z","response_time":89,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-09T03:49:09.030Z","updated_at":"2025-08-18T09:14:09.997Z","avatar_url":"https://github.com/Cardinal-Cryptography.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Traffic Maker\n\nThe code in this repository aims at filling two objectives:\n  1. real-world **traffic simulation** on a blockchain - obviously, in a simplified way\n  2. **comprehensive testing** of all available features and functionalities - kinda E2E-tests on steroids\n\n## Installation and usage\n\nApart from Rust version specified in [`rust-toolchain`](rust-toolchain) you do not need anything more installed.\n\n### Launching the default setting\n\nTo run the default scenario suite, you need a running chain with some node accessible via ws port.\nBy default, bots will try communicating with `127.0.0.1:9944`.\nIn order to change that, see the [Adjusting configuration](#adjusting-configuration) section.\n\nFor most actions, bots will need some tokens to pay fees.\nTo set up test accounts with funds run:\n\n```shell\n$ make setup\n```\n\nAfterwards, to start the test worker run:\n\n```shell\n$ make run\n```\n\n### Launching with default settings (docker)\n\nIf you prefer running bots in a docker container, you can call:\n\n```shell\n$ make setup\n$ make docker\n```\nThis will launch `docker-compose` accoring to [`docker/docker-compose.yml`](docker/docker-compose.yml).\nIf your chain is running on `localhost`, you will have to exchange line `node = \"127.0.0.1:9944\"` with `node = \"host.docker.internal:9944\"` in [`Timetable.toml`](Timetable.toml).\n\n**Note:** To enable backend to communicate with local chain from docker you will need to run node with `--unsafe-rpc-external` and `--unsafe-ws-external` flags.\n\nIn addition, monitoring service will be served at `localhost:8080`.\n\n### Adjusting configuration\n\n#### Scenario configuration and scheduling\n\nThe main file is [`Timetable.toml`](Timetable.toml). There you can specify:\n\n  - `node` (by default `127.0.0.1:9944`): it is the web socket address to which bots will connect\n  - `expose_host` (by default `0.0.0.0:8080`): address where statistics are published\n  - which bots to launch and their parameters\n\nStatistics are exposed at two endpoints under the `expose_host` address.\nMain data is served at `/details` (brief information about every launched scenario) and logs from particular scenarios are displayed at `/logs/\u003cscenario identifier\u003e`.\n\nEach scenario configuration contains three obligatory fields:\n\n  - `kind` - this specifies which scenario to run\n  - `ident` - a unique identifier of this particular bot (you can launch multiple bots of the same `kind`, but they have to be distinguishable by `ident`)\n  - `interval` - (human-readable) amount of time that should pass between finishing a run and the subsequent launch\n\nApart from that, most scenarios have some parameters (like strategy or scale) which you can tweak.\n\n#### Account endowments\n\nYou can configure the initial endowments in [`set_up/Config.toml`](/set_up/Config.toml).\nFor details check [`set_up/README.md`](/set_up/README.md).\n\nAccounts are given by their seeds.\n\n_Note: In a production environment you usually do not want your bots to be exposed to access from anyone.\nTherefore, before launching `make setup` and `make run` (`make run-docker`), you can set an environment variable `SECRET_PHRASE_SEED`.\nBe aware that this is a **compile-time variable**, which means that changing it requires recompilation._\n\n### Monitoring\n\nYou can use the provided GUI to browse the statistics by running:\n\n```shell\n$ make monitoring\n```\n\nThis will start a [`trunk`](https://trunkrs.dev/) server with the GUI and open a new browser tab to take you there.\nBy default, it will be launched at `127.0.0.1:8040`.\nTo change its configuration, check [`monitoring/Trunk.toml`](monitoring/Trunk.toml).\nFor more details consult [`monitoring/README.md`](monitoring/README.md).\n\n## Development\n\n### Project structure\n\n  - [`common`](common) (lib crate): contains the heart of this repo, i.e. the `Scenario` trait together with some useful utilities around it\n  - [`chain-support`](chain-support) (lib crate): is a library providing functionality for chain interaction, useful in scenario development;\nserves as a wrapper around [`aleph-client`](https://github.com/Cardinal-Cryptography/aleph-node/tree/main/aleph-client) and [`substrate-api-client`](https://github.com/scs/substrate-api-client)\n  - [`traffic`](traffic) (lib crate): is responsible for scheduling and launching scenarios\n  - [`scenarios`](scenarios) (collection of lib crates): gathers independent crates, each focusing on testing a different aspect; \nsomething like [`frame`](https://github.com/paritytech/substrate/tree/master/frame) directory for pallets crates in the Substrate repository\n  - [`bin`](bin) (binary crate): serves for launching the application from command line and providing environment configuration;\nadditionally starts a web server exposing statistics\n  - [`monitoring`](monitoring) (bin crate): (web) frontend part of application\n  - [`set_up`](set_up) (bin crate): is responsible for endowing bot accounts\n \n### Building docker image\n\nJust run:\n```shell\n# for backend image (it will be tagged `traffic-maker`)\n$ make build-backend-docker\n# or for frontend image (it will be tagged `traffic-maker-monitoring`)\n$ make build-frontend-docker\n```\n\n### Adding new scenarios\n\nIn order to implement a new scenario, follow these steps:\n\n  1. If its scope fits into any existing subdirectories (crates) in [`scenarios`](scenarios), add a new module there (and register it in a corresponding `lib.rs`)\nOtherwise, you will need to create a new crate.\nIt will need to be registered in the default workspace ([`Cargo.toml`](Cargo.toml)).\nAlso, you will have to add it as a dependency to [`bin/Cargo.toml`](bin/Cargo.toml)\n  2. Write your scenario by implementing `Scenario` from the [`common`](common) crate.\nInstantiating an object of your class should be done in an analogous way to other scenarios (through a mirror data structure, see e.g. [`scenarios/transfer/src/simple_transfer.rs`](scenarios/transfer/src/simple_transfer.rs)).\n  3. Enable creating your scenario from a configuration file.\nFor this, extend `enum ScenarioConfig` in [`bin/src/config.rs`](bin/src/config.rs) and a corresponding method there (`construct_scenario`).\nYou should just follow the existing code and prepare very similar handling.\n  4. If you need some accounts to have an initial balance, see the [Account endowments](#account-endowments) section.\n\n### Deploying to Testnet\n\nAfter your PR is merged into main, a new docker image (containing only backend part) will be built and pushed to a private registry (AWS ECR).\nTo launch it on a server (we have a dedicated EC2 instance for that), you will need to ssh there and run the new image manually.\nFor details contact @pmikolajczyk41 or @skrolikowski-10c.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcardinal-cryptography%2Ftraffic-maker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcardinal-cryptography%2Ftraffic-maker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcardinal-cryptography%2Ftraffic-maker/lists"}