RWA API 参考

完整的预编译合约地址映射、输入输出格式、Gas 成本参考。

预编译合约完整列表

合规模块 (0x01xx)

地址功能输入格式输出格式Gas
0x0100KYC 检查[32 bytes address][32 bytes status]
1=批准, 0=未批准
1,000
0x0101合规转账检查[32 from][32 to][32 value][32 status][32 error]2,000
0x0102投资者类型查询[32 bytes address][32 bytes type]
0=Retail, 1=Accredited...
1,000
0x0103管辖权查询[32 bytes address][32 bytes jurisdiction]1,000
0x0104冻结地址[32 address][1 byte flag][32 bytes status]1,500
0x0105设置 KYC 记录[20 addr][1 status][1 type][32 jur][32 exp][32 flags][32 bytes status]3,000

ERC-3643 模块 (0x02xx)

地址功能输入格式输出格式Gas
0x0200ERC3643 转账[32 from][32 to][32 amount][32 bytes success]3,000
0x0201ERC3643 铸造[32 to][32 amount][32 bytes success]5,000
0x0202ERC3643 销毁[32 from][32 amount][32 bytes success]5,000
0x0203余额查询[32 bytes address][32 bytes balance]1,000
0x0204白名单管理[32 address][1 byte add][32 bytes success]2,000
0x0205冻结管理[32 address][1 byte freeze][32 bytes success]2,000

ZKP 模块 (0x03xx)

地址功能输入格式输出格式Gas
0x0300Groth16 验证[32 vk_hash][proof_data][public_inputs][32 bytes valid]150,000+
0x0301Plonk 验证[32 vk_hash][proof_data][public_inputs][32 bytes valid]200,000+
0x0302KYC 证明验证[32 commitment][32 jur][32 type][32 proof][32 bytes valid]100,000
0x0303范围证明验证[32 commitment][32 proof][32 bytes valid]80,000

Go SDK 调用示例

cm := state.NewComplianceManager()
record := &state.KYCRecord{
    Address:        common.HexToAddress("0x123..."),
    Status:         state.KYCStatusApproved,
    InvestorType:   state.InvestorTypeAccredited,
    Jurisdiction:   state.JurisdictionHK,
    ComplianceFlags: state.FlagWhitelisted,
    VerifiedBy:     "0xVerifier",
    VerifiedAt:     time.Now(),
    ExpiresAt:      time.Now().Add(365 * 24 * time.Hour),
}
cm.SetKYCRecord(record)
canTransact := cm.CanTransact(addr)

完整文档

查看完整的开发者指南:RWA_DEVELOPER_GUIDE.md