Hashi is an EVM Hash Oracle Aggregator, designed to facilitate a principled approach to cross-chain bridge security.
The primary insight being that the vast majority of bridge-related security incidents could have had minimal impact if the systems relying on them had built in some redundancy. In other words, it's much more secure to require messages be validated by multiple independent mechanisms, rather than by just one.
For detailed documentation, read the full guide here. To explore the real-time cross-chain activity and block headers, visit the Hashi Explorer.
Hashi (橋) allows users to:
- Build custom oracle adapter contracts for any hash oracle mechanism they would like to use.
- Query an oracle for the hash for a given ID in a given domain. (e.g. header of a block on a given chainId)
- Query a set of adapters the hash for a given ID in a given domain.
- Query for a unanimously agreed upon block hash from a set of adapters for a given ID in a given domain.
ShoyuBashi (所有橋) allows:
- An
owner
account to:- Define an instance of Hashi to query.
- Define a set of adapters for each domain.
- Define a threshold of adapters that must agree on a hash for each domain.
- Change any of the above settings at any time.
- Anyone to:
- Query for a unanimously agreed on hash from that full set of adapters.
- Query for a hash agreed upon by a threshold of adapters for a given block on a given chain; the provided adapters must all agree on the hash for the ID, must all be enabled as adapters for the given domain, and must exceed the threshold for the domain.
Yaho (ヤッホー) allows users to:
- dispatch arbitrary messages via Hashi, which:
- emits the hash of arbitrary messages as events
- stores the hash of arbitrary message in storage
- relay previously stored messages to any number of message adapters
- dispatch messages and relay them to adapters in a single call
Yaru (やる) allows anyone to:
- execute arbitrary messages passed from Yaho
Node
This repository targets v22 of node. We recommend using nvm to manage your node version.
Once installed, you should change versions automatically with the .nvmrc
file.
Docker
Make sure you have the correct version of Docker installed on your machine.
You may refer to Dockerfile
under each workspace and docker-compose.yml
on the root for more details regarding the build process.
packages/common
: Common logic that will be used across multiple workspaces.packages/evm
: On chain components includes Solidity smart contracts, deploy tasks, tests. Built with Hardhat.packages/executor
: A service utilized to execute messages once they have achieved consensus.packages/relayer
: A service used to relay batches of dispatched messages through Yaho to the reporter contracts.packages/reporter
: Script to call Reporter contract'sdispatchBlocks
function of different oracle from source chain to destination chain.
This monorepo uses Yarn Workspaces. Installing dependencies can be done from the root directory of the repository.
-
Installing dependencies
git clone https://github.com/gnosis/hashi cd hashi nvm use yarn install
To build & run each packages, navigate to each package separately, check the README.md in each workspace for more details.
Before running docker for the workspace, insert the correct environment variable in .env.
cp .env.example .env
Build & run Run the following command to build and run all the services.
docker compose up --build
Hashi has been audited by G0, Omega and Least Authority.
The audit results can be found here.
All contracts are WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Created under the LGPL-3.0+ license.