应用科学学报 ›› 2023, Vol. 41 ›› Issue (4): 541-562.doi: 10.3969/j.issn.0255-8297.2023.04.001

• 区块链 • 上一篇    下一篇

基于区块链的公平和可验证电子投票智能合约

刘红, 张靖宇, 雷梦婷, 肖云鹏   

  1. 重庆邮电大学 软件工程学院, 重庆 400060
  • 收稿日期:2022-10-25 发布日期:2023-08-02
  • 通信作者: 刘红,副教授,研究方向为区块链和多媒体安全。E-mail:liuhong1@cqupt.edu.cn E-mail:liuhong1@cqupt.edu.cn
  • 基金资助:
    国家重点研发计划(No. 2021YFF0704102)资助

Fair and Verifiable Voting Smart Contract Based on Blockchain

LIU Hong, ZHANG Jingyu, LEI Mengting, XIAO Yunpeng   

  1. College of Software Engineering, Chongqing University of Posts and Telecommunication, Chongqing 400060, China
  • Received:2022-10-25 Published:2023-08-02

摘要: 针对等权投票机制中存在的公平性缺陷和重放攻击问题,提出一种基于区块链的加密证明方案。首先,将投票流程和规则写入智能合约,包括时间戳和财务激励,以保证投票按时进行。规定每个投票者负责自己的地址密钥生成,构建基于地址公钥的Merkle树来证明投票者身份的合法性且保证交易数据不被篡改。同时利用哈希函数生成随机序列预防重复投票。其次,考虑到最终目的是得到求和结果,利用区块链公告板和Paillier算法加密存储选票,在克服公平性缺陷的同时提升加解密效率。最后,考虑到交易合法性和计算结果准确性问题,利用区块链的不可篡改特性,构造基于zk-SNARK的零知识证明。将需要证明的现实问题转化为特定输出的计算问题,将加密算法从零知识证明电路中抽离,不会泄露验证数据的信息。理论分析和实验结果表明,所提出的方案与已有方案相比显著提高了投票的安全和隐私,且具有更低的时间开销和成本消耗。

关键词: 区块链, 智能合约, 零知识证明, Paillier算法, 投票协议

Abstract: This paper proposes a blockchain-based encryption-proof scheme to address the fairness flaws and replay attacks in the equal voting mechanism. First, the voting process and rules are written into smart contracts, including time stamps and financial incentives, to ensure that voting takes place on time. It is stipulated that each voter is responsible for his address key generation. A Merkle tree based on the address public key is constructed to prove the legitimacy of the voter’s identity. Meanwhile, a random sequence is generated by hash to prevent repeat voting. Second, the blockchain bulletin board and Paillier algorithm encrypt and store votes to improve the encryption and decryption rate while overcoming the fairness defect. Finally, to ensure transaction legality and calculation accuracy, a zero-knowledge proof based on zk-SNARK is constructed based on the immutable characteristics of the blockchain. In this way, the real problem to be proved is transformed into a calculation problem with specific output, and the encryption algorithm is separated from the zero-knowledge proof circuit, so that the information of the verification data will not be disclosed. Theoretical analysis and experimental results show that the proposed scheme significantly improves the security and privacy of voting and has lower time and cost consumption.

Key words: blockchain, smart contract, zero-knowledge proof, Paillier algorithm, voting protocol

中图分类号: