Анатолий — Systems Architecture Lead
Moscow, Russia
Every blockchain is, at its core, a solution to a coordination problem: how do a group of machines that don't trust each other agree on a single version of truth? Bitcoin solved this with elegant simplicity — the longest chain wins. Proof-of-work makes it computationally expensive to create a fake chain, so the honest majority always controls the canonical history.
The Syrpts Network inherits this model but faces a unique challenge: we're not just tracking one currency. We're tracking thousands of custom tokens, each with their own supply, their own liquidity pool, and their own market dynamics. The consensus mechanism must validate not just "did this transfer happen?" but "is this trade price mathematically consistent with the constant-product formula?"
Pure decentralization is an ideology. Practical decentralization is an engineering trade-off. I chose the hybrid Primary/Replica model because it gives us the best of both worlds:
Bitcoin adjusts difficulty every 2,016 blocks (roughly two weeks). This works for a mature network with stable hashrate, but it's dangerously slow for a young network where hashrate can fluctuate by 10x in a single day.
The Syrpts Difficulty Adjustment Algorithm adjusts every 10 blocks. The logic is intentionally simple:
The 2× and ½× thresholds prevent oscillation. Without them, the difficulty would ping-pong between values on every adjustment. The thresholds create a "dead zone" where the difficulty stays stable unless there's a significant hashrate change.
I considered more sophisticated algorithms (ASERT, LWMA, weighted moving averages), but simplicity won. A simple algorithm is auditable. An auditable algorithm is trustworthy. A trustworthy algorithm is secure.
When a peer node presents a longer valid chain, the primary must decide whether to adopt it. The resolveConflict() function implements the longest-chain rule with strict validation:
Step 2 is critical. Early implementations validated each block against its own recorded difficulty, which allowed an attacker to submit a long chain of easy blocks. By validating against the current difficulty, we ensure that any reorganization requires the same computational effort as the honest chain.