> For the complete documentation index, see [llms.txt](https://docs.transferchain.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.transferchain.io/transferchain-sdk/overview.md). Agents can also search and read this documentation through its [MCP server](https://docs.transferchain.io/~gitbook/mcp).

# Overview

Full Technical Specification & Developer Integration Guide

## Overview and architecture

TransferChain SDK is a self-hosted service with a local HTTP API. Your application talks to the SDK over HTTP; the SDK handles client-side encryption, fragmentation, distributed storage and cryptographic authorization with the TransferChain network.

### What it is

TransferChain SDK is **not a storage provider**. It is a **cryptographic and authorization layer** that sits between your application and the storage infrastructure, so that no data is ever exposed in plaintext outside the trusted execution boundary.

Core guarantees:

* client-side and service-enforced encryption;
* customer-controlled key custody, based on the account mnemonics;
* data fragmentation and distributed storage;
* blockchain-backed immutability and auditability;
* zero-knowledge architecture.

### Architecture

```mermaid
flowchart TD
    app[Application]
    sdk[TransferChain SDK]
    fop[TransferChain file operation service]
    chain[TransferChain blockchain]

    app -->|HTTP API| sdk
    sdk -->|encrypted and fragmented data| fop
    sdk -->|metadata: hashes, references| chain
```

The SDK encrypts, signs and chunks the data. Only encrypted fragments reach the TransferChain file operation service; the blockchain receives only metadata such as hashes and references.

#### Trust boundaries

| Component                         | Trust level  | Notes                                                             |
| --------------------------------- | ------------ | ----------------------------------------------------------------- |
| Application and TransferChain SDK | trusted      | holds the keys (`sdk.yaml`); handles encryption and orchestration |
| Storage                           | untrusted    | never sees a full file                                            |
| TransferChain blockchain          | trust anchor | immutable metadata                                                |

#### Critical guarantees

* The SDK never stores plaintext at rest.
* Storage backends never receive full files.
* The blockchain never stores data or keys.
* TransferChain cannot decrypt customer data.

Internal layers, cryptographic pipelines and the full security model: Security model.

### Deployment model

The SDK runs as a container (Docker, Docker Compose or Podman). The container image itself holds no state; the state lives outside it:

* `sdk.yaml`: account identity and key custody;
* the persistent data volume (`/var/data/transferchain`): local database, `files/` and `collect/`;
* the storage backend behind the TransferChain file operation service (S3, MinIO and similar);
* the TransferChain blockchain ledger.

Keep `sdk.yaml` and the data volume on persistent storage (see Install and run).

#### Supported environments

* local development;
* on-premise;
* private cloud;
* regulated environments (finance, healthcare, defense).

### Components

| Component       | Role                                                                                                                              |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------- |
| HTTP server     | API for account, storage, log and status                                                                                          |
| Config          | YAML config file with defaults and validation                                                                                     |
| Local database  | file `<dataPath>/sdk.db` (mode `0600`) holding account addresses, storage and log records, and statistics, encrypted with AES-GCM |
| Account         | loads the account from the config and the database                                                                                |
| Syncher         | follows the blockchain for the account's addresses and stores matching transactions locally                                       |
| Write-ahead log | durable buffer for `/v1/log/collect` (only with `behaviour: log-collect`)                                                         |

### Startup

1. Parse the command-line flags:

   | Flag             | Default                       | Meaning                              |
   | ---------------- | ----------------------------- | ------------------------------------ |
   | `-config`        | `/etc/transferchain/sdk.yaml` | config file                          |
   | `-dataPath`      | `/var/data/transferchain`     | data directory                       |
   | `-logPath`       | empty                         | log directory; empty means stdout    |
   | `-port`          | `8080`                        | HTTP port                            |
   | `-mode`          | `prod`                        | application environment              |
   | `-withoutListen` | `false`                       | `true` disables blockchain listening |
2. Production guard: the container image refuses to start unless `-mode` is `prod`.
3. Create the log and data directories if missing (mode `0750`); with `behaviour: log-collect` also `<dataPath>/collect`.
4. Load and validate the config, apply the environment variable overrides, open the database, connect to the TransferChain network, and load the account and the syncher.
5. Unless `-withoutListen` is set: start the syncher and, if an account exists, listen to new blocks.
6. Start the HTTP server on `-port`.

### Service lifecycle

1. The container starts.
2. `sdk.yaml` is loaded and the environment variable overrides are applied.
3. The account API authentication is validated and the account is checked.
4. The HTTP API starts; the storage and blockchain connections are active.
5. If no account is initialized yet, call `POST /v1/account/init` (or `POST /v1/account/restore` for an existing account); see API conventions and account.

### Shutdown

On `SIGINT` or `SIGTERM` the service stops the syncher and the blockchain connection, closes the database and stops the HTTP server. Stopping the server also closes the log collect write-ahead log, which flushes pending entries.

### Access control

The API has **no authentication** and answers CORS with `Access-Control-Allow-Origin: *`. It is designed to run on a local or trusted network next to the application that uses it. Protect the endpoint with network isolation, a reverse proxy or a firewall. The guards described in Security and limits limit what a client can do, but they do not replace access control.
