3. getEvidence

基本信息

  1. 接口名称:com.webank.weid.rpc.EvidenceService.getEvidence
  2. 接口定义:ResponseData<EvidenceInfo> getEvidence(String evidenceAddress)
  3. 接口描述: 根据传入的凭证存证地址,在链上查找凭证存证信息。

接口入参: String

接口返回: com.webank.weid.protocol.response.ResponseData<EvidenceInfo>;

名称类型说明备注
errorCodeInteger返回结果码
errorMessageString返回结果描述
resultEvidenceInfo创建的凭证合约地址业务数据
transactionInfoTransactionInfo交易信息

com.webank.weid.protocol.response.TransactionInfo

名称类型说明备注
blockNumberBigInteger交易块高
transactionHashString交易hash
transactionIndexBigInteger交易索引

com.webank.weid.protocol.base.EvidenceInfo

名称类型说明备注
credentialHashString凭证Hash值是一个66个字节的字符串,以0x开头
signersList<String>凭证签发者链上允许存在多个凭证签发者
signaturesList<String>签发者生成签名和每个签发者一一按序对应的签名值

此方法返回code

enumcodedesc
SUCCESS0成功
CREDENTIAL_EVIDENCE_BASE_ERROR100500Evidence标准错误
TRANSACTION_TIMEOUT160001超时
TRANSACTION_EXECUTE_ERROR160002交易错误
ILLEGAL_INPUT160004参数为空

调用示例

  1. EvidenceService evidenceService = new EvidenceServiceImpl();
  2. ResponseData<Evidence> response = evidenceService.getEvidence("0xa3203e054bb7a7f0dec134c7510299869e343e8d");
  1. 返回结果如:
  2. result:(com.webank.weid.protocol.base.EvidenceInfo)
  3. credentialHash: 0x31c2db44db19ec1af69ed6ad2dc36c7a8068c9871cf1a2bd0e67cb6264531f35
  4. signers:(java.util.ArrayList)
  5. [0]:0x39e5e6f663ef77409144014ceb063713b65600e7
  6. signatures:(java.util.ArrayList)
  7. [0]:HJoVLhynrqekQWjMEHubd0e5E/J3LLfnWtq3CXpjFaA/Tfj3i0+dDGfa76OqoZhqSuNucXW8f4BZn/Lkd6SPQ/I=
  8. errorCode: 0
  9. errorMessage: success
  10. transactionInfo:null

时序图

sequenceDiagramparticipant 调用者participant EvidenceServiceparticipant 区块链节点调用者->>EvidenceService: 调用GetEvidence()EvidenceService->>EvidenceService: 入参非空、格式及合法性检查opt 入参校验失败EvidenceService—>>调用者: 报错,提示参数不合法并退出endEvidenceService->>区块链节点: 调用智能合约,查询凭证存证内容区块链节点—>>EvidenceService: 返回查询结果opt 查询出错EvidenceService—>>调用者: 报错并退出endEvidenceService—>>调用者: 返回成功