Brevis
Search
K

Transaction Proof

Brevis transaction proof enables attestation of transaction contents from a remote source chain. Please refer to this section to learn more about the transaction proof protocol. Here we introduce how to integrate an App contract with the Brevis transaction proof framework.
App contracts need to interact with the TxVerifier Contract to get the verified transaction information by using the following interface
interface ITxVerifier {
struct TxInfo {
uint64 chainId;
uint64 nonce;
uint256 gasTipCap;
uint256 gasFeeCap;
uint256 gas;
address to;
uint256 value;
bytes data;
address from;
uint32 blkNum;
bytes32 blkHash;
uint64 blkTime;
}
function verifyTx(
bytes calldata txRaw,
bytes calldata proofData,
bytes calldata blkVerifyInfo
) external view returns (TxInfo memory txInfo);
}
The verifyTx function takes the following inputs generated by the proofing system:
  • txRaw is the RLP encoded data of a signed EIP-1559 transaction (example). Other transaction types will be supported later by adding related RLP decode logic in the TxVerifier contract.
  • poofData is the Groth16 ZK proof data and public inputs for the attested transaction.
  • blkVerifyInfo 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 TxInfo, of which data fields can be used by caller contracts (see example in the following subsection).