$ show unionlabs/union
Union is a hyper-efficient zero-knowledge infrastructure layer for cross-chain interoperability, implementing IBC (Inter-Blockchain Communication) with light clients for Cosmos, Ethereum, Sui, StarkNet, Gno, and many other chains. The system comprises a Cosmos SDK blockchain (uniond), a zero-knowledge prover (galoisd) for Groth16 proofs, a modular relayer (voyager) with plugin-based architecture, CosmWasm smart contracts for IBC and asset transfers (UCS03), EVM Solidity contracts, and a TypeScript SDK for programmatic interaction. The frontend is a Svelte 5 application (app2) providing a transfer interface, explorer, dashboard, and staking UI, while documentation is served via an Astro site. The architecture is a multi-language monorepo with Rust as the dominant language for core libraries and relayer modules, Go for the Cosmos SDK chain and prover, TypeScript for SDKs and frontend, and Solidity/Move for smart contracts. Key design patterns include a trait-based light client interface (IbcClient), a plugin system for relayer modules (voyager_sdk), functional effect management in TypeScript (Effect-TS), and derive macros for encoding (model, ssz, ethabi). The codebase demonstrates high craftsmanship in its type-safe encoding primitives, storage abstractions (depolama), and persistent queue (pg-queue), though it suffers from some code duplication across SDK versions and generated protobuf drift risks.
The LLM identified 5 files worth highlighting for reuse:
A standalone Simple Serialize (SSZ) implementation for Ethereum consensus data structures, with derive macros for encoding/decoding, tree hashing, and union types. It includes spec conformance tests and is reusable for any project needing SSZ serialization without depending on the full Ethereum stack.
A generic key-value store abstraction for CosmWasm smart contracts, providing KeyCodec and ValueCodec traits with support for bincode, big-endian height keys, and unit values. It decouples storage logic from contract logic and can be extracted for use in any CosmWasm project.
A persistent job queue backed by PostgreSQL with OpenTelemetry metrics, designed for reliable message processing. It provides a clean API for enqueueing, dequeueing, and acknowledging jobs, and is reusable in any Rust application needing a durable queue.
An implementation of the ICS23 Merkle proof specification, supporting existence and non-existence proofs with configurable proof specs. It includes leaf/inner op validation and root calculation, and is reusable for any blockchain project requiring Merkle proof verification.
A set of encoding traits and derive macros (impl_ethabi_via_try_from_into, impl_proto_via_try_from_into) that provide automatic conversion between Rust types and multiple wire formats (EthAbi, Proto, Bincode, JSON). This pattern reduces boilerplate and ensures consistency across the codebase, and can be reused in any project needing multi-format encoding.