How this randomness occurs? Is this randomness a network randomness or a local one? If it is a local one, can I hack my local random generator (/dev/random) and cheat the system? Can someone show me the code chunk? https://github.com/decred thanks for your answer
It uses a deterministic PRNG with a seed of the header of the block that is being voted on. This ensures every node is able to independently verify consensus while still providing a selection process that is random. What is probably the most readable code regarding this process can be found in the chaingen package which is used to actually test the consensus rules. https://github.com/decred/dcrd/blob/master/blockchain/chaingen/generator.go#L996-L1118