Skip to content

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.

cd stealth_name_service/backend/testing_backend
cargo run --release --bin testing_backend
  • Listens on 0.0.0.0:5000, or 0.0.0.0:8443 with ENABLE_HTTPS=true. Routes: HTTP endpoints.
  • Reads iota.keystore from 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 /health answers at once and /ready flips 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_NAME and BENCH_OBJECT_IDS. Apart from ENABLE_AA itself, they are read only when ENABLE_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.

cargo run --bin event_listener
  • Polls the JSON-RPC endpoint in EVENT_LISTENER_RPC_URL every EVENT_LISTENER_POLL_MS milliseconds, filtered by EVENT_LISTENER_PACKAGE_ID and EVENT_LISTENER_MODULE, and, when EVENT_LISTENER_EVENT_TYPE is 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; set EVENT_LISTENER_RESET_CURSOR=false to resume.
  • Forwards to EVENT_HANDLER_URL, or to CONSENSUS_INGEST_URL when CONSENSUS_ENABLED is 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.

cargo run --bin event_handler
  • Listens on 0.0.0.0:5000, path /api/handle_event. It answers as soon as the event is queued. With CONSENSUS_ENABLED on, only deliveries signed by the committee are accepted. See HTTP endpoints.
  • Modes: EVENT_HANDLER_MODE=static runs a fixed call; bridge builds the call from the event and runs it through the BridgeAA. With BRIDGE_PROTOCOL_PHASES=3 it also acknowledges each successful request on the source chain.
  • Startup checks, each a startup error: the signer is in the keystore; the BridgeAA is bound to BRIDGE_TARGET_CHAIN_ID; the BridgeAA ACL has an entry for the relayer on BRIDGE_SOURCE_CHAIN_ID; the BridgeAA owns at least one gas coin.
  • Deletes data/bridge_results.csv at 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.

cargo run --bin consensus_committee
  • Needs CONSENSUS_DELIVERY_KEY, BRIDGE_SOURCE_CHAIN_ID and BRIDGE_TARGET_CHAIN_ID, and, unless CONSENSUS_CHECK_ACL=false, BRIDGE_AA_ACCOUNT_ID and BRIDGE_AA_PACKAGE_ID.
  • Starts one CometBFT process per live validator (plus a twin per equivocate node), each with its own ABCI app inside the Rust process. Their homes and cometbft.log go to CONSENSUS_HOME.
  • Listens on CONSENSUS_LISTEN_ADDR (default 0.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.

cd stealth_name_service/backend/testing_backend
cargo run --bin bridge_aa_init
  • The relayer (EVENT_HANDLER_SIGNER, falling back to SENDER_ADDRESS) is always seeded as the bootstrap ACL entry. create rejects 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_SENDERS is 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 .env lines to add (BRIDGE_AA_ACCOUNT_ID and 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.

cd stealth_name_service/backend
./deploy.sh --mode bridge
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=true adds docker-compose.consensus.yml in bridge and hybrid modes. Before touching anything it checks that CONSENSUS_DELIVERY_KEY has at least 32 characters.
  • Outside bridge mode it validates COINS_PER_REPLICA, LOADTEST_PIPELINE_DEPTH and GRPC_POOL_SIZE as integers and requires both of the last two to be at most COINS_PER_REPLICA.
  • Builds stealth-backend:latest, stealth-loadtest:latest and event-listener:latest from testing_backend/, creates shared_data, events_data and consensus_data, and requires testing_backend/iota.keystore.
  • Environment: DEPLOY_MODE, SWARM_ADVERTISE_ADDR (default 127.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.

cd stealth_name_service/backend
./consensus_smoke.sh 4 1 0 forge 15
./consensus_smoke.sh all

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.