About
Tana t4 service

Tags
No tags available

Languages
TypeScript 94%, Dockerfile 6%

tana-t4

content-addressable storage service for the Tana blockchain.

overview

t4 provides immutable file storage where content is addressed by its SHA256 hash. the blockchain references content by hash, and t4 serves the actual bytes. this separation keeps the blockchain lean while enabling storage of large contract code, media, and documents.

how it works

when you store content in t4, it computes the SHA256 hash and saves the file under that hash. to retrieve content, you request it by hash. if the bytes you receive do not hash to the requested value, they have been corrupted or tampered with.

store: content -> SHA256 -> /content/{hash}
fetch: /content/{hash} -> verify hash -> content

content organization

files are sharded into subdirectories by the first two characters of their hash:

/var/lib/tana/content/
  ab/
    abc123def456...
  cd/
    cdef789abc...

this prevents filesystem performance issues when storing millions of files.

architecture

t4 is intentionally minimal. it has no networking logic, no replication, and no blockchain awareness. it provides a simple HTTP interface for storing and retrieving bytes by hash.

the blockchain determines what content should exist. validators fetch content from each other based on content references in finalized blocks.

multi-validator pattern

when a validator produces a block with content references:

  1. block is finalized on-chain with content hashes
  2. other validators check their local t4 for each hash
  3. missing content is fetched from the block producer's t4
  4. content is verified by recomputing the hash
  5. valid content is stored in local t4

api

  • PUT /content/{hash} - store content (verifies hash matches)
  • GET /content/{hash} - retrieve content by hash
  • HEAD /content/{hash} - check if content exists
  • DELETE /content/{hash} - remove content (garbage collection)
  • GET /health - service health check

integration

t4 is used by tana-ledger for smart contract code storage and by any application that needs to store content with blockchain-verifiable integrity. the content client library provides a convenient TypeScript interface for interacting with t4.