How trstlabs/intento works
Project Type & Purpose
• Full-stack blockchain application (Cosmos SDK).
• Purpose: Process “intent-based” actions (flows) on-chain and across IBC-connected chains via a custom module (“intent”).
• Key features: modular Cosmos SDK modules, IBC, gRPC/REST, CLI, Dockerized networks (dockernet), docs.
Top-Level Components
a. User Interfaces
– TriggerPortal UI (external frontend, not in repo)
– Command-Line Interface (cmd/intentod & x/*/client/cli)
b. API Layer
– gRPC server (auto-generated from proto/)
– REST server (gRPC-Gateway)
– Swagger/OpenAPI docs (client/docs/swagger-ui)
c. Application Layer
– Cosmos SDK App (app/ & cmd/intentod/main.go)
– Custom modules in x/ (alloc, claim, intent, interchainquery, mint, …)
– Core services: ABCI handlers, message routers, keepers, genesis, upgrades
d. Consensus & Networking
– Tendermint Core (external process, interacts via ABCI)
– IBC stacks (core & applications, in proto/ibc and x/intent’s IBC middleware)
e. Data Store
– KV Store (Cosmos SDK store)
– Proto definitions & codegen (proto/, third_party/proto/)
f. External Chains & Services
– IBC-connected chains (e.g., Gaia, Osmosis, EVM chains via ICS)
– Relayers/Hermes (dockernet/config)
– Block explorer, external oracles, off-chain triggers
Relationships & Data Flow
1. User (UI or CLI) → submits Tx via
• REST/gRPC → Cosmos SDK
• CLI (direct to gRPC)
2. Cosmos SDK routes message to appropriate module’s msg_server → Keeper → state changes
3. State changes → ABCI deliver_tx → consensus (Tendermint) → commit
4. Modules may emit IBC packets via IBC module → external chains
5. IBC acknowledgements or callbacks return to appropriate module’s IBC hooks
6. Off-chain components (relayer, TriggerPortal) monitor events and feed conditions back
Architectural Patterns & Design Principles
• Layered architecture: UI / API / Application / Consensus / Storage
• Modular Cosmos SDK pattern: each x/<module> contains keeper, msg_server, client, types, genesis, tests
• gRPC-Gateway for REST wrapping of proto definitions
• IBC middleware in x/intent overriding/augmenting core IBC logic
• Code generation (buf, protoc) for proto ↔ Go types ↔ Swagger