Cluster Initialization Process in Goquarkchain

Cluster Initialization
It takes the following steps to initialize a cluster. All the connections are bidirectional.

  1. Start master and slave servers,
  2. Master initiates connections to all the slave servers
  3. Master directs slaves to connect to each other; All the servers are connected with each other after the above steps
  4. Recover cluster state as described below

Recovering Cluster State
Recovery means reconstructing the necessary in-memory data structure from db to allow the cluster to function.

  1. The root chain first identifies the head of the chain by looking up the tipHash from db. However, there is no guarantee that the cluster has reached a consistent state regarding this block. But its parent is guaranteed to be consistent in the cluster. So the parent block of tipHash becomes the new head and recent blocks are loaded into memory following the hash_prev_block hash pointer.
  2. The root chain broadcast the recovered new head to all the shards.
  3. Each shard finds the latest shard block confirmed by the root blocks up to the recovered new head and use it as the new shard head. Then it recovers the shard chain from the new shard head following the prev hash pointer. Only recent blocks are loaded into memory.


  1. Start Slave Process:
  2. Start Master Process: