A next-generation hybrid blockchain architecture that offloads high-frequency transactions from the main chain to dynamic, ephemeral peer-to-peer state channels β dramatically improving throughput while preserving on-chain security and finality.
Traditional blockchains suffer from the scalability trilemma: as transaction volume grows, the network faces:
- β±οΈ Congestion β mempool backlogs, slow confirmations
- πΈ High fees β gas wars during peak load
- π Degraded throughput β Bitcoin ~7 TPS, Ethereum ~15β30 TPS
This model introduces Dynamic Interconnection Channels β ephemeral, bilateral state channels that:
- Lock initial balances on-chain (one transaction)
- Transact off-chain at infinite speed with no fees
- Settle final state back on-chain (one transaction)
The result: β TPS for channel participants, with on-chain security guarantees for final settlement.
Main Chain (PoW, difficulty 2): ~3,846 TPS
Ephemeral Channels (off-chain): β TPS
Settlement overhead: 0 ms
On-chain footprint per channel: 2 txs (open + close)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β REST API Layer β
β Express HTTP (port 3000+) β
ββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββββββββββββββββββΌβββββββββββββββββββββββββββββββ
β Node Layer β
β Identity Β· Peers Β· State Management β
ββββββββββββββ¬ββββββββββββββββββββββ¬βββββββββββββββββββ
β β
ββββββββββββββΌβββββββ ββββββββββββΌβββββββββββββββββββ
β Main Chain β β Ephemeral Channel Layer β
β Block Β· PoW β β Channel Β· ChannelManager β
β Merkle Β· Txs β β Off-chain State Β· Settle β
ββββββββββββββ¬βββββββ ββββββββββββββββββββββββββββββββ
β
ββββββββββββββΌβββββββββββββββββββββββββββββββββββββββ
β P2P Network Layer β
β WebSocket Gossip Protocol β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββ
| Path | Responsibility |
|---|---|
core/Block.js |
Block structure, PoW mining, Merkle root |
core/Blockchain.js |
Chain management, validation, balance tracking |
core/Transaction.js |
Transaction format, hashing, signature validation |
ephemeral/Channel.js |
Bilateral off-chain state channel lifecycle |
ephemeral/ChannelManager.js |
Multi-channel orchestration per node |
network/Node.js |
Node identity, peer management, state |
network/P2P.js |
WebSocket-based P2P gossip protocol |
api/server.js |
REST API (blockchain, channels, mining, P2P) |
simulation/runNetwork.js |
Multi-node network simulation |
simulation/benchmark.js |
Throughput comparison benchmark |
- Node.js 18+
- pnpm (
npm install -g pnpm)
git clone https://github.com/ziuus/Dynamic-Blockchain.git
cd Dynamic-Blockchain
pnpm installpnpm start
# API available at http://localhost:3000pnpm simulate
# Spins up 3 nodes with P2P sync, channels, and miningpnpm benchmark
# Compares main chain TPS vs ephemeral channel TPS| Method | Endpoint | Description |
|---|---|---|
GET |
/api/blockchain |
Full chain state |
GET |
/api/blockchain/height |
Current block height |
GET |
/api/blockchain/valid |
Chain validity check |
GET |
/api/block/:index |
Block by index |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/transactions |
Submit a transaction |
GET |
/api/transactions/pending |
Mempool |
GET |
/api/transactions/history/:address |
Address history |
POST |
/api/mine |
Mine pending transactions |
GET |
/api/balance/:address |
Address balance |
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/channels |
Open a new channel |
GET |
/api/channels |
List all channels |
GET |
/api/channels/:id |
Channel details |
GET |
/api/channels/for/:address |
Channels for address |
POST |
/api/channels/:id/transactions |
Off-chain transaction |
POST |
/api/channels/:id/settle |
Settle channel on-chain |
POST |
/api/channels/:id/close |
Force close channel |
GET |
/api/channels/stats |
Channel statistics |
| Method | Endpoint | Description |
|---|---|---|
GET |
/api/node/status |
Node health & stats |
GET |
/api/p2p/peers |
Connected peers |
POST |
/api/p2p/connect |
Connect to peer |
POST |
/api/p2p/sync |
Trigger sync |
GET |
/api/health |
Health check |
Alice Channel Contract Bob
β β β
βββββ open(1000, 1000) βββββΊβ β
β ββββ open(1000, 1000) βββββ
β β [On-chain: 1 tx] β
β β
ββββββββββββββββββ off-chain transactions βββββββββββββΊβ
β (tx1: AliceβBob 50) (tx2: BobβAlice 20) ... β
β [Instant, zero fees, unlimited] β
β β
βββββ settle() βββββββββββββββββββββββββββββββββββββββΊβ
β [On-chain: 1 settlement tx with final balances] β
Security: All off-chain state is cryptographically signed. Either party can force-close using the latest agreed state at any time.
- Core blockchain (PoW, Merkle, validation)
- Ephemeral state channels
- P2P WebSocket gossip
- REST API
- Simulation & benchmark suite
- Dashboard UI (real-time network visualizer)
- Proof-of-Stake consensus layer
- Multi-hop channel routing (payment network)
- RSA keypair-based transaction signing
- Persistent storage (LevelDB)
- Docker / multi-node devnet setup
Dynamic-Blockchain/
βββ core/
β βββ Block.js # Block with PoW + Merkle root
β βββ Blockchain.js # Main chain state machine
β βββ Transaction.js # Transaction format & validation
βββ ephemeral/
β βββ Channel.js # Off-chain state channel
β βββ ChannelManager.js # Channel lifecycle manager
βββ network/
β βββ Node.js # P2P node identity & state
β βββ P2P.js # WebSocket gossip protocol
βββ api/
β βββ server.js # Express REST API
βββ simulation/
β βββ runNetwork.js # 3-node network simulator
β βββ benchmark.js # Throughput benchmarking
βββ docs/
β βββ ARCHITECTURE.md # Deep-dive architecture docs
βββ .gitignore
βββ package.json
βββ README.md
All contributions are welcome β from beginners to experts. You don't need to know everything about blockchain to help!
Ways to contribute:
| Type | How |
|---|---|
| π Bug report | Open an issue |
| π‘ Feature idea | Start a discussion |
| π§ Code | Fork β branch β PR (see CONTRIBUTING.md) |
| π Docs | Fix typos, improve explanations, add examples |
| β Star | Helps the project get discovered β much appreciated! |
This is an independent open-source project built and maintained in spare time. If it's useful to you β or you just want to see it grow β any support means a lot:
- β Star the repo β it's free and helps enormously with discovery
- π¦ Share it β tweet it, post it, tell a friend
- π° Sponsor β github.com/sponsors/ziuus
- π οΈ Contribute β code, docs, tests, ideas β all welcome
- π Report bugs β helps everyone using the project
Every star, share, and contribution directly funds time to work on the roadmap: PoS consensus Β· LevelDB storage Β· multi-hop routing Β· test suite Β· Docker devnet
MIT Β© ziuus