Solidity SDK
SDK for verifying certificates generated by pod validators.
Introduction
The pod Solidity SDK enables smart contracts to verify pod transaction receipts and validator attestations on another EVM-based chain, such as Ethereum. This document provides a comprehensive reference for the SDK's verification capabilities, including aggregate signature verification and merkle proof validation.
Core Components
Receipt Verification
The SDK centers around the verification of pod network receipts, which contain both transaction data and validator attestations. The receipt data is organized in a merkle tree structure, with validator signatures attesting to the root hash of this tree.
Verification Interface
The IPodVerifier interface provides three core verification methods:
Attestation Verification
Parameters:
receiptHash
: The hash of the receipt that was signedaggregateSignature: The aggregate signature generated by the committee of pod validators.
bitmask: A bitmask signifying which validators signed the aggregate signature. The first bit is 1 if the first validator signed the receipt, otherwise 0, The second bit for the second validator, etc.
Returns:
bool
: True if the attestation is valid
Errors:
InvalidSignature
: Aggregate signature verification failedInsufficient
: Committee quorum size was not reached
This method verifies that a receipt has received a sufficient number of valid signatures from the current validator committee.
Log Verification
Parameters:
receiptHash
: The hash of the transaction receipt containing the loglogHash: The hash of the log (containging addres, topics and data).
logIndex
: Index of the log to verifyproof
: Merkle proof for the log
Returns:
bool
: True if the log proof is valid
Errors:
InvalidProof
: Merkle proof verification failedInvalidLogIndex
: Log index is out of bounds
This method verifies individual event logs within a receipt using their index and a merkle proof.
Field Verification
Parameters:
receipt
: The transaction receipt containing the fieldgeneralizedIndex
: Position of the field in the receipt treeexpectedValue
: Expected hash of the field valueproof
: Merkle proof for the field
Returns:
bool
: True if the field proof is valid
Errors:
InvalidProof
: Merkle proof verification failedInvalidGeneralizedIndex
: Invalid generalized index
This method enables verification of any field in the receipt using its generalized index in the merkle tree.
Error Handling
The SDK defines the following standard error conditions:
Implementation Guidelines
A complete implementation of receipt verification should:
First verify the aggregate signature using verifyAttestation()
Then verify any specific fields or logs using the appropriate verification method
Only proceed with receipt processing if all verifications succeed
Security Considerations
Developers implementing receipt verification should:
Always validate both attestations and proofs before accepting a receipt as valid.
Ensure the committee data matches the current validator set.
Validate that quorum requirements meet network specifications.
Use correct generalized indices when verifying specific fields.
Implement proper error handling for all verification failure cases.
Maintain secure access controls for any contracts implementing verification.
Dependencies
The SDK requires:
Solidity compiler version 0.8.12 or later
External Resources
Last updated