Version: 0.1.1-alpha.1 Β· Changelog
An educational blockchain simulator built with Vue 3, Nuxt 4 and TypeScript. Build a peer-to-peer network of nodes in an interactive graph, send signed transactions, mine blocks with proof of work and watch transactions, blocks and forks spread through the network.
With SimLedger you can:
- Create network nodes, each running its own blockchain, wallet and pending transaction pool
- Connect and disconnect peers and watch transactions and blocks travel along the connections
- Sign transactions with real secp256k1 keys and mine them into blocks with proof of work
- Inspect every node's chain, pending pool and ledger, and validate the chain
- Split the network, let both sides mine and see how nodes deal with diverging chains (forks): the longest-chain rule decides automatically, conflicts it cannot decide are resolved by you
The dashboard has four panes, all synchronised through one shared network store:
| Pane | What you can do |
|---|---|
| Graph Viewer | Select nodes, drag them, connect peers by dragging between node handles or via the connection menu (cable icon) on the node card, select an edge and press Backspace / Delete to disconnect. The toolbar adds nodes, re-runs the auto layout, fits the view and pauses / resumes the simulation. |
| Explorer | Inspect the selected node: wallet address (copyable), balance, chain height, pending count, chain conflicts, the blocks (expandable), the pending pool and the full ledger. |
| Console | Log messages of all nodes: accepted and rejected blocks and transactions, chain validation, chain switches and conflicts. |
| Editor | Send a transaction between two wallets through the selected node, mine the pending transactions into a block and validate the chain. |
The default scene creates five nodes (Bob, Alice, Frank, Grace, Dave). One second after start the genesis wallet sends 100 coins to Bob; select Bob and press Mine block to confirm it.
The network runs in ticks of 2 seconds (System.CycleTime). A node relays a received transaction or block
on the next tick, so packets visibly hop from node to node. Mining rolls a lottery die (0β5 extra ticks)
on top of the proof of work, so two nodes mining at the same time finish at different moments.
Every node keeps its own copy of the chain. Whenever a node learns about a chain that differs from its own, it applies the longest-chain rule:
| Situation | What the node does | Console feedback |
|---|---|---|
| The block extends the own chain | Adds it and relays it | π: Block added β¦ |
| The peer's chain is longer and only adds blocks | Copies the missing blocks | β: Synchronized 2 missing blocks from Alice: 1 β 3 blocks |
| The peer's chain is longer and diverges | Switches to it, returns transfers of discarded blocks to the pending pool | β: Adopted Alice's longer chain (longest-chain rule): 2 β 3 blocks, fork at block #1, 1 own block discarded, 1 transaction returned to the pending pool |
| The peer's chain is longer but invalid | Keeps its own chain | β: Rejected Alice's longer chain, it failed validation (warning) |
| The peer's chain diverges and is not longer | Keeps its own chain and reports a chain conflict | β: Chain conflict with Alice: chains fork at block #1 (both 2 blocks) β¦ (warning) |
| The node finished mining on an outdated chain | Drops the mined block | β: Mined block #1 rejected, the chain changed while mining (warning) |
A chain conflict is shown in three places:
- Graph: the edge between the two nodes turns into an amber dashed line, the node card gets a fork icon and a dashed border
- Explorer of each involved node: a Chain conflict with β¦ panel that names the fork block and both chain lengths, and the own blocks that are not part of the peer's chain carry a Fork badge
- Console: one warning per conflict and state of both chains
Each node decides on its own, using the buttons in its Explorer panel:
- Retain own chain β keep the own chain. The decision holds until one of the two chains changes; a longer chain arriving later is still adopted automatically. The panel stays visible (Keeping own chain over β¦) and still offers to adopt the peer's chain.
- Adopt peer's chain β validate the peer's chain and switch to it, even if it is shorter. Transfers of the discarded own blocks go back into the pending pool and the node broadcasts its new latest block to its other peers.
The edge stays marked until both nodes have decided. To provoke a conflict in the default scene: wait until Alice has received the genesis transaction, disconnect Bob and Alice, mine a block on both, then connect them again.
- Proof-of-work consensus with SHA256 block hashing, mining in a Web Worker
- Account-based ledger with O(1) balance lookups and per-block state snapshots (
AccountStateManager) - ECDSA secp256k1 transaction signatures, balance and double-spend checks, mining rewards
- Chain validation, safe chain replacement and pending pool reconciliation after chain switches
- Multi-node topology with bidirectional peer connections
- Tick-based gossip: transactions and blocks are relayed hop by hop
- Longest-chain rule with console feedback, chain conflict detection and manual resolution (retain / adopt)
- Configurable simulation cycle time (default: 2000 ms), pause and resume
- Interactive Vue Flow graph with zoom, pan, minimap, fit view and spring auto layout
- Animated transaction and block packets that follow the edges while nodes are dragged
- Mining state (gears, lottery die, progress bar), warning flashes and chain conflict markers
- Light / dark mode, honours
prefers-reduced-motion
- Declarative scene definitions with TypeScript interfaces (
app/config/scenes.ts) - Pre-configured scenes: default (5 nodes) and simple (3 nodes)
simledger/
βββ app/ # Nuxt application (Vue 3)
β βββ app.vue # Root component: provides the network store, loads the scene
β βββ components/
β β βββ Dashboard.vue # Split pane layout
β β βββ NodeExplorer.vue # Chain, conflicts, pending pool and ledger of the selected node
β β βββ NodeEditor.vue # Transaction form, mining and chain validation
β β βββ LogConsole.vue # Log messages of all nodes
β β βββ PaneHeader.vue # Pane title bar
β β βββ InfoPopup.vue # About dialog (version, links)
β β βββ ledger/ # NodeDot, AddressLabel, TransactionItem
β β βββ graph/ # Vue Flow network graph
β β βββ GraphViewer.vue # Canvas, toolbar, controls, minimap
β β βββ NetworkNode.vue # Node card (balance, mining state, conflict icon, menu)
β β βββ NetworkEdge.vue # Floating edge, conflict style, broadcast packets
β β βββ BroadcastPacket.vue # Packet animated along an edge
β β βββ ConnectionMenu.vue # Connect / disconnect peers
β β βββ GraphToolbar.vue # Add node, layout, fit view, pause
β βββ composables/
β β βββ useNetwork.ts # Network store (nodes, edges, selection, conflicts, actions)
β β βββ useBroadcastAnimations.ts # Packets travelling along edges
β β βββ useSceneSetup.ts # Scene initialization
β β βββ useAssetUrl.ts # Public asset URLs under the deployment base path
β βββ config/scenes.ts # Scene presets
β βββ plugins/version.ts # App version from package.json
β βββ utils/ # Framework-free helpers (address labels, graph layout / motion)
βββ src/ # Framework-free domain
β βββ blockchain/
β β βββ blockchain.ts # Chain, pending pool, validation, chain replacement
β β βββ block.ts # Block hashing, mining, transaction validation
β β βββ transaction.ts # Signed transfers
β β βββ account-state.ts # Balances and per-block state snapshots
β β βββ types.ts # Shared type definitions
β βββ network/
β β βββ system.ts # Simulation clock (ticks)
β β βββ system_node.ts # Network node: peers, gossip, mining, longest-chain rule, conflicts
β β βββ tick.ts # Tick event
β βββ common.ts # Crypto and encoding helpers
βββ public/js/mining.js # Proof-of-work Web Worker
βββ test/ # Unit, component and end-to-end tests
βββ assets/ # Global CSS
βββ nuxt.config.ts # Nuxt configuration
- Frontend: Vue 3, Nuxt 4, TypeScript, Nuxt UI 4, Splitpanes
- Visualization: Vue Flow (Vue port of the React Flow / xyflow model), requestAnimationFrame-driven packet animations
- Blockchain: SHA256 (
crypto-js), secp256k1 ECDSA (elliptic), Base58 (bs58) - Events: RxJS subjects for ticks, broadcasts and node events
- Testing: Vitest,
@nuxt/test-utils, Vue Test Utils, happy-dom, Playwright
Requires Node.js 20 or newer (the test workflow uses 22, the deployment 20).
npm install # install dependencies (runs `nuxt prepare`)
npm run dev # development server on http://localhost:3000
npm run build # production build
npm run preview # preview the production build
npm run generate # static site in .output/publicpnpm, yarn and bun work as well (pnpm dev, yarn dev, bun run dev, ...).
The application is deployed through Cloudflare as a static site; the deployment is configured in Cloudflare,
not in this repository. Build it with npm run generate and serve .output/public.
The site is built for the root path by default. To serve it under a sub path, set NUXT_APP_BASE_URL
(e.g. /simledger/) at build time; all assets are resolved against it.
| Command | What it runs |
|---|---|
npm test |
All Vitest projects (unit + component) |
npm run test:unit |
Framework-free tests in Node: graph helpers, stores, blockchain / network domain |
npm run test:nuxt |
Component and composable tests in the Nuxt runtime (happy-dom, @nuxt/test-utils) |
npm run test:coverage |
All Vitest projects with V8 coverage and thresholds |
npm run test:e2e |
Playwright end-to-end tests against the generated site served under the sub path /simledger/ |
npm run typecheck |
vue-tsc over the app and the tests |
Tests live in test/:
test/unit/β spring layout, broadcast routing, motion / easing, floating edges, network and animation stores, scene setup, transactions, blockchain mining and chain replacement (the realpublic/js/mining.jsruns in a fake Worker),SystemNodebroadcasting, the longest-chain rule and chain conflictstest/nuxt/β components mounted withmountSuspended: node card, connection menu, edge and packet animation (mockedrequestAnimationFrameand path sampling), graph viewer, toolbar, explorer (incl. conflict panel), editor, console, dashboardtest/e2e/β the running app: default scene, selection sync, connecting / disconnecting (menu, handle drag, Backspace), dragging, toolbar, color mode, packets travelling and being relayed, packets following a dragged node, mining, rejected transactions, reduced motion, and a split network resolving its fork with retain / adopt
The E2E suite builds the site itself (npm run e2e:build) unless a server is already running on port 4173.
Install the browser once with npx playwright install chromium, or point PLAYWRIGHT_CHROMIUM_EXECUTABLE at an
existing Chromium.
Dependencies are kept current with npm audit fix. The remaining npm audit findings have no patched
release within the version ranges their parents allow. All of them except elliptic are build or
development tooling that never ships with the statically generated site:
| Package | Severity | Pulled in by | Status |
|---|---|---|---|
simple-git, @simple-git/argv-parser |
critical | @nuxt/devtools (dev only) |
Fixed only in simple-git 4 / argv-parser 2; devtools 3.x requires simple-git ^3 |
node-forge |
high | @nuxt/cli β listhen (dev server HTTPS) |
No patched release |
braces (β micromatch, fast-glob, globby) |
high | nitropack (build) |
No patched release |
esbuild 0.27 |
low | @nuxt/fonts β fontless (dev server) |
Fixed in 0.28, outside the parent's range |
elliptic |
low | wallet keys and signatures (src/common.ts) |
No patched release; accepted for this educational simulator, which handles no real funds |
The intermediate packages npm audit lists (nuxt, @nuxt/cli, @nuxt/devtools, @nuxt/nitro-server,
@nuxt/vite-builder, @nuxt/test-utils, nitropack, listhen) are only flagged because they depend on
the packages above. Re-check with npm audit when Nuxt publishes updates.
Based on Xavier Decuyper's architecture:
- Blockchain: the chain of blocks, the pending transaction pool, validation and chain replacement
- Block: transactions, timestamp, nonce, hash and the miner's reward address
- Transaction: a signed value transfer;
_as sender marks a mining reward - AccountStateManager: balances of all addresses, with a snapshot per block
The reward for a block is paid in the next block: every block must contain one reward transaction to the miner of the previous block.
Systememits a tick every 2000 ms; nodes process their queued broadcasts on the next tick- Each
SystemNodeowns a blockchain and a key pair, and subscribes to the broadcasts of its peers - Nodes apply the longest-chain rule and report chain conflicts they cannot decide (see Forks and Chain Conflicts)
- The network store (
useNetwork) is the single source of truth; Vue Flow nodes and edges are derived from it - Domain objects stay non-reactive; a
versioncounter bumped on every tick, node event and action makes views re-evaluate
- ARCHITECTURE.md β layers, data flow, consensus and fork handling
- API_REFERENCE.md β classes, store and helpers
- CHANGELOG.md β release notes
This is an educational project designed to demonstrate blockchain concepts and network visualization.
Run npm run typecheck, npm test and npm run test:e2e before opening a pull request.
MIT

