Application
You can build your application on top of Hashi and secured by Hashi. If you have any question, please reach out to Gnosis Chain discord - #hashi channel
The applications below are still WIP. It is only for demo purpose.
Safe on Hashi
Cross-chain transaction using Safe can be a painful experience. The current approach is to set up Safe individually on each chain, and these Safes are independent of each other. There are discussions about how to hold assets on multiple chains and this project aims to tackle the issue by leveraging the security provided by Hashi. In this project, two kinds of approaches are demonstrated: Push and Pull flow.
Push flow
In push flow, a cross-chain transaction is initiated by Safe from source chain (Goerli), and claimed by Safe from destination chain (Gnosis Chain). Goerli's Safe calls Yaho contract to bundle the transaction and relay the message to bridge. Once the message is relayed to Gnosis Chain, it will be stored in Adapter(s) contract. With messageId and message, any user or Safe from Gnosis Chain can call Yaru to claim the transaction.
Push flow utilizes the same logic as message dispatching using Yaru and Yaho.
Check out the demo video for more details: https://youtu.be/vXuffnJCcTM
Pull flow
In pull flow, data is being read from time to time on the source chain (Goerli). A scenario is tested: an owner from Goerli's Safe (which is not the owner from Gnosis Chain's Safe) is able to create a transaction for GC Safe, even though it is not the owner for GC Safe. The security of pull flow relies on: block header provided by ShoyuBashi and proof provided by eth_getProof API from Goerli node. The proof is verified by an off-chain verifier at the current version.
Check out the demo video for more details: https://youtu.be/g-vRKNFmQXc
Reference
Adapters Dashboard
The adapters dashboard shows the latest Goerli block numbers that the respective block hashes has been stored by Hashi adapters on Gnosis Chain. Once the threshold has been reached (2 out of 4 adapters has stored the same block hash), the block hash is considered valid.
https://hashiadapters-dashboard-tvw47.ondigitalocean.app/
Message Dispatching using Yaho and Yaru
For relaying message between Ethereum/Goerli and Gnosis Chain, several contracts need to be deployed on top of the current AMB deployments: Yaho, Yaru, AMB Message Relay, AMB Adapter, and Hashi. The addresses from this article are for Goerli <-> Gnosis Chain.
** In the current deployment, gas
is added as a parameter in dispatchMessagesToAdapters()
to justify the amb's gas requirement. It is not added into the official hashi code at the moment as it might raise incompatibility issue for other adapters. Please be aware that these contracts might be changed anytime.
Goerli -> Gnosis Chain
Contract | Address | Chain |
---|---|---|
Yaho | 0x2fcbfd5bef7c94b77cf920fcc5e76d908a52bccc | Goerli |
AMB Message Relay | 0xb01faaf162732752b24646c7475c445cceceb8a1 | Goerli |
AMB Adapter for Message Relay | 0xe30606a7C2C0Cca6ddE1785cDE999494F164bC4a | GC |
Yaru | 0xb935Ce12B701d62caB5dE4a58f5A59559b50b3A2 | GC |
Workflow
- User calls
Yaho.dispatchMessagesToAdapters
. Example - Yaho calls AMB Message Relay
relayMessages
which will eventually callsstoreHashes
from AMB Adapter on Gnosis Chain. - AMB Message Relay calls AMB
requireToPassMessage
, and the message will be relayed to AMB on Gnosis Chain. - Once the AMB Adapter
storeHashes
is called,MessageDispatched
event will be emitted and user needmessageId
data from the event. Example - User calls
Yaru.executeMessages
withmessageId
andmessage
as parameters. Example
Gnosis Chain -> Goerli
Contract | Address | Chain |
---|---|---|
Yaho | 0x75fF4Bad26345a5b15CCae256900640373EBA601 | GC |
AMB Message Relay | 0x4A25E5374D8df553A1f2ebB628635F826379E4e9 | GC |
AMB Helper | 0xc7118ecF785871F08Feff5DE07d5F884b6199477 | GC |
AMB Adapter for Message Relay | 0xE46610b72d0782029C5654C9224D99264D4B8fa0 | Goerli |
Yaru | 0x15d5678FF44883444264f7947c1c5C31d07b4482 | Goerli |
Hashi | 0x6a948572432818DeBbb04A0b82b6c12ec5Ca15B5 | Goerli |
Workflow
- User calls
Yaho.dispatchMessagesToAdapters
. Example - Yaho calls AMB Message Relay
relayMessages
which will eventually callsstoreHashes
from AMB Adapter on Gnosis Chain. - AMB Message Relay calls AMB
requireToPassMessage
, andUserRequestsForSignature
event will be emitted. - User calls AMB Helper contract's
getSignature
with theencodedData
as parameters obtained from step3, the function will return signature.Tutorial - User calls AMB on Goerli's
executeSignature
withencodedData
andsignature
as parameters. ThestoreHashes
from AMB Adapter will be called,MessageDispatched
event will be emitted and user needmessageId
data from the event. Example - User calls
Yaru.executeMessages
withmessageId
andmessage
as parameters. Example