Monero bulletproof 源码结构解析

1. 代码下载并切换到指定commit

切换到 bp-multi-aggregation 分支的7f964dfc8f15145e364ae4763c49026a3fab985d commit.

git clone https://github.com/moneromooo-monero/bitmonero.git
cd bitmonero
git checkout 7f964dfc8f

Bulletproof的代码实现主要在src/ringct目录下,其中ringct代表Ring Confidential Transaction.
该目录下的代码结构主要为:
src/ringct
├── bulletproofs.cc
├── bulletproofs.h
├── CMakeLists.txt
├── multiexp.cc
├── multiexp.h
├── rctCryptoOps.c
├── rctCryptoOps.h
├── rctOps.cpp
├── rctOps.h
├── rctSigs.cpp
├── rctSigs.h
├── rctTypes.cpp
└── rctTypes.h

src/ringct目录下的源码主要依赖为:

  • src/crypto/目录下定义的密码学函数;
  • src/common/, src/serialization/contrib/epee/include/目录下的工具类函数;
  • src/cryptonote_config.hcryptonote_basic/cryptonote_format_utils.h文件中定义的通用格式和函数;
  • boostopenssl/ssl.h等外部依赖库。

2. 代码结构

src/ringct目录下主要有以下6类功能:
bulletproofs declares the two main functions bulletproof_PROVE and bulletproof_VERIFY with variants depending on the input parameters.
multiexp declares the structure and the functions used for multi-exponentiation. The three algorithms implemented are Straus, Bos-Coster and Pippenger.
rctCryptoOps declares the function sc_reduce32copy(unsigned char * scopy, const unsigned char *s) which is a variant of sc_reduce32(unsigned char *s) in src/crypto/crypto-ops.h providing the result in scopy. It is a reduction modulo
ℓ = 2252 + 27742317777372353535851937790883648493 (order of the main subgroup of the curve Ed25519) of a 32-byte input.
rctOps declares constants and functions related to the manipulation of vectors or points (initialization, random generation, addition, multiplication, commitments, hash-to-point, etc.)
rctSigs declares functions related to the Multilayered Spontaneous Anonymous Group Signatures (MLSAG signatures) which allows the confidential transactions. It also contains the former range proof and verification functions relying on ring signatures that should be replaced by bulletproofs.
rctTypes defines all the objects (key, signature, tuple, etc.) in the rct namespace and conversion functions.

参考资料:
[1] https://ostif.org/wp-content/uploads/2018/10/OSTIF-QuarksLab-Monero-Bulletproofs-Final2.pdf

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值