In Sawtak, our graduation capstone project, we set out to build a decentralized, tamper-proof complaint reporting platform.
The immediate architectural challenge was throughput: blockchain validator nodes running CometBFT consensus are optimized for transaction ordering and cryptographic verification, not complex search and filter queries.
### 1. The Anti-Pattern: Direct RPC Queries to Validators
If every frontend page load, search filter, or status lookup sends an RPC call directly to Tendermint ABCI state, validator mempools get flooded, and consensus latency spikes.
### 2. The Solution: CQRS (Command Query Responsibility Segregation)
We decoupled write operations from read operations:
- **Write Path (Consensus):** Citizens submit complaint transactions signed with ephemeral Ed25519 keys directly to the Cosmos SDK app-chain for block inclusion and deterministic finality (sub-2 seconds).
- **Read Path (Relational Projection):** A lightweight indexer daemon listens to CometBFT block events over WebSockets and projects state changes into a normalized PostgreSQL read cache.
### 3. Result
Frontend users get sub-10ms search and filter response times, while the blockchain network remains completely isolated and focused on its core job: immutable state transition verification.