Distributed consensus/networks simulation framework: forcecons-sim

sbagency
3 min readSep 23, 2021

--

What’s consensus? An ability of a distributed network/system to achieve correct result(s) under external/internal attacks and failures.

All of us participated in a voting, hands rising and counting. Perfect conditions, everyone can see everyone, no middleman, no cheating. Majority of votes 1/2+1 to make a decision.

Remote voting is different, distributed cryptographic protocol is needed to prevent attacks and tolerate failures.

Forcecons-sim is a distributed consensus/network simulation/visualization framework, github repo.

Network level attacks/failures. Network split/combine simulation.

network split: 1st group(4 nodes), 2nd group (3 nodes)

1st group (4 nodes)

1st group chain, genesis (1st) block at the right

2nd group (3 nodes)

2nd group chain: genesis (1st) block at a right, orphan (split time) chain at the bottom, final chain at the top

Orphan chain ( at the bottom, 2nd group nodes) data is lost, final chain after split recovery (at the top) is the same for all nodes.

After split recovery (chain is the same for all nodes).

after split recovery
nodes table (last block #98, ten blocks past #88)

Individual links between nodes can be removed/recovered, if connectivity is kept (indirect), consensus is achievable.

Not all nodes connected, but consensus is achievable

Most simple but working consensus mechanism is analyzed, rules:

  • Genesis block is the same for all nodes.
  • Nodes can produce new blocks and broadcast to network.
  • Nodes can accept new valid blocks from network.
  • Node can get blocks from any node (sync).

Block confirmations are next blocks (simple rule). Last block is selected on longest chain rule. Uncertain finality (history can be rewritten).

Cryptography. All messages are digitally signed/verified (not in simulation), each block contains hash of previous one, except genesis block #0.

Power attack (>1/2), block production power at a higher speed is concentrated in one hand (red node).

Power attack of red node

If somebody produces blocks faster than rest of network that means any history can be rewritten.

red node attack, genesis block at the top, attack chain on the left, main on the right

1/2 attack or 51% attack is impossible to resist without a game changing hack (know how). Don’t forget one hand can control as many nodes as needed (sybil attack).

Links

Are blockchains decentralized?
Fact Check: DARPA Funded Report on Blockchain Centralization

--

--

sbagency
sbagency

Written by sbagency

Tech/biz consulting, analytics, research for founders, startups, corps and govs.

Responses (1)