trying to create a leader election protocol with my specifications but i fail. Let me describe more detail.
Let's imagine we have 5 nodes A,B,C,D,E and let's also assume that all of them compete to solve a puzzle something like PoW but for our scenario is irrelevant. Let's also assume that both C,D solve simultaneously the puzzle and send the proofs for verifications in the other nodes.
A[C2,D3]
B[C4,D2]
E[C3,D6]
Nodes A,B,E receives messages from C,D. For example node A receives a message from C at timestamp 2 and from D at timestamp 3 it also verifies proofs that C,D solves the puzzle successfully.
What i am searching for now is to pick the fastest node from the winners C,D and recognize him as the leader of the protocol. As a result, they all exchange their messages and they average the times to find the winner node with the smallest time. if randomly pick node B it will calculate the time for C [4+2+3]/3=3, D[3+2+6]/3=3,6.
Hence every node will calculate time 3 for C and time 3,6 D and finally, they choose C with the lowest timestamp as a leader.
Am i correct until now does this process has logic?
My big problem now is what happened if B node is malicious and try to trick the protocol and send different values to A,E this will confuse all node so they cannot reach a consensus. How can we fix this and pass this step?
Can anyone give me any idea?