Safe on Hashi

August 16, 2023
/
Zeng Huy

This project aims to provide a Safe app interface for users to create cross-chain transactions, secured by Hashi. It focuses on tackling the issues discussed in this forum post, How Can a Safe Hold Asset on Multiple Chains by building a cross-chain Safe prototype.

Problem

In the current phase (up to Safe v1.4.0), you have to deploy a Safe on each chain respectively to enable transactions on each chain and these Safe wallets are independent of each other with different addresses. There is no link of connection between these Safe(s). To create a transaction on a specific chain, one has to switch to that network, and can only create a transaction if one is the owner(s) of the Safe.

Solution

Making a Safe as a proxy/main Safe, which can 'control' Safe(s) on other chains, which we will refer to as a secondary Safe. 

In this project, a Safe on Goerli is referred to as the main Safe, where a Safe on Gnosis Chain is referred to as a secondary Safe.

There are two approaches outlined in the forum post: Push flow and Pull flow. In Push flow, the main Safe calls the AMB (Arbitrary Message Bridge) to specify which chain, contract and function to call, initiated by the secondary Safe. If the secondary Safe is not deployed, it will be deployed by the AMB.

Push Flow

For Push flow in this project, the main Safe will call the Yaho contract and specify which chain, contract and function to call, and which bridge solution to use (only the AMB is demonstrated at the moment). Yaho will dispatch the message with messageId and message Hash, then pass it to the AMB for relay over to Gnosis Chain. The hash will be stored in the Adapter(s) contract. The message has to be claimed in order to finish the entire workflow. With messageId and the original message, anyone can call Yaru to claim the message. The transaction will be called by the Hashi Module of the secondary Safe and complete the workflow. The security of the Push flow relies on the hash of the message. Check out how to create a hash of the message in this repo.

Video Demo: https://www.youtube.com/watch?v=vXuffnJCcTM/ 

Pull Flow

In Pull flow, data from Ethereum/Goerli is read from time to time. Transactions will be initiated on Gnosis Chain, with 'permission' from Ethereum/Goerli, by validating Merkle Proofs generated from data on Ethereum/Goerli. In this project, a scenario is tested: an owner from the main Safe is able to create a transaction for the secondary Safe, even though it is not the owner of the secondary Safe. The security of the Pull flow relies on the block header provided by ShoyuBashi and proof provided by eth_getProof API from Ethereum/Goerli node. The proof is verified by an off-chain verifier at the current version. Check out the server folder to understand how to run the off-chain verifier. On-chain verification will be implemented in the near future.

Video demo: https://www.youtube.com/watch?v=g-vRKNFmQXc

Multi-network Safes are an important feature to move this ecosystem to the next level for individuals and organizations. The author of this tutorial, Zeng, is a junior bridge engineer for Gnosis Chain. He focuses on improving cross-chain UX and security for Gnosis Chain.

The author of this tutorial, Zeng, is a junior bridge engineer in Gnosis Chain. He focuses on improving cross-chain UX and security in Gnosis Chain.

References and Additional Resources

🛠 Building on Gnosis Chain and Hashi with Auryn Macmillan https://www.youtube.com/watch?v=QxfpjF6g2u8

🏗️ Hashi GitHub

  1. Safe on Hashi App Github: https://github.com/zengzengzenghuy/Safe-on-Hashi-App
  2. Safe on Hashi App tutorial: https://github.com/zengzengzenghuy/Safe-on-Hashi-App/tree/main#using-the-app
  3. What is Hashi: https://docs.gnosischain.com/bridges/hashi/

Read original article on mirror.xyzRead original article on substack