Brevis
Search
K

Receipt Proof

Brevis receipt proof enables attestation of transaction receipts from a remote source chain. Please refer to this section to learn more about the receipt proof protocol. Here we introduce how to integrate an App contract with the Brevis receipt proof framework.
App contracts need to interact with the ReceiptVerifier to get the verified transaction receipt information by using the following interface
interface IReceiptVerifier {
struct ReceiptInfo {
bool success;
uint64 chainId;
bytes32 blkHash;
uint32 blkNum;
uint64 blkTime;
LogInfo[] logs;
// TODO: add transaction index
}
struct LogInfo {
address addr;
bytes32[] topics;
bytes data;
}
function verifyReceipt(
bytes calldata receiptRaw,
bytes calldata proofData,
bytes calldata auxiBlkVerifyInfo
) external view returns (ReceiptInfo memory receiptInfo);
}
The verifyReceipt function takes the following inputs generated by the proofing system:
  • receiptRaw The leaf vault of the receipt in Receipt MPT. The generation code can be found in go-ethereum.
  • poofData is the Groth16 ZK proof data and public inputs for the attested transaction receipt.
  • auxiBlkVerifyInfo is the auxiliary block verification info with necessary block Merkle proof data. It is passed to the BlockSyncer contract to validate that the block containing the transaction exists on the source chain.
The function returns the verified ReceiptInfo, of which data fields can be used by caller contracts (see examples in the following subsection).