How zenanetwork/zena works
Project Type & Purpose
• Zenanet is a full-stack blockchain application: a Cosmos SDK–based chain (Zenad) with a pluggable EVM module.
• It exposes both Cosmos gRPC and Ethereum‐style JSON-RPC APIs, runs Tendermint consensus, supports IBC, custom precompiles, and integrates an Ethereum Virtual Machine.
High-Level Components
A. External Clients
• Ethereum-compatible wallets & tools (MetaMask, Hardhat, Truffle)
• zenad CLI
• IBC relayer / other Cosmos SDK chains
B. Networking & Consensus
• Tendermint Core (P2P, consensus engine)
• ABCI proxy between Tendermint and application
C. Application Layer (Zenad)
• CLI (cmd/zenad)
• JSON-RPC server (server/json_rpc.go) & WebSocket (rpc/websockets.go)
• gRPC query & Tx servers (api/..., generated from proto/)
• AnteHandler middleware (ante/) for transaction pre-processing (fees, signatures, gas)
• Cosmos SDK Modules (x/*):
– x/evm (EVM execution, transaction pool, EIP-1559)
– x/erc20, x/feemarket, x/ibc/transfer, x/precisebank, x/vm
– Standard Cosmos modules (bank, staking, gov, authz, etc.)
• Precompiles (precompiles/*): Solidity ABI wrappers invoked inside EVM
• Keepers & MsgServers (module state management & message handlers)
• State machine & KV store (IAVL/Merkle tree)
D. Indexer
• Separate service (indexer/kv_indexer.go) subscribing to Tendermint events to build search indexes
Component Interactions & Data Flows
• Clients (CLI or wallets) ➞ issue commands or JSON-RPC/gRPC requests over HTTP/WebSocket
• RPC layer (server/, rpc/) ➞ translates into gRPC or Cosmos SDK Msgs
• AnteHandler (ante/) ➞ performs fee checks, signature verification, nonce, gas consumption
• MsgServer & Keepers (x/.../keeper, x/.../types) ➞ execute module logic, update state
• Precompiles invoked during EVM transactions via x/evm ➞ call into Go methods in precompiles/
• Writes to KV Store ➞ Tendermint commits block, emits events
• Indexer & RPC backend subscribe to events for queries and indexing
• IBC module (x/ibc/transfer) handles cross-chain packets via relayer
Architectural Patterns & Principles
• Modular plugin architecture: each x/… directory is a self-contained module plugged into the Cosmos SDK app
• ABCI separation: consensus (Tendermint) vs. application (Zenad) decoupling
• Middleware stack: AnteHandler → Router → Module handlers → Post-Handlers
• Auto-generated API layers: Protobuf + buf → gRPC code + JSON-RPC bindings