Skip to main content

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

info

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

  1. Safe on Hashi App

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

ContractAddressChain
Yaho0x2fcbfd5bef7c94b77cf920fcc5e76d908a52bcccGoerli
AMB Message Relay0xb01faaf162732752b24646c7475c445cceceb8a1Goerli
AMB Adapter for Message Relay0xe30606a7C2C0Cca6ddE1785cDE999494F164bC4a GC
Yaru0xb935Ce12B701d62caB5dE4a58f5A59559b50b3A2GC

Workflow

  1. User calls Yaho.dispatchMessagesToAdapters. Example
  2. Yaho calls AMB Message Relay relayMessages which will eventually calls storeHashes from AMB Adapter on Gnosis Chain.
  3. AMB Message Relay calls AMB requireToPassMessage, and the message will be relayed to AMB on Gnosis Chain.
  4. Once the AMB Adapter storeHashes is called, MessageDispatched event will be emitted and user need messageId data from the event. Example
  5. User calls Yaru.executeMessages with messageId and message as parameters. Example

Gnosis Chain -> Goerli

ContractAddressChain
Yaho0x75fF4Bad26345a5b15CCae256900640373EBA601GC
AMB Message Relay0x4A25E5374D8df553A1f2ebB628635F826379E4e9GC
AMB Helper0xc7118ecF785871F08Feff5DE07d5F884b6199477GC
AMB Adapter for Message Relay0xE46610b72d0782029C5654C9224D99264D4B8fa0Goerli
Yaru0x15d5678FF44883444264f7947c1c5C31d07b4482Goerli
Hashi0x6a948572432818DeBbb04A0b82b6c12ec5Ca15B5Goerli

Workflow

  1. User calls Yaho.dispatchMessagesToAdapters. Example
  2. Yaho calls AMB Message Relay relayMessages which will eventually calls storeHashes from AMB Adapter on Gnosis Chain.
  3. AMB Message Relay calls AMB requireToPassMessage, and UserRequestsForSignature event will be emitted.
  4. User calls AMB Helper contract's getSignature with the encodedData as parameters obtained from step3, the function will return signature.Tutorial
  5. User calls AMB on Goerli's executeSignature with encodedData and signature as parameters. The storeHashes from AMB Adapter will be called, MessageDispatched event will be emitted and user need messageId data from the event. Example
  6. User calls Yaru.executeMessages with messageId and message as parameters. Example