The foundational SDK for web3 and data

Lattice is a modular Swift SDK — eight packages that compose into hierarchical blockchains with verifiable Merkle state, content-addressed storage, peer-to-peer networking, and trustless cross-chain transfers. Build decentralized applications, verifiable data pipelines, or both.

8 modular packages
~28ns hot-path reads
SHA-256 verifiable state
Swift 6 strict concurrency

Why Lattice

Most blockchain SDKs force you to choose between security, scalability, and developer experience. Lattice is designed from first principles so you don't have to. State is inherently verifiable. Chains scale horizontally without splitting security. Every layer is standalone — use the full SDK or pick the primitives you need.

The Storage Chain

Every piece of data flows through a tiered worker chain — fast to slow, local to remote. Misses walk forward; hits backfill backward. The chain self-optimizes without orchestration.

MemoryWorker ~10 ns DiskWorker ~100 µs Tally reputation gate Ivy ~100 ms backfill on hit

SDK Packages

Eight packages spanning blockchain, state, storage, networking, and reputation. Each is independently useful — compose them to match your use case, from a local verifiable data store to a full multi-chain network.

Lattice
Hierarchical blockchain with merged mining, cross-chain transfers via Merkle proof, and parent-anchored fork choice. The consensus layer that ties the SDK together.
BlockChainSpecTransactionLatticeStateLatticeNode
Cashew
Merkle data structures — dictionaries, arrays, and sets that are content-addressed, lazily loadable, selectively encryptable, diffable, and provable. The verifiable data layer that makes Lattice a data SDK, not just a blockchain.
MerkleDictionaryMerkleArrayMerkleSetNodeHeader
Acorn
Core protocol and primitives. Defines the CAS worker actor protocol, content identifiers, the composite chain, and LFU decay cache.
AcornCASWorkerContentIdentifierCompositeCASWorker
MemoryWorker
In-memory CAS with dual sync/async API. Lock-based hot path delivers 3–28ns reads, bypassing actor overhead.
MemoryCASWorkerCASMetrics
DiskWorker
Filesystem-backed CAS with Bloom filter fast rejection, POSIX I/O, and SHA-256 integrity verification on every read.
DiskCASWorkerFileSystemProvider
Tally
Peer reputation and rate limiting. Reciprocity-based scoring with sigmoid gating and proof-of-work challenges for Sybil resistance.
TallyPeerLedgerChallenge
Ivy
Peer-to-peer networking. Kademlia DHT routing, TCP transport via swift-nio, content routing, local discovery, and a binary wire protocol.
IvyRouterPeerConnectionMessageNetworkCASWorker

SDK Design Principles

Merkle State

All state is Cashew Merkle trees. Every mutation produces a new root CID. State is inherently versioned, verifiable, and efficiently syncable.

Content Addressing

All data identified by SHA-256 hash. Storage is inherently deduplicating, verifiable, and cacheable — same data, same CID, anywhere.

Actor Concurrency

Every worker is a Swift actor — compile-time data race safety. Sync hot paths bypass the executor via OSAllocatedUnfairLock for nanosecond reads.

Worker Chaining

Workers link via near/far references. The default get() walks fast→slow, backfilling on hits. The chain self-optimizes.

Quick Start

20 lines to verifiable storage

Full guide →
import Acorn
import AcornMemoryWorker
import AcornDiskWorker

let memory = MemoryCASWorker()
let disk = await DiskCASWorker(
    directory: "/tmp/lattice",
    near: memory
)
let composite = CompositeCASWorker(farthest: disk)

// Store content-addressed data
let data = Data("Hello, Lattice".utf8)
let cid = await composite.store(data: data)

// Retrieve — walks memory → disk automatically
let result = await composite.get(cid: cid)
// First get: disk hit, backfills to memory
// Second get: memory hit in ~10ns

Dependency Graph

┌──────────┐ │ Lattice │ ─── UInt256, CollectionConcurrencyKit ├──────────┤ │ Ivy │ ─── swift-nio ├──────────┤ │ Tally │ ─── swift-crypto ├──────────┤ │ DiskWkr │ ├──────────┤ │ MemWkr │ ├──────────┤ │ Acorn │ ─── swift-crypto ├──────────┤ │ Cashew │ ─── swift-crypto, swift-cid, ArrayTrie └──────────┘

Platform Support

PlatformMinimum Version
macOS13+ (Acorn/Workers), 14+ (Tally/Ivy)
iOS16+ (Acorn/Workers), 17+ (Tally/Ivy)
tvOS17+
watchOS10+
visionOS1+
LinuxSwift 6.0+