## 4 Platform Design
### Consensus Protocol
Results in Figure 13 describe miner involvement in forks given a different number of fraudulent nodes. ```
1:for\(i\gets 0\) to \(NumberOf(threads)\)do
2:if\(thread.ExecutionTime\leq Threshold\)then
3:\(t\leftarrow\)\(Ttreshold\)
4:else
5:\(t\leftarrow\)\(thread.ExecutionTime\)
6:endif
7:endfor
8:\(Min\leftarrow\)\(Math.min(array)\)
9:for\(i\gets 0\) to \(Size(array)\)do
10:if\(array[i]\leq Min\)then
11: MinerIndexes.push(i)
12:endif
13:endfor
14:return MinerIndexes
```  
**Algorithm 14** Miner threads. Miners for each round are defined according to the pseudocode of Algorithm 14. The obtained results showed that in each mining round there are always at least two successful miners, which corresponds to a fork situation. This is expected, since all miners are supposed to have the same hashing power. Results in Figure 13 describe miner involvement in forks given a different number of fraudulent nodes. Figure 12: Threads running concurrently on CPU cores, simulating miners competing to add a new bloc. Fraudulent nodes are threads given less difficulty than the rest, to emulate nodes that have higher hashing power than allowed. It can be seen that fraudulent nodes are always ahead of others in the number of blocks mined successfully, even when the number of fraudulent nodes exceeds half of the total network. Hence, a fraudulent node can be easily spotted. Since the nodes in the proposed architecture are not anonymous, they can be held accountable for any proven fraudulent behavior. To implement the proposed consensus protocol on an Ethereum private blockchain, the go-Ethereum source code needs to be slightly overwritten. This can be done by performing minor additions to the source-code in the file: \"[[https://github.com/ethereum/go-ethereum/blob/master/consensus/ethash/consensus.go](https://github.com/ethereum/go-ethereum/blob/master/consensus/ethash/consensus.go)]([https://github.com/ethereum/go-ethereum/blob/master/consensus/ethash/consensus.go](https://github.com/ethereum/go-ethereum/blob/master/consensus/ethash/consensus.go))\" accessed on 23 March 2022  
Figure 13: Miners involvement in forks using the proposed consensus protocol. The following Algorithm 15 is a code snippet with the original line members from go-ethereum source code on Github; the applied additions are highlighted. ```
// Various error messages to mark blocks invalid. These should be private to prevent engine specific errors from being referenced in the remainder of the codebase, inherently breaking if the engine is swapped out. Please put common error types into the consensus package. var(  errOlderBlockTime = errors.New(\"timestamp older than parent\")  errToManyUncles = errors.New(\"too many uncles\")  errDuplicateUncle = errors.New(\"duplicate uncle\")  errUncleLSncestor = errors.New(\"uncle is ancestor\")  errDanglingUncle = errors.New(\"uncle's parent is not ancestor\")  errInvalidDifficulty = errors.New(\"non-positive difficulty\")  errInvalidMixDigest = errors.New(\"invalid mix digest\")  errInvalidPoW = errors.New(\"invalid proof-of-work\")  errInvalidMinineggTime = errors.New(\"invalid mining time\") func (ethash \"Ethash) verifyHeader(chain consensus.ChainHeaderReader, header, parent *types.Header, uncle bool, seal bool, unixNow int64) error { // Ensure that the header's extra-data section is of a reasonable size if uint64(len(header.Extra)) > params.MaximumExtraDataSize {  returnfmt.Error(\"extra-data too long: %d > %d\", len(header.Extra), params.MaximumExtraDataSize // Verify the header's timestamp  if header.Time > uint64(unixNow+allowedFutureBlockTimeSeconds) {  return consensus.ErrFutureBlock } } if header.Time <= parent.Time {  return errOlderBlockTime }
```  
**Algorithm 15** Modifications performed on PoW consensus in Go-Ethereum