更新时间:2019-08-27 02:02
蚂蚁区块链平台在支持原生 Solidity 的接口基础上,又添加了部分隐私接口函数,主要包括三个函数:
其使用示例如下所示:
function test_verify_commitment() public returns (bool)
{
bytes memory b2 = new bytes(65);
string memory name = "abcdefghijklmnopqrstuvwxyz";
b2 = "0123456789012345678901234567890123456789012345678901234567890123";
identity addr = 0x123456;
return verify_commitment(name, 0x30, addr, b2);
}
function test_verify_balance() public returns (bool)
{
return verify_balance(0x21);
}
function test_verify_range() public returns (bool)
{
return verify_range(0x10, 0x20);
}
VerifyCommitment 为承诺验证函数。
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 |
balance 校验函数。
VerifyBalance(uint range) returns(bool);
参数 | 必选 | 类型 | 说明 |
---|---|---|---|
index | 是 | uint | balance 验证索引 |
参数 | 必选 | 类型 | 说明 |
---|---|---|---|
result | 是 | bool | 方法返回值,成功为 true,否则为 false |
VerifyRange 是验证范围函数。
VerifyRange(uint index, int min_value) returns(bool);
参数 | 必选 | 类型 | 说明 |
---|---|---|---|
index | 是 | uint32 | 验证索引范围 |
min_value | 是 | int64 | 验证范围最小值 |
参数 | 必选 | 类型 | 说明 |
---|---|---|---|
result | 是 | bool | 方法返回值,成功为 true,否则为 false |
在文档使用中是否遇到以下问题
更多建议
匿名提交