Crate eth_bridge

source ·
Expand description

Multi-network Ethereum Bridge pallet

Description

Provides functionality for cross-chain transfers of assets between Sora and Ethereum-based networks.

Overview

Bridge can be divided into 3 main parts:

  1. Bridge pallet. A Substrate pallet (this one).
  2. Middle-layer. A part of the bridge pallet, more precisely, off-chain workers.
  3. Bridge contracts. A set of smart-contracts deployed on Ethereum-based networks.

Definitions

Thischain - working chain/network. Sidechain - external chain/network. Network - an ethereum-based network with a bridge contract.

Bridge pallet

Stores basic information about networks: peers’ accounts, requests and registered assets/tokens. Networks can be added and managed through requests. Requests can be incoming (came from sidechain) or outgoing (to sidechain). Each request has it’s own hash (differs from extrinsic hash), status (RequestStatus), some specific data and additional information. The requests life-cycle consists of 3 stages: validation, preparation and finalization. Requests are registered by accounts and finalized by bridge peers.

Middle-layer

Works through off-chain workers. Any substrate node can be a bridge peer with its own secret key (differs from validator’s key) and participate in bridge consensus (after election). The bridge peer set (Peers in storage) forms an n-of-m-multisignature account (BridgeAccount in storage), which is used to finalize all requests.

Bridge contract

Persists the same multi-sig account (+- 1 signatory) for validating all its incoming requests.

Re-exports

Modules

Macros

Structs

Enums

Constants