Canton-Ethereum Bridge is a centralized relayer connecting Canton Network (CIP-56) and Ethereum (ERC-20).
- Core Logic:
pkg/relayer - Canton Client:
pkg/canton(gRPC) - Ethereum Client:
pkg/ethereum(go-ethereum)
- V2 API: ALWAYS import
github.com/chainsafe/canton-middleware/pkg/canton/lapi/v2with aliaslapiv2. - Reason: Avoids naming collisions and ensures clarity between API versions.
- Processor Pattern: The core pattern for bidirectional syncing (
pkg/relayer/processor.go). Do not create separate "CantonProcessor" or "EthereumProcessor" types; use the genericProcessorstruct withSourceandDestinationinterfaces. - Source/Destination Adapters: Use
CantonSource,EthereumSource,CantonDestination,EthereumDestinationinhandlers.goto adapt chain-specific logic to the generic interfaces. - State Management: All state changes must go through
BridgeStore(pkg/db).
- Unit Tests: Run with
go test ./.... - Mocks: Use
pkg/relayer/mocks_test.gofor relayer tests. Do not create ad-hoc mocks if possible.
- Architecture:
docs/architecture_design.md - Canton Details:
docs/canton-integration.md - Relayer Logic:
docs/relayer-logic.md - Next Steps:
docs/next_steps.md