时间: 2025-03-05 | 次数: |
王小伟, 李杰.抗拜占庭节点的Raft改进算法研究[J].河南理工大学学报(自然科学版),2025,44(2):145-153.
WANG X W, LI J.Research on the Raft improved algorithm for anti-Byzantine nodes[J].Journal of Henan Polytechnic University(Natural Science) ,2025,44(2):145-153.
抗拜占庭节点的Raft改进算法研究
王小伟, 李杰
郑州大学体育学院 信息管理中心,河南 郑州 450052
摘要: 目的 为解决原始Raft算法无法处理由拜占庭节点引发的恶意竞选问题和日志易篡改问题, 方法 提出一种能够抵抗拜占庭节点的AntiB-Raft(anti-Byzantine Raft)算法。在候选者请求更换Leader(领导者)阶段,采用心跳监测门限机制确定候选者是否可以成功获得足够的选票成为Leader,约定只有当超过半数节点都认定当前Leader宕机的情况下,候选者才能获得超过半数的选票进而成为新的Leader,防止拜占庭节点在当前Leader未宕机的情况下恶意拉取选票导致正常Leader被更换;在日志校验阶段,采用迭代哈希算法进行日志加密,并选择合适的校验时机进行日志校验,约定每经过K笔交易或Leader更换时进行一次日志校验,确保已经同步的日志正确无误;日志校验过程中,当日志校验失败时采用二分法快速回滚,可以迅速定位到问题日志位置并进行重传操作,大大提高工作效率。 结果 模拟100节点选举过程,Raft算法中恶意候选者获得选票数超过50%,替换掉正常的Leader,本文算法、RB-Raft算法均未超50%,避免了恶意拉票;抗拜占庭方面,Raft算法无法识别错误日志,而AntiB-Raft算法错误日志识别率可达100%,且共识时延比已有算法RB-Raft降低了28%。 结论 本文所提算法AntiB-Raft具备抗拜占庭能力,与已有算法RB-Raft相比降低了共识时延,效率得到了明显提升。
关键词:Raft;共识机制;拜占庭容错;迭代哈希;心跳门限
doi:10.16186/j.cnki.1673-9787.2023060005
基金项目:国家自然科学基金资助项目(61972134);河南省科技攻关项目(212102310264,202102310323)
收稿日期:2023/06/01
修回日期:2023/12/14
出版日期:2025-03-05
Research on the Raft improved algorithm for anti-Byzantine nodes
WANG Xiaowei, LI Jie
Information Management Center, Physical Education College of Zhengzhou University, Zhengzhou 450052, Henan, China
Abstract: Objectives In order to solve the problem of malicious election and log tampering caused by Byzantine nodes in original Raft algorithm, an AntiB-Raft (Anti-Byzantine Raft) algorithm was proposed to resist Byzantine nodes. Methods When the candidate requested to replace the Leader, the heartbeat monitoring threshold mechanism was used to determine whether the candidate can successfully obtain enough votes to become the new Leader, which was agreed that only when more than half of the nodes detected that the current Leader was really down, the candidate can obtain more than half of the votes and become the new Leader, so as to prevent the Byzantine node from maliciously pulling votes when current Leader was not down, which would result in the replacement of the normal Leader. In the log verification phase, iterative hashing algorithm was used to encrypt the logs and appropriate verification time was selected for log verification. It was agreed that log verification was performed once every K transactions or Leader changed to ensure that the synchronized logs were correct. During log verification, if the log verification failed, the binary rollback method was used to locate the faulty log position quickly and retransmit it, which greatly improved the work efficiency. Results To simulate the 100-node election process, the normal Leader was replaced in Raft algorithm because the candidate obtained more than 50% of the votes, while neither RB-Raft nor the proposed algorithm exceeded 50%, thus avoiding malicious canvassing. On the anti-Byzantine, error logs were not identified in Raft algorithm, while the error log recognition rate of AntiB-Raft algorithm can reach 100%, meanwhile the consensus delay was 28% lower than the existing algorithm RB-Raft. Conclusions The proposed algorithm AntiB-Raft had the capability of anti-Byzantine and reduced consensus delay compared with the existing algorithm RB-Raft and its efficiency was improved significantly.
Key words:Raft;consensus mechanism;Byzantine fault tolerance;iterative hash;heartbeat threshold