Validating your statements
Once you’ve fetched the proof, you can now verify it using a contract on Chiado. The contract will use the HashiProver helper library to check the proof against the block header stored on Chiado.
Deploying the Verification Contract on Chiado
Here is the contract that you will deploy on Chiado to read and verify the Transfer event on Sepolia:
Deployment:
In this example, pass the Hashi Prover contract on Chiado, ERC20Contract address on Sepolia that the Transfer event is emitted from, and chain ID of the ERC20Contract (Sepolia: 11155111)
Explanation:
This contract uses HashiProver to verify the event proof fetched earlier from Sepolia.
It checks that the proof is from Sepolia (chain ID 11155111), and rlpEncodedEvent returns from HashiProver.verifyForeignEvent matches the expectedRlpEncodedEvent that we passed as the function argument. To create the expectedRlpEncodedEvent, check out the helper script from Hashi-template.
The
verifyForeignEvent
function validates the event proof against the block header stored on Chiado, which was relayed from Sepolia.If the proof is valid, the contract emits the
TransferEventVerified
event. You may defie your own logic after the proof has been verified.
References
Last updated