Replay BCASim simulation results as network propagation and blockchain graphs.
No package installation or build is required. From this repository, run:
python3 -m http.server 8000 --bind 127.0.0.1Open http://127.0.0.1:8000/. Use HTTP so the browser can fetch the sample JSON
and CSV files. Open Open and compare recordings to select or drop local results.
You can also replace the files under output-file/ and reload.
Wait for loading to finish, then select Start simulation. Pause / Resume preserves the current position, Reset returns to the beginning, and Restart simulation applies new speed, start-time, and color settings. Starting at a later time reconstructs earlier events before playback. Both timelines must finish before the clock stops. Invalid files or settings produce a visible error with retry support.
Select adjacencyMatrix.csv, block.json and event.json from one run together in
Recording A. Add metrics.json for chain, attack, propagation and transaction
metrics. Add initialAdjacencyMatrix.csv for simulations with network changes;
these recordings require the initial topology. The loader checks that replaying
all changes produces the supplied final matrix. Old three-file static recordings
remain supported. Local files are read in the browser and are not uploaded.
A complete selection is validated before replacing the current recording. Invalid or mixed topology files show an error and preserve the previous recording. Importing valid data stops its old playback timers and replaces the graphs. Later selections supersede earlier unfinished imports.
The timeline slider reconstructs the graph at a chosen time and pauses playback. Next event time and Next block time advance to the next timestamp, including all events at that time. Inspect the current timeline position shows the latest processed event and block, including transaction details when supplied. The network graph draws one line per node pair when either directed connection exists; event details retain the exact direction. It shows recorded activity, not protocol finality.
Load a second run into Recording B to compare final recorded metrics with A; B is a comparison dataset, while the graphs replay A. Percentage differences use percentage points. Undefined or missing values remain Not recorded. Compare the same duration, observer and modeling assumptions. Node 0's block share does not imply that it used an attack strategy, and built-in attack success counts describe branch races, not verified reversed payments.
Open Build an experiment configuration, select node count, scenario, seed,
duration, block interval, attack share, delay and mesh/ring topology. Generate and
download experiment.properties, then run it in a built BCASim checkout:
java -jar target/bcasim-0.0.1-SNAPSHOT.jar --config experiment.properties --output runs/customThe browser exports settings and replays results; Java runs the simulation. Generated files use PoW, equal weights for honest scenarios and node 0's specified share for attack scenarios. Automatic transaction generation is disabled in this basic builder. For transaction workload, scheduled partitions or batch experiments, extend the file using the simulator guide.
js/read-file.js: atomic dataset loading, CSV/JSON validation, stable timeline sorting.js/playback.js: independent playback instance; owns clocks, cursors, seek/restart, pause/resume, and completion. No DOM or graph-library dependency; can be required in Node.js/blockchain.js: block rendering and indexed resolution of late parent edges.js/network.js: network rendering and sparse traffic highlighting, without playback timers.js/main.js: browser controls, atomic recording replacement, status messages and page lifecycle.js/studio.js: local file controls, timeline inspection, metric comparison and configuration export.js/dist/vis.js: bundled graph library; the runtime has no CDN dependency.
BCASimPlayback accepts a validated dataset, renderer, timer scheduler, and optional
change callback. Independent playback instances do not share simulation state.
This repository is the canonical runtime for the website's demo/ directory.
The two repositories serve independently: the website vendors exact runtime files
and tests, with no symlink or runtime request to this repository. Its page layout,
styles, analytics, and sample recording remain owned by the website.
After changing runtime code or its tests, synchronize a website checkout:
node scripts/sync-demo.cjs ../bcasim.github.io
node scripts/sync-demo.cjs ../bcasim.github.io --check
node --test
(cd ../bcasim.github.io && node --test)The target path defaults to ../bcasim.github.io. Sync uses an explicit file list
and reproducible SHA-256 manifests, and never changes site HTML, styles, analytics,
or recordings. If adding a runtime script, update the script list in the sync tool
and both HTML entry points. The manifest test detects local edits to copied code;
when sibling checkouts exist, it also detects mismatched runtime versions. Commit
both repositories' synchronized changes together. A checkout without its sibling
still serves and runs its tests independently.
Run node --test with Node.js 22 or newer. Tests cover data readiness and retry,
malformed data, equal-time event order, independent playback instances, pause/resume,
restart/seek, late parents, both end-of-data cases, full bundled playback, timer and
graph cleanup, local import failure/races, directed topology changes, comparison,
configuration export and runtime synchronization. No test dependencies are installed.
For browser checks, serve each repository separately and exercise loading, start/pause/resume/reset, invalid settings, and full playback on desktop and narrow viewports. Keep the website demo's visual design and analytics unchanged when syncing.
- BCASim - Open source blockchain simulator for attack analysis
- BCASim Visualization - Simulation result visualization tool for BCASim
- BCASim Analysis - Simulation result analysis tool for BCASim
If you have any questions or comments, please feel free to contact us.