4.5 KiB
Janus
Janus is a critical component in the Zenith ecosystem that serves as a transaction aggregation layer bridging Urbit ships and the Zenith blockchain. Named after the two-faced Roman god, Janus faces both directions: toward Urbit ships and toward the Zenith consensus layer.
!!! info "Integrated into zenithd" Janus functionality is integrated into zenithd. Galaxy validators run zenithd in validator mode with a built-in Janus server for their associated star. Independent star operators run zenithd in star mode which includes the Janus bundling service.
Overview
Janus handles the aggregation of transactions and scry bindings between different tiers of Urbit ships and the Zenith blockchain, enabling efficient batch processing and reduced on-chain overhead.
Architecture
The Janus system follows a simplified hierarchical model:
Planet → Star Janus → Galaxy
[submit txs] [bundle txs] [build blocks from bundles]
Key Design Principles
The system uses a simplified hierarchy where stars bundle transactions and send them to galaxy validators who build blocks. Galaxy validators run zenithd in validator mode with a built-in Janus server for their associated star that runs in-process. Independent stars run zenithd in star mode and submit bundles to galaxy validators over HTTP. This enables efficient aggregation where transactions are bundled and scry bindings are batched before blockchain submission.
Star Node Responsibilities
Independent stars run zenithd in star mode (which includes the Janus bundling service) to gather transactions from sponsored planets and aggregate multiple transactions into efficient bundles. They collect and batch scry bindings from the Urbit network and submit bundles and batches to galaxy validators. Associated stars (owned by galaxy validators) have their Janus server run in-process within zenithd validator mode.
Technical Components
Transaction Bundling
Transaction bundling collects individual transactions from planets and creates efficient bundles to reduce blockchain overhead. Bundles are signed with the star's cryptographic key and submitted to galaxy validators. These bundles are prioritized and processed through Zenith's ePBS (Enshrined Proposer-Builder Separation) system, which uses lane-based architecture to ensure fair block space allocation.
Scry Binding Aggregation
Scry binding aggregation collects path-to-hash mappings from the Urbit network and batches multiple bindings for efficient submission. It provides individual signature verification for each binding, enabling off-chain data to be aggregated on-chain through consensus.
Cryptographic Security
The system uses secp256k1 cryptography for signing and integrates with Azimuth PKI for signature verification, providing proof of data integrity and origin.
Configuration
Janus uses YAML configuration files with key sections:
Node Identity
Configuration includes node type (currently only "star" nodes supported), node ID (Urbit @p name or numeric identifier), and port configuration.
Network Settings
Network settings specify the chain ID for the target Zenith network, zenithd URLs for failover support, and the Azimuth watcher GraphQL endpoint.
Operational Parameters
Operational parameters define the maximum transactions per bundle, bundle timeout settings, scry batch size and timeout, and retry configuration for network failures.
API Endpoints
Independent stars running zenithd in star mode expose HTTP endpoints including POST /submit/tx to accept transactions from planets in Cosmos SDK protobuf format, POST /submit/scry to accept scry bindings with individual signatures, GET /health for monitoring health checks, and GET /status for node status and operational metrics.
Integration with zenithd
Built-in Janus Server
Galaxy validators running zenithd in validator mode include a built-in Janus server for their associated star that runs in-process. Galaxy validators accept bundles and batches from independent stars, validate incoming data through consensus mechanisms, integrate with the scry oracle module, and process data through ABCI vote extensions.
Data Flow
- Planets submit transactions to their sponsoring star's Janus
- Stars (both associated and independent) bundle transactions and batch scry bindings
- Independent stars submit bundles to galaxy validators over HTTP; associated stars' bundles are handled in-process
- Galaxy validators process data through consensus and store in modules