How Hashi Works
Hashi is a decentralized protocol that allows secure cross-chain communication. By enabling contracts on one blockchain to interact with contracts on another, Hashi facilitates cross-chain data transfer and execution through message dispatching, storage proofs, and cryptographic verification.
The process involves sending a message or verifying a state across blockchains, such as Sepolia and Gnosis Chiado, using a series of contracts and oracles. Let’s break down how this works in practice:
Verifying State with Cross-Chain Proofs
A powerful feature of Hashi is the ability to verify the state of a contract on one chain using cryptographic proofs stored on a different chain. Here’s how this works using Sepolia and Chiado as origin and target chains:
Storing Block Headers:
The first step is to relay block headers from Sepolia to Chiado.
These headers are stored in the Header Storage contract on Chiado and contain essential information like the state root, which can be used to validate the state of a Sepolia smart contract.
Requesting a Proof:
Verify the value stored in a specific storage slot of a contract on Sepolia (Chain A).
Generate a Merkle proof that shows the value of this storage slot on a particular block on Sepolia. This proof includes information from the block header (stored on Chiado) and the Merkle path leading to the value.
Submitting the Proof:
You submit this proof to the Yaru contract on Chiado. The Yaru contract checks the proof against the block header that was previously relayed and stored in the Header Storage contract.
If the proof is valid, Hashi confirms that the state on Sepolia matches what was proven in the Merkle proof.
In this way, you can verify contract state on Sepolia directly from Chiado, without interacting with Sepolia in real-time, using trustless proofs and stored block headers.
Message Dispatching Across Chains
Start on Chain A (Sepolia):
Imagine you have a contract on Sepolia that needs to send a message to a contract on Gnosis Chiado (Chain B).
On Sepolia, you use Hashi’s Yaho contract, which is specifically designed for dispatching messages across chains.
Sending the Message:
Your Sepolia contract calls the Yaho contract, instructing it to send a message to the Yaho contract on Chiado.
The message typically contains the target contract address on Chiado and the data you want to send (such as a function call or value).
Relaying the Message:
Once the message is dispatched, it is picked up by Hashi’s oracle network. These oracles listen for events on Sepolia, relay the message, and submit it to Yaho on Chiado for execution.
Multiple oracles are used for redundancy and security, ensuring that the message is properly validated before it’s passed to Chiado.
Receiving and Executing the Message on Chain B (Chiado):
On Chiado, the Yaho contract receives the message after the oracles validate the block header and the message’s integrity.
Once validated, the Yaho contract triggers the appropriate callback function on the target contract (for example, updating the contract state or calling a specific function).
In practice, this allows you to seamlessly send a message from Sepolia to Chiado, have it validated by multiple oracles, and executed on the destination chain.
Last updated