Binaries and scripts¶
Binaries live in stealth_name_service/backend/testing_backend/src/bin/
(plus src/main.rs) and run with cargo run --bin <name>. Scripts live in
stealth_name_service/backend/. This page lists what each one does, how to run it, and
every flag with its default.
| Name | Kind | What it does |
|---|---|---|
testing_backend |
Service | HTTP API for SendPTB (and the deprecated SendAAPTB) (src/main.rs) |
loadtest |
Service, tool | Concurrent load generation and CSV export |
event_listener |
Service | Polls the source module and forwards new events |
event_handler |
Service | Builds, signs and submits the destination transaction |
consensus_committee |
Service | Optional CometBFT committee in front of the handler |
bridge_aa_init |
Tool | Creates a BridgeAA account and seeds its ACL |
bridge_acl_add |
Tool | Authorises more source senders on an existing account, in batches |
bridge_aa_coins |
Tool | Re-splits a BridgeAA's balance into a uniform gas-coin pool |
bench_sweep |
Tool | Runs loadtest across submission windows and repetitions (T5/T6) |
aa_init |
Tool | Deprecated: setup for the older abstract_account package (ENABLE_AA path) |
deploy.sh |
Script | Swarm reset, build and deploy for every mode |
consensus_smoke.sh |
Script | Local, gas-free end-to-end test of the committee |
consensus_compare.sh |
Script | Committee scenario sweep with a markdown report |
Variables are described in Configuration; this page only names them. The
tools that load .env (dotenv) are testing_backend, bridge_aa_init, bridge_acl_add,
bridge_aa_coins and aa_init, so run those from stealth_name_service/backend/testing_backend/
or export the variables. The repository layout moved to Repository layout.
testing_backend¶
The HTTP API that builds, signs and submits a PTB for the agent in the request. It is the default
CMD of the Docker image (/app/testing_backend). It takes no flags.
- Listens on
0.0.0.0:5000, or0.0.0.0:8443withENABLE_HTTPS=true. Routes: HTTP endpoints. - Reads
iota.keystorefrom its working directory (the path is fixed in the code). - Connects to devnet and testnet gRPC endpoints, builds one coin cache per sender, and warms the
caches in the background after the server binds, so
/healthanswers at once and/readyflips when warming ends. - Environment:
ENABLE_HTTPS,ACTIX_WORKERS,GRPC_POOL_SIZE,COINS_PER_REPLICA,SENDER_ADDRESS,BACKEND_DEBUG_LEVEL,TLS_CERT_PATH,TLS_KEY_PATH,HOSTNAME. See Backend. - The legacy variables
ENABLE_AA,AA_ACCOUNT_ID_DEVNET,AA_PACKAGE_ID_DEVNET,AA_FUNCTION_NAMEandBENCH_OBJECT_IDS. Apart fromENABLE_AAitself, they are read only whenENABLE_AA=true(Deprecated, see Legacy account abstraction).
loadtest¶
Spawns concurrent agents that POST a payload template to the backend and writes one CSV row per request. Used in Track A and as the load generator of Track C.
cd stealth_name_service/backend/testing_backend
cargo run --release --bin loadtest -- --agents 100 --requests 10 --interval 1 \
--json ../agent/payloads/get_time.json --target-url http://localhost:5000/api/SendPTB
It reads ./iota.keystore from its working directory and uses one address per agent; it exits with
Not enough keys in keystore if the keystore has fewer addresses than --agents. Each run writes
PTB_CALL_<unix timestamp>/merged_results.csv and run.json under OUTPUT_DIR (default
./output). Columns: CSV schemas.
| Flag | Default | Meaning |
|---|---|---|
--agents |
1000 |
Number of concurrent agent tasks. |
--requests |
100 |
Requests per agent. |
--interval |
1.0 |
Base interval between requests, in seconds. Must be above 0. |
--gas-budget |
5000000 |
Gas budget per transaction. Also read from LOADTEST_GAS_BUDGET. |
--target-url |
http://localhost:5000/api/SendPTB |
Endpoint to POST to. |
--json |
required | Path to the payload template. |
--arrival-type |
default |
default, staircase or poisson. |
--increment-interval |
none | Seconds between staircase steps. Required, and above 0, for staircase. |
--max-requests-per-interval |
none | Highest requests per interval the staircase reaches. Required, at least 1, for staircase. |
--poisson-lambda |
none | Per-agent rate in requests per second. Required, above 0, for poisson. |
--pipeline-depth |
1 |
Maximum in-flight requests per agent. At least 1; must not exceed COINS_PER_REPLICA on the backend. Also read from LOADTEST_PIPELINE_DEPTH. |
--run-id |
none | Label written to run.json. Descriptive only. |
--input-rate |
none | Nominal offered rate (requests per second) this run represents. Written to run.json next to the achieved rate. |
--rep |
none | Repetition index within a sweep, 0-based. Descriptive only. |
Environment: OUTPUT_DIR, LOADTEST_GAS_BUDGET, LOADTEST_PIPELINE_DEPTH.
event_listener¶
Polls the source chain for events of one module and forwards each new one to the event handler (or
to the committee, when it is enabled). It takes no flags. Docker command: /app/event_listener.
- Polls the JSON-RPC endpoint in
EVENT_LISTENER_RPC_URLeveryEVENT_LISTENER_POLL_MSmilliseconds, filtered byEVENT_LISTENER_PACKAGE_IDandEVENT_LISTENER_MODULE, and, whenEVENT_LISTENER_EVENT_TYPEis set, by event type. - Keeps state in
data/(cursor.json,events.jsonl,processed_events.json). By default it deletes them at start so every deploy begins at the chain tip; setEVENT_LISTENER_RESET_CURSOR=falseto resume. - Forwards to
EVENT_HANDLER_URL, or toCONSENSUS_INGEST_URLwhenCONSENSUS_ENABLEDis on. - Environment: see Event listener. Design: The event listener.
event_handler¶
Receives events, builds the destination transaction, signs it and submits it, and writes one
bridge_results.csv row per event. It takes no flags. Docker command: /app/event_handler.
- Listens on
0.0.0.0:5000, path/api/handle_event. It answers as soon as the event is queued. WithCONSENSUS_ENABLEDon, only deliveries signed by the committee are accepted. See HTTP endpoints. - Modes:
EVENT_HANDLER_MODE=staticruns a fixed call;bridgebuilds the call from the event and runs it through theBridgeAA. WithBRIDGE_PROTOCOL_PHASES=3it also acknowledges each successful request on the source chain. - Startup checks, each a startup error: the signer is in the keystore; the
BridgeAAis bound toBRIDGE_TARGET_CHAIN_ID; theBridgeAAACL has an entry for the relayer onBRIDGE_SOURCE_CHAIN_ID; theBridgeAAowns at least one gas coin. - Deletes
data/bridge_results.csvat start, then appends. Columns: CSV schemas. - Environment: Event handler, Bridge account, Acknowledgement and the committee group. Design: The event handler.
consensus_committee¶
Runs the BFT committee of virtual relayer nodes between the listener and the handler. It takes no
flags. Docker command: /app/consensus_committee.
- Needs
CONSENSUS_DELIVERY_KEY,BRIDGE_SOURCE_CHAIN_IDandBRIDGE_TARGET_CHAIN_ID, and, unlessCONSENSUS_CHECK_ACL=false,BRIDGE_AA_ACCOUNT_IDandBRIDGE_AA_PACKAGE_ID. - Starts one CometBFT process per live validator (plus a twin per
equivocatenode), each with its own ABCI app inside the Rust process. Their homes andcometbft.loggo toCONSENSUS_HOME. - Listens on
CONSENSUS_LISTEN_ADDR(default0.0.0.0:5000). Routes: HTTP endpoints. - Exits once every CometBFT process has exited.
- Environment: Consensus committee. Design: The consensus committee inside.
bridge_aa_init¶
Creates the destination BridgeAA with a two-command PTB and seeds its ACL. It takes no flags; all
input comes from the environment.
- The relayer (
EVENT_HANDLER_SIGNER, falling back toSENDER_ADDRESS) is always seeded as the bootstrap ACL entry.createrejects an empty ACL, and every admin function needs the account itself as sender, so losing that entry would make the ACL uneditable. - Every address in
BRIDGE_ACL_SOURCE_SENDERSis seeded too. Each entry maps to the relayer's public key. With the variable unset it prints a warning: only the relayer's own address is authorised. - Environment:
BRIDGE_AA_PACKAGE_ID,BRIDGE_SOURCE_CHAIN_ID,BRIDGE_TARGET_CHAIN_ID,EVENT_HANDLER_SIGNER,SENDER_ADDRESS,EVENT_HANDLER_KEYSTORE_PATH,KEYSTORE_PATH,EVENT_HANDLER_NETWORK,BRIDGE_AA_CREATOR,BRIDGE_ACL_SOURCE_SENDERS. - Prints the
.envlines to add (BRIDGE_AA_ACCOUNT_IDand the rest). The account then needs its own gas coins. See One-time bridge setup.
bridge_acl_add¶
Registers source-chain senders in an existing BridgeAA ACL, in batches. It must be a binary and
not a SendPTB payload because add_acl_entry requires the account itself as transaction sender.
It has two subcommands.
cd stealth_name_service/backend/testing_backend
cargo run --bin bridge_acl_add -- generate --batches 30
cargo run --bin bridge_acl_add -- apply ../agent/payloads/acl --dry-run
cargo run --bin bridge_acl_add -- apply ../agent/payloads/acl --verify
generate compares the signable keystore addresses with the ACL on chain and writes one JSON file
per transaction. apply signs and submits the batch files, one transaction each, and is idempotent
because add_acl_entry overwrites an existing key.
| Subcommand | Flag | Default | Meaning |
|---|---|---|---|
generate |
--out-dir |
../agent/payloads/acl |
Directory for the batch files, relative to testing_backend/. |
generate |
--batches |
30 |
Number of files; at least 1. Fewer are written when there are not enough senders. |
generate |
--limit |
none | Register only the first N missing senders. |
apply |
<paths> |
required | Batch files or directories of them. Directories are read in filename order. |
apply |
--gas-budget |
500000000 |
Gas budget per batch. Also read from BRIDGE_ACL_GAS_BUDGET. |
apply |
--dry-run |
off | Build and sign every batch but submit nothing. |
apply |
--verify |
off | Re-read the ACL afterwards and report which senders landed. |
Environment: BRIDGE_AA_PACKAGE_ID, BRIDGE_AA_ACCOUNT_ID, BRIDGE_TARGET_PACKAGE,
BRIDGE_SOURCE_CHAIN_ID, BRIDGE_TARGET_CHAIN_ID, signer and keystore variables. See
Managing the ACL.
bridge_aa_coins¶
Merges every coin the BridgeAA owns into one, then splits it into --count equal coins and sends
them back to the account. Stop the relayer first: it holds these coins and a merge deletes them.
cd stealth_name_service/backend/testing_backend
cargo run --release --bin bridge_aa_coins -- --count 2000 --amount 347000000 --dry-run
cargo run --release --bin bridge_aa_coins -- --count 2000 --amount 347000000
| Flag | Default | Meaning |
|---|---|---|
--count |
required | Number of equal coins to create. Must be above 0. |
--amount |
required | Balance of each new coin, in nanos (1 IOTA is 1000000000). Must be above 0. |
--split-per-tx |
500 |
New coins per split transaction; 1 to 500. |
--merge-per-tx |
500 |
Existing coins absorbed per merge transaction; 1 to 500. |
--split-gas-budget |
1000000000 |
Gas budget of a split transaction. |
--merge-gas-budget |
100000000 |
Gas budget of a merge transaction. |
--dry-run |
off | Build and sign every transaction but submit nothing. |
The pool ends as --count equal coins plus one remainder coin; re-running converges on the same
shape. It exits with an error if the account owns no gas coins. Environment:
BRIDGE_AA_PACKAGE_ID, BRIDGE_AA_ACCOUNT_ID, BRIDGE_TARGET_PACKAGE, chain ids, signer and
keystore variables. See Gas pool sizing.
bench_sweep¶
Drives loadtest repeatedly across a sweep and tags each run, for the T5/T6 comparison experiments.
It runs cells one after another, never concurrently. It cannot change the relayer's
BRIDGE_PROTOCOL_PHASES or BRIDGE_ACK_SIGNER; it prints a reminder and, when
--bridge-results-path is given, checks the relayer's output against --phase after each cell and
aborts on a mismatch.
cd stealth_name_service/backend/testing_backend
cargo build --release --bin loadtest --bin bench_sweep
cargo run --release --bin bench_sweep -- --windows 1 --json ../agent/payloads/bridge_request.json \
--bridge-results-path ../events_data/bridge_results.csv
Two modes. Window mode (--windows, the default) spreads a fixed transfer count over a number of
blocks using staircase arrivals; omitting both --windows and --rates runs 1,2,4,8,16,32,64.
Rate mode (--rates) holds each offered rate for --cell-secs with poisson arrivals. The two flags
conflict.
| Flag | Default | Meaning |
|---|---|---|
--windows |
1,2,4,8,16,32,64 when neither mode is given |
Submission windows in blocks, comma-separated. |
--rates |
none | Offered rates in requests per second, comma-separated. Conflicts with --windows. |
--cell-secs |
120.0 |
Rate mode: seconds each cell submits for. |
--block-secs |
5.0 |
Seconds per block in the window mapping. |
--total-transfers |
5000 |
Window mode: transfers per cell. |
--agents |
1000 |
Concurrent agents, fixed across the sweep. |
--reps |
5 |
Repetitions per window or rate. |
--phase |
2 |
Protocol phase the relayer should be running, 2 or 3. Used for output paths and verified when --bridge-results-path is set. |
--ack-signer |
none | Expected ack mode, eoa or aa. Checked against the ack_signer column. Meaningless with --phase 2. |
--gas-budget |
8000000 |
Forwarded to loadtest --gas-budget. |
--target-url |
http://localhost:5000/api/SendPTB |
Forwarded to loadtest --target-url. |
--json |
required | Forwarded to loadtest --json. |
--loadtest-bin |
./loadtest |
loadtest binary. Left at the default, it searches ./loadtest, then ./target/release/loadtest, and refuses a debug build. An explicit path is used literally. |
--out-dir |
./output/bench_sweep |
Output root. Cells land in <out-dir>/phase<P>/<window or rate>/<offered rate>/rep<NN>/. |
--scratch-dir |
./output/bench_sweep/.scratch |
Scratch directory used as loadtest's OUTPUT_DIR per cell. |
--bridge-results-path |
none | Host path of the relayer's bridge_results.csv. When given, each cell waits for its digests to appear and snapshots the file into the cell. |
--max-wait-secs |
600 |
How long to wait for the relay to drain per cell. |
--poll-interval-secs |
5 |
Poll interval while waiting. |
Each cell directory holds the cell's merged_results.csv and run.json, and, with
--bridge-results-path, a bridge_results.csv snapshot. A cell whose rate_achieved is false
reached less than 90 percent of its target rate and should be excluded from plots. See
Benchmarks: T5 and T6.
aa_init¶
Deprecated
aa_init creates an account of the older abstract_account package. Use bridge_aa_init and
Track C instead: One-time bridge setup. Background:
Legacy: the abstract_account path.
Takes no flags. Reads ./iota.keystore from its working directory, connects to devnet, fetches the
package metadata of AA_PACKAGE_ID_DEVNET, creates the account with SPONSOR_ADDRESS as sponsor and
prints AA_ACCOUNT_ID_DEVNET and AA_PACKAGE_ID_DEVNET to add to .env. It also reads
AA_MODULE_NAME, AA_FUNCTION_NAME and AA_CREATE_FUNCTION_NAME.
deploy.sh¶
Resets Docker Swarm, builds the images and deploys the stack for one mode. It destroys any existing stack and leaves and re-creates the swarm, so run it only on a machine where that is acceptable.
| Argument | Default | Meaning |
|---|---|---|
--mode <mode> |
bridge, or DEPLOY_MODE |
bridge, benchmark or hybrid. A bare bridge, benchmark or hybrid is accepted too. |
-h, --help |
Print usage and exit. |
- Stack name:
stealth-name-service-backend_<mode>. - Bridge mode starts the backend, the listener and the handler and no load generator; benchmark
mode adds
loadtest; hybrid adds both. Which compose files load for each mode: Compose stacks. CONSENSUS_ENABLED=trueaddsdocker-compose.consensus.ymlin bridge and hybrid modes. Before touching anything it checks thatCONSENSUS_DELIVERY_KEYhas at least 32 characters.- Outside bridge mode it validates
COINS_PER_REPLICA,LOADTEST_PIPELINE_DEPTHandGRPC_POOL_SIZEas integers and requires both of the last two to be at mostCOINS_PER_REPLICA. - Builds
stealth-backend:latest,stealth-loadtest:latestandevent-listener:latestfromtesting_backend/, createsshared_data,events_dataandconsensus_data, and requirestesting_backend/iota.keystore. - Environment:
DEPLOY_MODE,SWARM_ADVERTISE_ADDR(default127.0.0.1), and everything in.env.
consensus_smoke.sh¶
Runs the committee locally against a mock executor, with no Docker stack, no IOTA node and no gas, posts synthetic events and checks the outcome. It exits non-zero when a check fails, so it doubles as the end-to-end test of each Byzantine preset.
Positional arguments, in order:
| Position | Default | Meaning |
|---|---|---|
1 nodes |
4 |
Validators. |
2 byzantine |
0 |
Byzantine nodes. |
3 faulty |
0 |
Crash-stop nodes. |
4 strategy |
forge |
forge, censor, delay or equivocate. |
5 events |
10 |
Events to post. |
all as the only argument runs seven fixed configurations in turn. Within the BFT bound it checks
that every event is delivered exactly once, nothing unobserved is delivered, every delivery carries a
valid signature, a retry of a committed event is answered duplicate, and equivocate produces
evidence. Past the bound, a Byzantine forge majority must deliver at least one forged event and a
crash majority must deliver nothing. Environment: SMOKE_PORT (default 5077), SMOKE_MOCK_PORT
(default 5999), COMETBFT_BIN. Needs cargo, python3 and curl.
consensus_compare.sh¶
Compares the bridge with and without the committee under the same load, scenario by scenario. Each
scenario edits .env, redeploys the stack with ./deploy.sh bridge, runs loadtest from the host,
waits until every request was relayed and keeps that run's CSVs. .env is always restored, also on
Ctrl-C; the original is kept as env.original in the output directory. Every run spends gas:
the script prints the total and asks before starting.
cd stealth_name_service/backend
./consensus_compare.sh --agents 50 --requests 2
./consensus_compare.sh --scenarios baseline,honest
./consensus_compare.sh --report results/consensus_compare_<timestamp>
| Flag | Default | Meaning |
|---|---|---|
--agents |
1000 |
Agents per run. |
--requests |
5 |
Requests per agent. |
--interval |
5 |
Interval between requests, in seconds. |
--reps |
1 |
Repetitions per scenario. |
--scenarios |
all eight | Comma-separated subset. |
--max-wait |
600 |
Seconds to wait for a run to drain. |
--out |
results/consensus_compare_<YYYYMMDD_HHMMSS> |
Output directory. |
--yes, -y |
off | Skip the gas confirmation. |
--report <dir> |
none | Rebuild the summary of an existing run and exit. |
-h, --help |
Print usage. |
Scenarios (all 7-validator committees except the baseline):
| Scenario | Committee settings |
|---|---|
baseline |
CONSENSUS_ENABLED=false |
honest |
0 faulty, 0 Byzantine |
faulty2 |
2 faulty |
byz2_forge |
2 Byzantine, forge |
byz2_censor |
2 Byzantine, censor |
byz2_delay |
2 Byzantine, delay |
byz2_equivocate |
2 Byzantine, equivocate |
honest_commit200 |
0 faulty, 0 Byzantine, CONSENSUS_TIMEOUT_COMMIT_MS=200 |
Requires EVENT_HANDLER_MODE=bridge in .env, docker, python3, cargo and curl, and
CONSENSUS_DELIVERY_KEY for every scenario except baseline. The report is written by
consensus_compare.py; its files are described in CSV schemas.
See Comparing committee scenarios.