A peer-to-peer crypto validator network to verify and append transactions.
Always follow the guidance in the Security Policy for release compatibility, upgrade steps, and required follow-up actions.
The MSB leverages the Pear Runtime and Holepunch.
Node.js is required to run the application. Before installing Node.js, refer to the official Node.js documentation for the latest recommended version and installation instructions. For this project, Node.js v24.11.0 (LTS) and npm 11.6.1 or newer are compatible.
The Pear Runtime CLI is required to run the application. Before installing Pear, refer to the official Pear documentation for the latest recommended version and installation instructions. For this project, the latest Pear CLI is compatible.
Install Pear globally:
npm install -g pear
which pearDocker is optional and only needed for running the containerized RPC node. Before installing Docker, refer to the official Docker documentation for the latest recommended version and installation instructions. For running the containerized RPC node, the latest Docker is recommended. Tested with Docker version 28.3.2, build 578ccf6.
git clone -b main --single-branch [email protected]:Trac-Systems/main_settlement_bus.git
cd main_settlement_bus
npm installBefore running tests, install bare globally:
npm install -g bare- β
npm run test:unit:allβ confirms the codebase builds and runs under both supported runtimes. - π
npm run test:acceptanceβ optional but recommended before upgrades. This suite spins up in-process nodes and may take a few minutes. - π RPC smoke test β start
MSB_STORE=smoke-store MSB_HOST=127.0.0.1 MSB_PORT=5000 npm run env-prod-rpcin one terminal, then executecurl -s http://127.0.0.1:5000/v1/feefrom another terminal to verify/v1routes respond. Stop the node withCtrl+Conce finished.
Runtime entry points cover CLI-driven runs (prod, prod-rpc) and .env-aware runs (env-prod, env-prod-rpc). Each section below lists the accepted configuration inputs.
This variant reads configuration from .env:
# .env
MSB_STORE=<store_name>
then
npm run env-prod
The script sources .env before invoking program and falls back to node-store when MSB_STORE is not defined.
MSB_STORE=<store_name> npm run env-prodThis run persists data under ./stores/${MSB_STORE} (defaults to node-store) and is intended for inline or CLI-supplied configuration.
npm run prod --store=<store_name># .env
MSB_STORE=<store_name>
MSB_HOST=127.0.0.1
MSB_PORT=5000
npm run env-prod-rpc
This entry point sources .env automatically and defaults to rpc-node-store, 127.0.0.1, and 5000 when variables are not present.
MSB_STORE=<store_name> MSB_HOST=<host> MSB_PORT=<port> npm run env-prod-rpcOverride any combination of MSB_STORE, MSB_HOST, or MSB_PORT. Data is persisted under ./stores/${MSB_STORE} (default rpc-node-store for this script).
npm run prod-rpc --store=<store_name> --host=<host> --port=<port>You can run the RPC node in a containerized environment using the provided docker-compose.yml file. The msb-rpc service is already wired up. You usually only need to tweak these variables:
MSB_STORE: name of the store directory under./stores.MSB_HOST: host interface to bind (defaults to127.0.0.1to avoid exposing everything).MSB_PORT: port the RPC server listens on inside the container (defaults to5000).MSB_PUBLISH_PORT: host port to expose (defaults toMSB_PORT, so set it only when the host port should differ).
Leave MSB_PORT=5000 if you just want to publish the default RPC port and only bump MSB_PUBLISH_PORT when the host side must change. Set both to the same value if you want the RPC server itself to listen on another port.
Example (keep container port 5000, expose host port 6000):
MSB_STORE=rpc-node-store \
MSB_HOST=127.0.0.1 \
MSB_PORT=5000 \
MSB_PUBLISH_PORT=6000 \
docker compose up -d msb-rpcAny of the following launch methods can be applied:
-
Using a
.envfile β populate.env, then start the service:docker compose up -d msb-rpc
or
docker compose --env-file .env up -d msb-rpc
Add any of the variables listed above to
.env. When the host port needs to differ from the container port, setMSB_PUBLISH_PORTwithout touchingMSB_PORT.Example
.env(publishes host port 1337, keeps the container on 5000):MSB_STORE=rpc-node-store MSB_HOST=127.0.0.1 MSB_PORT=5000 MSB_PUBLISH_PORT=1337
-
Passing variables inline β use this method when environment variables should be provided directly in the command line, without modifying the
.envfile:MSB_STORE=<store_name> MSB_HOST=<host> MSB_PORT=<container_port> MSB_PUBLISH_PORT=<host_port> docker compose up -d msb-rpc
Skip
MSB_PORTwhen you just want to keep the container on5000and expose a different host port. -
Reusing an existing store directory β mount the path that already holds your store and pin the host binding you need:
docker compose run -d --name msb-rpc \ -e MSB_STORE=<store_name> \ -e MSB_HOST=<host> \ -e MSB_PORT=<container_port> \ -e MSB_PUBLISH_PORT=<host_port> \ -p <host_address>:<host_port>:<container_port> \ -v /absolute/path/to/your/store_directory:/msb/stores \ msb-rpc
Adjust
/absolute/path/to/your/store_directoryto the directory that already contains the persisted store. Once the container exists, bring it back withdocker compose start msb-rpc. If the container should stay on5000, omit-e MSB_PORT=<container_port>and just setMSB_PUBLISH_PORTplus the matching-pflag.Example with specific values:
docker compose run -d --name msb-rpc \ -e MSB_STORE=rpc-node-store \ -e MSB_HOST=127.0.0.1 \ -e MSB_PORT=5000 \ -e MSB_PUBLISH_PORT=6000 \ -p 127.0.0.1:6000:5000 \ -v /absolute/path/to/your/store_directory:/msb/stores \ msb-rpc
Stop the service with docker compose stop msb-rpc, remove the stack entirely with docker compose down when you are finished.
Note: The RPC instance must synchronize with the network after startup, so full readiness may take some time.
- Dependency install failures β confirm you are on Node.js v24.11.0 (LTS) and npm β₯ 11.6.1. If packages still fail to build, clear artifacts (
rm -rf node_modules package-lock.json && npm install) and rerunnpm run test:unit:all. - Unit tests fail only in one runtime β run the targeted commands (
npm run test:unit:nodeornpm run test:unit:bare) to isolate regressions, then inspecttests/unit/unit.test.jsfor the failing cases.