Skip to content

Block Generating Miner

c-darwin edited this page Dec 9, 2015 · 1 revision

All miners are divided by levels. Zero-level miners that have right to generate a block and add it to the block chain before others is determined as follows:

$n = ceil( log($max_miner_id) / log(16) );
do {
 $hash = hash('sha256', $hash);
 $c = substr($hash, 0, $n);
 $level_0_miner_id = hexdec($c);
}
while( $level_0_miner_id > $max_miner_id || !$level_0_miner_id );
Where $hash - sha256(sha256(user_id,block_id,prev_head_hash))), $max_miner_id – maximum miner_id from the miners table.
For example, if miner id 12689 is currently on zero-level, 1st level miners have IDs 12690-12691 (2), 2nd level miners – 12692-126995 (4), etc. If a zero-level miner can't generate a block, 1st level nodes come into force. If they can’t do it either, such a right goes to the 2nd level nodes, etc. At that there should be timeouts between levels, determined by the getGenSleep() method. Search for the block with minimal hash takes place between the miners of the same level, and the block found is recorded to the block chain.

51% Attack

Levels are determined based on the block title, which has no value to be manipulated, which means it is impossible for some particular miner_id to occur on the zero-level. 51% attack is possible in case the violator gains access to 51% of miners’ private keys. Shall there be 100’000 miners in the DC-network, such violator would have to gain control over more than 50’000 private keys.

See also

Clone this wiki locally