Skip to main content

Core concepts

Shinzo runs on four ideas that show up everywhere in the stack: ViewsView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape., Attestation, DefraDBdefraDB A peer-to-peer, document-oriented database embedded in every indexer and host. It handles storage, content addressing, CRDT merging, query serving, and P2P replication via libp2p., and the SHNZSHNZ ShinzoHub's native token. The display denomination; on-chain the base unit is `ushinzo` (1 SHNZ = 10^18 ushinzo). Used for staking, transaction fees, view funding, and relayer gas. token. The How it works page covers how they fit together end to end.

Views

A ViewView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. is a developer-defined data product. It describes what raw blockchain data to pull, how to transform it, and what schema to expose the result as. Once deployed, HostsHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. run it continuously and push results to any application that subscribes.

What a View contains

Every ViewView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. is a versioned bundle with three parts:

  • A query that specifies which primitive data to pull from the IndexerIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication. layer. Today that means blocks, transactions, logsLog A document type the indexer produces for event logs emitted during transaction execution. `topics` holds the indexed parameters and `data` holds the non-indexed ones, both as raw hex. ABI decoding happens later, in a lens., and access list entries from Ethereum Mainnet.
  • A schema, a GraphQL SDL type definition describing the shape of the output. This is what subscribers see and query against.
  • One or more LensLens A WASM module that transforms primitive documents (e.g., raw `Log` records) into view documents (e.g., `USDCTransfer`). Lenses must be deterministic: the same input always produces the same output. Hosts run them via LensVM. transforms, WebAssembly modulesModule A Cosmos SDK building block that owns a slice of chain state, handles messages, and emits events. ShinzoHub adds five custom modules (`x/admin`, `x/sourcehub`, `x/host`, `x/indexer`, `x/view`) on top of the standard Cosmos set. that do the actual filtering, decoding, and reshaping work.

Why it's designed this way

The split between what data (the query), how to transform it (the LensLens A WASM module that transforms primitive documents (e.g., raw `Log` records) into view documents (e.g., `USDCTransfer`). Lenses must be deterministic: the same input always produces the same output. Hosts run them via LensVM.), and what shape to expose (the schema) is intentional. It keeps the ViewView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. portable: any compliant HostHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. can pick it up, run the same deterministic transforms against the same input, and get the same output. Because LensLens A WASM module that transforms primitive documents (e.g., raw `Log` records) into view documents (e.g., `USDCTransfer`). Lenses must be deterministic: the same input always produces the same output. Hosts run them via LensVM. transforms are WASMWASM A portable, sandboxed bytecode format. Lens transforms compile to WASM — typically from Rust or AssemblyScript — and hosts run them via LensVM. and deterministic, any HostHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. or auditor can re-run them to verify the result independently.

You deploy ViewsView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. through viewkit to ShinzoHubShinzoHub Shinzo's coordination chain: a Cosmos SDK chain (v0.53.4) with an integrated EVM, running CometBFT consensus. It holds the view, host, and indexer registries and the economic layer (staking, pricing, payments). It does not store or serve indexed blockchain data., which validates and registers them. HostsHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. watch for new ViewView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. registrations and decide which ones to run.

View categories

ViewsView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. fall into three categories depending on what data they touch:

  • Primary: derived directly from IndexerIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication. primitives (e.g. decoded ERC-20 transfers from raw logsLog A document type the indexer produces for event logs emitted during transaction execution. `topics` holds the indexed parameters and `data` holds the non-indexed ones, both as raw hex. ABI decoding happens later, in a lens.).
  • Secondary: derived from other ViewsView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. (e.g. a portfolio viewView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. built on top of multiple token transfer ViewsView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape.).
  • Tertiary: aggregated or computed across multiple secondary sources.

Most developers today build primary ViewsView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape.. Secondary and tertiary ViewsView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. become useful once more primary ViewsView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. exist for them to draw from.

Attestation

Attestation is how Shinzo tracks how much of the network has independently agreed on a piece of data.

The problem it solves

With a centralized indexerIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication., you trust the provider because you have no other option. You can't verify1 the data you got matches what's actually on chain. In Shinzo, IndexersIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication. cryptographically sign every document they produce, so there's a verifiable record of who said what. But a single signature only goes so far. You still need to know whether multiple independent IndexersIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication. saw the same thing.

Attestation answers that question.

How it works

When a HostHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. receives a document from an IndexerIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication., it checks the signature and creates (or updates) an attestation record for that document. The record tracks which IndexersIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication. signed off and maintains a running vote count.

type Ethereum__Mainnet__AttestationRecord {
attested_doc: String
source_doc: String
CIDs: [String]
doc_type: String
vote_count: Int # CRDT P-counter — only goes up
}

The vote_count field is a CRDTCRDT A data structure that multiple nodes can update independently and then merge without coordination, always reaching the same result. defraDB uses CRDTs — specifically MerkleCRDTs — to merge document updates from peers. P-counterP-counter A CRDT that only increments. Each node tracks its own count separately; merging just takes the max per node and sums them. `AttestationRecord.vote_count` uses a P-counter so all hosts converge on the same indexer count without coordinating.: it only ever increments, and multiple HostsHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. merging their counts never produce conflicts. If three IndexersIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication. all sign the same block, the attestation record for that block has a vote count of three.

What applications do with it

Apps set their own attestation threshold depending on how much they care about correctness versus speed. A wallet showing recent transfers might accept data with a count of one. A DeFi protocol acting on that data might wait for five. The threshold is a query-time filter, not a system-wide setting, so different queries in the same app can use different thresholds.

Batch signatures

Rather than signing every document individually, IndexersIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication. produce a BatchSignature per block: a single document committing to a Merkle root that covers every primitive in that block (transactions, logsLog A document type the indexer produces for event logs emitted during transaction execution. `topics` holds the indexed parameters and `data` holds the non-indexed ones, both as raw hex. ABI decoding happens later, in a lens., access list entries, and the block itself). A HostHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. can then create a single attestation covering the entire block in one step.

DefraDB

DefraDB is the database embedded in every component of the Shinzo stack. IndexersIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication., HostsHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL., and application clients each run their own instance. It's what makes the network peer-to-peer rather than client-server.

What it is

DefraDBdefraDB A peer-to-peer, document-oriented database embedded in every indexer and host. It handles storage, content addressing, CRDT merging, query serving, and P2P replication via libp2p. is an open-source document database built by Source Network. It stores data as content-addressed documents, exposes a GraphQL query interface, handles schema definition, and ships with a libp2plibp2p A peer-to-peer networking library. defraDB uses it for peer discovery and document replication between indexers and hosts. networking layer for replication between nodes. A few properties make it a good fit for Shinzo in particular:

  • Schema enforcement: primitive documents have defined types that IndexersIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication. write into and HostsHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. read from.
  • P2P replication: documents gossiped between instances are verified by CID before being accepted.
  • DIDDID A self-sovereign identifier (e.g., `did:key:z6Mk...`) derived from a public key. Hosts, indexers, and users are identified by DIDs in SourceHub authorization tuples.-based access control: read access to any collection can be gated by a DIDDID A self-sovereign identifier (e.g., `did:key:z6Mk...`) derived from a public key. Hosts, indexers, and users are identified by DIDs in SourceHub authorization tuples., which is how subscription access is enforced.
  • CRDTCRDT A data structure that multiple nodes can update independently and then merge without coordination, always reaching the same result. defraDB uses CRDTs — specifically MerkleCRDTs — to merge document updates from peers. support: conflict-free merge semantics for types like the P-counterP-counter A CRDT that only increments. Each node tracks its own count separately; merging just takes the max per node and sums them. `AttestationRecord.vote_count` uses a P-counter so all hosts converge on the same indexer count without coordinating. in Attestation Records.

How it connects the network

When an IndexerIndexer A node that reads blockchain data from a source chain, parses it into structured documents, and writes them to defraDB. Indexers are write-only: they push data out over P2P and reject all incoming replication. writes a block to its local DefraDBdefraDB A peer-to-peer, document-oriented database embedded in every indexer and host. It handles storage, content addressing, CRDT merging, query serving, and P2P replication via libp2p., DefraDBdefraDB A peer-to-peer, document-oriented database embedded in every indexer and host. It handles storage, content addressing, CRDT merging, query serving, and P2P replication via libp2p. gossips a digest to subscribed peers over libp2plibp2p A peer-to-peer networking library. defraDB uses it for peer discovery and document replication between indexers and hosts.. Those peers (HostsHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL.) request the full document, verify its CID, and store it locally. No broker is involved.

The same thing happens at the other end. When a HostHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. produces ViewView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. documents for a subscriber, DefraDBdefraDB A peer-to-peer, document-oriented database embedded in every indexer and host. It handles storage, content addressing, CRDT merging, query serving, and P2P replication via libp2p. replicates them directly to the subscriber's embedded instance. The app queries its local database. No API call, no round trip.

Why not a conventional database

A conventional database has a server and a client, which means the server is a single point of failure and the client has no way to verify what it receives. DefraDBdefraDB A peer-to-peer, document-oriented database embedded in every indexer and host. It handles storage, content addressing, CRDT merging, query serving, and P2P replication via libp2p. gives every participant their own node. Data is addressed by content rather than by location, and access control travels with the data.

SHNZ token

SHNZSHNZ ShinzoHub's native token. The display denomination; on-chain the base unit is `ushinzo` (1 SHNZ = 10^18 ushinzo). Used for staking, transaction fees, view funding, and relayer gas. is the native token of ShinzoHubShinzoHub Shinzo's coordination chain: a Cosmos SDK chain (v0.53.4) with an integrated EVM, running CometBFT consensus. It holds the view, host, and indexer registries and the economic layer (staking, pricing, payments). It does not store or serve indexed blockchain data., the Cosmos SDKCosmos SDK A Go framework for building app-specific blockchains. ShinzoHub (v0.53.4) and SourceHub are both Cosmos SDK chains. ShinzoHub also bundles an EVM module. chain that coordinates the Shinzo network. It's the economic unit flowing between developers who publish ViewsView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape., HostsHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. who serve them, and consumers who subscribe.

Confirmed so far:

  • Staking: any address can stake SHNZSHNZ ShinzoHub's native token. The display denomination; on-chain the base unit is `ushinzo` (1 SHNZ = 10^18 ushinzo). Used for staking, transaction fees, view funding, and relayer gas. on a ViewView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape. to signal demand. Stake feeds into the ViewView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape.'s price.
  • Funding: consumers prepay SHNZSHNZ ShinzoHub's native token. The display denomination; on-chain the base unit is `ushinzo` (1 SHNZ = 10^18 ushinzo). Used for staking, transaction fees, view funding, and relayer gas. into a ViewView A curated, SDL-defined representation of defraDB documents. Views transform raw indexed data into a structured output shape.'s contract, tied to their DIDDID A self-sovereign identifier (e.g., `did:key:z6Mk...`) derived from a public key. Hosts, indexers, and users are identified by DIDs in SourceHub authorization tuples.. The balance sits there until a HostHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. serves a query, at which point the current price is debited and credited to the creator's earnings.
  • Protocol cut: a flat percentage comes off every consumption event. It's enforced in the SVS-1SVS-1 A per-view smart contract deployed automatically by the View Registry at registration time. It exposes `stake()`, `fund(did)`, `consume(did)`, and `report()`. The default price formula is `rate × complexity × premium` minus a 5% protocol fee. contract standard and can't be bypassed with a custom pricing contract.

The broader token design (staking incentives, HostHost A Shinzo node that receives indexed data from indexers over P2P, verifies it, runs lens transforms to produce view documents, and serves those documents over GraphQL. earnings, slashing, the final fee rate) is still being worked out.

Footnotes

  1. Technically you can verify that the data you're getting is correct. But you'd have to sign up to multiple APIs, request the same data from each, work it into the same schema, and then compare between them. This is obviously a huge hassle, and incredibly costly.