文档

隐私接口函数

更新时间:

隐私接口函数示例

蚂蚁区块链平台在支持原生 Solidity 的接口基础上,又添加了部分隐私接口函数,主要包括三个函数:

  • VerifyCommitment
  • VerifyRange
  • VerifyBalance

其使用示例如下所示:

  1. function test_verify_commitment() public returns (bool)
  2. {
  3. bytes memory b2 = new bytes(65);
  4. string memory name = "abcdefghijklmnopqrstuvwxyz";
  5. b2 = "0123456789012345678901234567890123456789012345678901234567890123";
  6. identity addr = 0x123456;
  7. return verify_commitment(name, 0x30, addr, b2);
  8. }
  9. function test_verify_balance() public returns (bool)
  10. {
  11. return verify_balance(0x21);
  12. }
  13. function test_verify_range() public returns (bool)
  14. {
  15. return verify_range(0x10, 0x20);
  16. }

VerifyCommitment

VerifyCommitment 为承诺验证函数。

函数原型

  1. VerifyCommitment(string name, uint index, identity to,const bytes value_enc) returns(bool result);

请求参数

参数 必选 类型 说明
name string 承诺类型,0 表示 input,1 表示 output
index uint 承诺索引
to identity 承诺所属账户
value_enc bytes 承诺数值

返回值

参数 必选 类型 说明
result bool 方法返回值,成功为 true,否则为 false

VerifyBalance

balance 校验函数。

函数原型

  1. VerifyBalance(uint range) returns(bool);

请求参数

参数 必选 类型 说明
index uint balance 验证索引

返回值

参数 必选 类型 说明
result bool 方法返回值,成功为 true,否则为 false

VerifyRange

VerifyRange 是验证范围函数。

函数原型

  1. VerifyRange(uint index, int min_value) returns(bool);

请求参数

参数 必选 类型 说明
index uint32 验证索引范围
min_value int64 验证范围最小值

返回值

参数 必选 类型 说明
result bool 方法返回值,成功为 true,否则为 false
  • 本页导读 (0)
文档反馈