Skip to main content
Ankara Chain sits between your application and the blockchain. You own the business layer — Ankara Chain provides the contract infrastructure, TypeScript SDK, and chain adapters that connect them. This page explains how those layers fit together so you can reason clearly about what you’re building on top of.

The Layered Model

Every interaction in Ankara Chain flows through four layers, top to bottom: Your code interacts only with the SDK layer. The SDK translates your calls into chain-specific transactions, deploys the right contracts, and surfaces typed results back to you — without exposing raw ABI calls or protocol-specific signing flows.

Core Layers

Your Application Layer

Your Node.js backend, React frontend, or CLI tool. You own the business logic, user accounts, compliance decisions, and UX. Ankara Chain has no opinion on any of this.

Ankara Chain SDK Layer

@ankarachain/sdk — the TypeScript package you install. Exposes TokenFactory, AssetRegistry, EscrowManager, and more. This is where your code lives.

Smart Contract Layer

Pre-audited Solidity contracts (EVM) and Soroban contracts (Stellar). Deployed to your chosen network under your deployer key — you own the contracts, not us.

The Chain-Agnostic Adapter Pattern

The SDK uses an adapter pattern to stay chain-agnostic. Every chain-specific operation is routed through the IAdapter interface, which both EVMAdapter (for Polygon, Ethereum, BNB, Celo, localhost) and StellarAdapter implement in full.
Your application code does not change when you switch chains. The TokenFactory constructor reads the network field in your config, selects the right adapter, and routes all calls through it. You never call EVMAdapter or StellarAdapter directly.
The IAdapter interface deliberately excludes raw contract-accessor methods that return chain-specific handles (like ethers.Contract or a Soroban contract.Client). Everything you need to do with a deployed contract — fund an escrow, mint tokens, read metadata — is exposed as a named method on the SDK classes above.

What Ankara Chain Does NOT Own

Understanding the boundary is as important as understanding the SDK itself.
Ankara Chain doesn’t know what your farmland platform does, how you price assets, or when a token should be minted. You call deployFarmland() when your business logic says to — the SDK just executes the transaction.
The SDK provides a pluggable IIdentityVerifier interface for KYC gating, but it doesn’t make compliance decisions for you. You decide which addresses are verified; the verifier contract enforces it on-chain.
Ankara Chain doesn’t manage user wallets, private keys, or sessions. You pass in an ethers Signer (or a Stellar secret key / Freighter signer) that you’ve already authenticated — the SDK signs and submits transactions through it.
Every factory and token contract is deployed to your chosen network under your deployer key. You own those addresses. Ankara Chain has no custody, upgrade authority, or admin access to contracts you’ve deployed.

Token Lifecycle

Once you deploy a factory, the typical lifecycle for a new tokenized asset looks like this:
1

Factory deploys the token

TokenFactory calls the on-chain TokenFactory contract, which deploys an ERC-1967 upgradeable proxy pointing at the selected template implementation (e.g. FarmlandToken). The returned DeployResult contains the new token’s address, transaction hash, and timestamp.
2

AssetRegistry manages metadata

AssetRegistry reads and writes structured metadata stored directly on the deployed token contract — fields like location, areaSqMeters, soilType, and valuationUSD for farmland. It also manages the asset’s lifecycle status: DRAFT → ACTIVE → SUSPENDED → REDEEMED/EXPIRED.
3

EscrowManager handles payments

EscrowManager deploys milestone-based escrow contracts that hold payment in a whitelisted stablecoin. Payers fund individual milestones; payees mark delivery; arbiters resolve disputes. All logic runs on-chain.

Complementary Packages

The core SDK is the primary integration point, but the monorepo ships several packages that complement it: These packages all consume the same SDK under the hood — if you understand how the SDK works, you understand how all of them work.