10 BPS Production on Starcoin DAG
Optimizing Starcoin DAG for High-Frequency Block Production (BPS = 10)
1. Background
With the introduction of FlexiDAG consensus (a variant of GHOSTDAG), Starcoin gained the structural foundation to support high-frequency block production. to support high-frequency block production. However, earlier implementations were limited by bottlenecks in serial block construction, consensus computation, and validation paths. The main goal of this optimization round is to gradually decouple structural bottlenecks in the block production process and enable full concurrency.
2. Optimization Path
1. Parallel BlockTemplate Construction
Previously, each block’s construction process was performed serially, including parent selection, transaction filtering, simulated execution, and body assembly. We made this process asynchronous and parallel. Each parent triggers an independent task, distributed by the Tokio runtime. With a sliding window limit, the system can construct multiple block templates concurrently and no longer stalls on a single parent.
2. GHOSTDAG Path Optimization
Original GHOSTDAG coloring performs DFS on the entire mergeset, resulting in significant computation costs as the DAG grows. We applied the following changes:
- Preprocess part of the GHOSTDAG path in advance to avoid redundant coloring work;
- Use parent score-based fast merging for blue chain selection;
- Cache stable paths to avoid repeated traversal within the sliding window.
These optimizations help keep coloring costs under control, even under high-concurrency conditions.
3. Introduction of Pruning Point and Trimming Logic
To control DAG size, we implemented the pruning point mechanism, which requires all new blocks to include a confirmed blue ancestor. To prevent pruning checks from becoming a bottleneck, we:
- Introduced pruning path caching in the connect process;
- Throttled pruning point advancement frequency to avoid frequent full-graph recalculation;
- Added incremental validation logic that skips already confirmed paths.
4. Parallel Connect and State Execution
During DAG construction, each block in the mergeset must undergo state validation. These operations were previously done serially, making connect the biggest bottleneck in the production path. We use Rayon to split mergeset connect into parallel task groups, with error short-circuiting and result aggregation. The entire connect path now functions as a pipeline rather than a blocking point.
5. Synchronization and Propagation Path Optimization
Cross-node synchronization and block propagation are also key performance paths. We integrated optimizations for relay, fetch, and sync logic:
- Header-first strategy: broadcast header only, defer body fetching;
- Relay split into header handling and body dispatch to improve responsiveness;
- Orphan block async injection to reduce main thread stalls;
- Batched fetch requests with snapshot negotiation to prevent overload;
- DAG-aware sync strategy focusing only on blue frontier.
These optimizations significantly reduce broadcast latency and DAG diffusion costs.
3. Test Setup
The local test environment is based on ./starcoin/docker-compose.yml
, which creates a 4-node custom network to simulate DAG concurrent block production and verify the effectiveness of the optimizations.
Launch Procedure
- Navigate to project root:
cd ./starcoin
- Start the network (default 4 nodes, configurable via
docker-compose.yml
): docker-compose up --build -d
- To adjust node count, edit
docker-compose.yml
and duplicate or modifystarcoin-node-x
service blocks as needed. - All nodes run within a Docker custom network with exposed ports and configuration enabling GHOSTDAG and high-frequency block production.
DAG Visualization and Debugging
Use the companion tool starcoin-graphd
to connect to local nodes and visualize the DAG structure:
- Data source can be configured as local DB or RPC interface;
- Visualize blue chain, mergeset, and orphan distributions;
- Supports zoom, blue chain delay tracking, and orphan ratio observation.
Verification Objectives
This test suite helps verify:
- Block production rate, DAG depth, and merge path density;
- Orphan block ratio trends under increasing BPS;
- Load behavior of connect, relay, and sync paths in multi-node environments.
4. Performance Observations & Analysis
Under the current configuration, the system has stably run through multiple epochs. A typical case:
- Target BPS: Stable block production rate at ~10 blocks/sec;
- Consensus parameter:
k = 16
, i.e., each block can include up to 16 uncles; - Observed (epoch #13): Between block #3120 and #3360 (240 blocks), 193 uncles were recorded.
Theoretical Analysis (Based on FlexiDAG)
According to GHOSTDAG theory, with a fixed , the system’s safe concurrency bound depends on the number of competing blocks per time unit. For a production rate of blocks/sec and , the tolerance window is:
That is, any block delayed more than 1.6 seconds behind the blue frontier is likely to be marked red or orphaned.
In epoch #13:
- 240 main blocks and 193 uncles → approx. 44.6% uncle rate;
- This suggests the DAG is operating near its concurrency boundary but still within GHOSTDAG’s blue set control range;
- Most uncles received rewards and were properly integrated, indicating no major blocking in coloring or relay paths.
This confirms that with BPS ≈ 10 and k = 16, the system runs in a high-load but controlled regime. Uncle density is high but doesn’t break blue chain stability, making this a valid benchmark for current safe concurrency levels.
Summary
- Approx. 10 candidate blocks per second with visible fork pressure;
- High uncle density, but blue chain remains well-defined;
- k=16 provides sufficient width, though orphan pressure is noticeable;
- Reward logic remains aligned with block inclusion and consensus rules.
5. Results
Following these structural and concurrency optimizations, Starcoin transitioned from a serial DAG emulator into a truly concurrent DAG system:
- BlockTemplate construction is parallelized and stable;
- GHOSTDAG coloring cost is bounded and scales with topology;
- Connect path is pipelined and no longer a bottleneck;
- Propagation latency reduced; multi-node sync is faster;
- DAG structure remains efficient under sustained load.
About Starcoin
Starcoin provides the utmost security from the origin via its enhanced PoW consensus and Secure smart contract, using the language of Move. Through layered and flexible interoperability, it optimizes the building of ecosystems such as DeFi, NFTs, Gaming, etc., with higher efficiency and convenience. This process redefines value by empowering every participant in the ecosystem to enjoy the multiplication of values.
Follow Starcoin on social media to stay up to date with all the latest developments.
Website | StarStack | Twitter | Medium | Telegram | Linktr.ee