# Post-Quantum Delegated Proof of Luck for Blockchain Consensus Algorithm
## 3 PQ-DPoL
### Delegation  
To improve efficiency, DPoL delegates block generation and verification to a smaller number of nodes. The delegation process improves efficiency by assigning block generation and verification to a small subset of delegate nodes (N nodes), reducing the overall workload and speeding up the consensus process. At the start of the consensus process, each node generates a random value to select delegate nodes. This ensures that the selection is fair, unpredictable, and secure, preventing any entity from manipulating the process. Each node uses an indexed verifiable random function (iVRF) to generate a random value based on the hash of the previous block and the node's ID. This value is then broadcast to the network for verification by other nodes. This process ensures the integrity of the random values and prevents any manipulation or malicious activity, maintaining the security and reliability of the network. The iVRF ensures that the selection of delegate nodes remains unpredictable and verifiable, enhancing security while maintaining a decentralized network structure. By using an iVRF, the system maintains decentralization and prevents any single entity from gaining disproportionate control, thereby safeguarding the integrity of the blockchain. Additionally, the iVRF's key refresh mechanism imposes minimal overhead, ensuring the network maintains high security standards without sacrificing performance. Fairness through Random Selection  
To ensure fairness in node selection, each node generates a random value using the iVRF, which ensures unpredictability and security in the random value generation process. Moreover, the iVRF leverages lattice-based hierarchical identity-based encryption (HIBE) schemes to incorporate forward security. This approach allows for efficient key refreshing without the need to frequently replace the entire key set, addressing potential issues with key updates in blockchain systems. Once all nodes have generated their random values and transmitted them to other nodes, each node verifies the received random values. After verification, the nodes compare the verified random values and select the N nodes with the smallest values as delegate nodes for the next phase. Selecting nodes based on the smallest random values ensures that the process is fair and unpredictable. This minimizes the risk of manipulation or collusion, preventing any entity from gaining an unfair advantage and maintaining the integrity of the network. This approach helps prevent centralization and ensures that every node has an equal probability of being selected as a delegate, thereby maintaining the decentralization and security of the blockchain. As described in Algorithm 1, the process of generating and broadcasting iVRF values begins with each node using its secret key (\(SK_{A}\)), a specific input, and the hash of the previous block (\(H_{prev}\)) to generate a random value (\(R_{A}\)) and a corresponding proof (\(\tau_{A}\)) through an indexed verifiable random function (iVRF). The function iVRF_GenerateAndBroadcast takes these inputs and produces the random value and proof pair. Once generated, the node broadcasts the pair (\(R_{A}\), \(\tau_{A}\)) to the network, allowing other nodes to verify the correctness of the random value using the proof. ```
Input:\(input\), \(SK_{A}\) (secret key of Node A), \(H_{prev}\) (previous block hash) Output:\(R_{A}\) (random value), \(\tau_{A}\) (proof) function iVRF_GenerateAndBroadcast(\(input\), \(SK_{A}\), \(H_{prev}\)) \((R_{A},\tau_{A})\leftarrow\)iVRF(\(SK_{A}\), \((input,H_{prev})\))  Broadcast (\(R_{A}\), \(\tau_{A}\)) to the network endfunction
```  
**Algorithm 1** Generating and broadcasting iVRF values  
In Algorithm 2, the iVRF (indexed verifiable random function) verification process requires each node to validate the random values generated by others. During the verification, iVRF values are compared through Algorithm 3. As the network expands, this process scales with the number of nodes, potentially increasing the computational load.