TSN Documentation
Everything you need to run, mine, and build on Trust Stack Network.
Getting Started
TSN (Trust Stack Network) is a post-quantum, privacy-first blockchain built in Rust. Transactions are shielded by default using zero-knowledge proofs, and all cryptography is quantum-resistant.
System Requirements
Quick Start
Install Rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh source ~/.cargo/env
Clone & Build
git clone https://github.com/trusts-stack-network/trust-stack-network.git cd trust-stack-network cargo build --release
Run your node
./target/release/tsn --data-dir ~/.tsn
Your node will start syncing with the network. The RPC API will be available at http://localhost:9333.
--help to see all available CLI options.
Run a Node
Full Node
A full node validates all transactions and blocks, stores the complete blockchain history, and participates in block propagation.
./target/release/tsn \
--data-dir ~/.tsn \
--port 9333 \
--seeds http://seed1.tsnchain.com:9333,http://seed2.tsnchain.com:9333
Configuration
| Flag / Env Variable | Default | Description |
|---|---|---|
| --port / TSN_PORT | 9333 | RPC and P2P listen port |
| --data-dir / TSN_DATA_DIR | ~/.tsn | Blockchain data storage directory |
| --seeds / TSN_SEEDS | Built-in seeds | Comma-separated list of seed node URLs |
| --mining-address / TSN_MINING_ADDRESS | None | Public key for mining rewards (enables mining) |
| --log-level / TSN_LOG_LEVEL | info | Log verbosity: error, warn, info, debug, trace |
| --role / TSN_ROLE | full | Node role: full, miner, relay, or light |
Multi-Role Nodes
TSN supports 3 specialized node roles via the --role CLI flag. Each role optimizes resource usage for its specific function in the network:
⛏️ Miner Node --role miner
Full node with Poseidon2 proof-of-work mining. Validates transactions, produces blocks. Must register a MIK (Miner Identity Key) on-chain. Earns 85% of block reward (42.5 TSN/block). Default role.
🔄 Relay Node --role relay
Full node that stores the complete chain and relays blocks/transactions via gossip protocol. Backbone of the network. Serves fast-sync snapshots for new nodes. Earns from the 8% relay pool.
📱 Light Client --role light
Minimal node that syncs headers only and verifies transactions via ZK proofs. For mobile and constrained devices. No full chain storage. No reward.
| Type | Full Chain | Mines | Relays | Reward |
|---|---|---|---|---|
| Miner | ✅ | ✅ | ✅ | 85% block reward |
| Relay | ✅ | — | ✅ | 8% relay pool |
| Light Client | — | — | — | — |
# Run as a miner node (default) ./target/release/tsn --role miner --mining-address YOUR_ADDRESS --data-dir ~/.tsn --port 9333 # Run as a relay node ./target/release/tsn --role relay --data-dir ~/.tsn --port 9333 # Run as a light client ./target/release/tsn --role light --data-dir ~/.tsn --port 9333
Connect to Seed Nodes
Seed nodes help your node discover other peers on the network. TSN uses a Kademlia DHT for peer discovery after initial bootstrap.
Docker Coming Soon
docker run -d --name tsn-node \
-p 9333:9333 \
-v tsn-data:/root/.tsn \
ghcr.io/trusts-stack-network/tsn:latest
Mining
TSN uses Proof of Work with the Poseidon2 hash function over the Goldilocks field. Mining is deliberately ASIC-resistant and ZK-proof friendly.
Start Mining
To mine, you need a wallet address. Start your node with the --mining-address flag:
./target/release/tsn \
--data-dir ~/.tsn \
--mining-address YOUR_PUBLIC_KEY \
--seeds http://seed1.tsnchain.com:9333
Mining Parameters
| Parameter | Value |
|---|---|
| Algorithm | Poseidon2 (Goldilocks field) |
| Block Time | ~10 seconds |
| Block Reward | 50 TSN (47.5 miner + 2.5 dev fee) |
| Dev Fee | 5% |
| Difficulty Adjustment | Every 72 blocks |
Understanding Hashrate
Why is TSN hashrate higher than Monero?
TSN uses Poseidon2, a ZK-native algebraic hash that is computationally lighter per operation than RandomX (Monero) or SHA-256 (Bitcoin). A typical CPU achieves 50-150 KH/s on TSN vs 1-10 KH/s on Monero.
This does NOT mean TSN is less secure. Each hash function has different work-per-hash. Difficulty adjusts automatically to maintain 10-second blocks. Numbers are not comparable across blockchains.
| Hash | Blockchain | CPU Hashrate | Design |
|---|---|---|---|
| SHA-256 | Bitcoin | 20-50 MH/s | Simple, ASIC-dominated |
| RandomX | Monero | 1-10 KH/s | CPU-hard, anti-ASIC |
| Poseidon2 | TSN | 50-150 KH/s | ZK-native, post-quantum |
Network hashrate = sum(difficulty) / time_span over 120 blocks (Bitcoin standard).
Monitor Mining
Check your mining stats via the API:
curl http://localhost:9333/miner/stats
Wallet
TSN wallets use ML-DSA-65 (NIST FIPS 204) post-quantum signatures with BIP39 mnemonic recovery. Your keys are safe against both classical and quantum attacks, and can be restored from a 24-word seed phrase.
Generate a Wallet
# Create a new wallet ./tsn new-wallet --output wallet.json # The terminal displays 24 words -- WRITE THEM DOWN!
This generates a new ML-DSA-65 key pair with a BIP39 mnemonic seed phrase and saves it to a wallet file. Your public key is your wallet address.
Restore from Seed Phrase
If you lose your wallet file, you can restore it using your 24-word seed phrase:
# Restore wallet from seed phrase ./tsn restore-wallet --seed "word1 word2 ... word24" --output wallet.json # Check your balance ./tsn balance --wallet wallet.json
Key Features
Post-Quantum Safe
ML-DSA-65 (FIPS 204) signatures. Resistant to Shor's algorithm and all known quantum attacks.
BIP39 Recovery
24-word seed phrase backup. Restore your wallet anywhere with just your mnemonic.
Privacy by Default
Shielded balances using ZK proofs. Only you (with your viewing key) can see your balance.
Zero-Knowledge Transfers
Send TSN without revealing amounts. Plonky3 STARKs prove transaction validity without exposing data.
Viewing Key Export & Import
Viewing keys allow you to share read-only access to your shielded balance without exposing your spending key. Useful for auditors, tax reporting, or watch-only wallets.
# Export your viewing key ./target/release/tsn wallet export-viewing-key --output viewing_key.json # Import a viewing key (watch-only) ./target/release/tsn wallet import-viewing-key --input viewing_key.json
Send a Transaction
curl -X POST http://localhost:9333/tx/v2 \
-H "Content-Type: application/json" \
-d '{
"from": "YOUR_PUBLIC_KEY",
"to": "RECIPIENT_PUBLIC_KEY",
"amount": 10000000000,
"signature": "..."
}'
Amounts are in base units. 1 TSN = 1,000,000,000 base units.
Backup & Restore
# Option 1: Restore from seed phrase (recommended) ./tsn restore-wallet --seed "word1 word2 ... word24" --output wallet.json # Option 2: File backup cp -r ~/.tsn/wallet/ ~/tsn-wallet-backup/ # Option 2: File restore cp -r ~/tsn-wallet-backup/ ~/.tsn/wallet/
v2.1.5 CLI Commands
TSN v2.1.5 introduces a unified CLI with interactive menus and new commands:
# Interactive wallet menu (generate, restore, send, receive, history) ./bin/tsn wallet # Start mining with 2 threads ./bin/tsn miner -t 2 # View transaction history ./bin/tsn history # Check version, build info, and feature flags ./bin/tsn --version
Auto-Update
TSN nodes automatically detect and install new versions. When a peer announces a newer version during the P2P handshake, your node downloads the update from GitHub (or tsnchain.com fallback), verifies the SHA256 checksum, backs up the current binary, and restarts with the new version.
./tsn update # Manual update check
⚠️ TSN tokens currently have no monetary value. This is a development testnet. Tokens can be mined for free.
API Reference
TSN exposes a RESTful JSON API on the same port as the node (default 9333). Rate limited to prevent abuse.
http://localhost:9333
Blockchain
Returns the current chain height, latest block hash, difficulty, and node version.
curl http://localhost:9333/chain/info
{
"height": 14523,
"best_hash": "a1b2c3d4e5f6...abc123",
"difficulty": "0000ffff00000000...",
"version": "1.0.0",
"peers": 12,
"mempool_size": 3
}
Retrieve a full block including header, transactions, and proof-of-work data.
curl http://localhost:9333/block/a1b2c3d4e5f6abc123
curl http://localhost:9333/block/height/1000
Transactions
Submit a signed V1 transaction to the mempool.
curl -X POST http://localhost:9333/tx \
-H "Content-Type: application/json" \
-d '{"from":"...","to":"...","amount":50000000000,"signature":"..."}'
Submit a shielded transaction with ZK proof. Amounts are hidden from the network.
curl -X POST http://localhost:9333/tx/v2 \
-H "Content-Type: application/json" \
-d '{
"from": "YOUR_PUBLIC_KEY",
"to": "RECIPIENT_PUBLIC_KEY",
"amount": 10000000000,
"signature": "..."
}'
curl http://localhost:9333/tx/a1b2c3d4...
Returns the most recent transactions from the mempool and recent blocks.
curl http://localhost:9333/transactions/recent
Network
curl http://localhost:9333/peers
{
"peers": [
{"node_id": "a1b2c3...", "addr": "seed2.tsnchain.com:9333", "latency_ms": 12},
{"node_id": "d4e5f6...", "addr": "seed3.tsnchain.com:9333", "latency_ms": 8}
],
"count": 2
}
curl -X POST http://localhost:9333/peers \
-H "Content-Type: application/json" \
-d '{"addr": "seed2.tsnchain.com:9333"}'
Returns all pending transactions waiting to be included in a block. Includes double-spend detection.
curl http://localhost:9333/mempool
curl http://localhost:9333/sync/status
{
"synced": true,
"local_height": 14523,
"network_height": 14523,
"peers_syncing": 0
}
Mining
curl http://localhost:9333/miner/stats
{
"mining": true,
"hashrate": "1.2 MH/s",
"blocks_mined": 42,
"total_reward": "2100 TSN",
"current_difficulty": "0000ffff..."
}
Network
TSN uses a Kademlia-based P2P network with gossip protocol for block and transaction propagation.
Protocol Details
| Property | Value |
|---|---|
| Protocol | TSN v1.0 |
| Default Port | 9333 |
| Discovery | Kademlia DHT (k=20) |
| Block Propagation | Gossip protocol (epidemic) |
| Node Identity | Poseidon2 hash of SLH-DSA public key |
| Transport | HTTP/JSON with rate limiting |
Seed Nodes
The testnet currently runs 4 seed nodes across Europe. Connect to any of them to bootstrap your node.
./target/release/tsn --seeds \
http://seed1.tsnchain.com:9333,\
http://seed2.tsnchain.com:9333,\
http://seed3.tsnchain.com:9333,\
http://seed4.tsnchain.com:9333
Architecture
TSN is a modular blockchain built entirely in Rust. Every layer is designed for post-quantum security and privacy.
TSN Blockchain
+---------------------------------+
| REST API (Axum) | <-- Port 9333
+---------+-----------+-----------+
| | |
+---------+ +-------+-------+ ++---------+
| Mempool | | Consensus | | P2P Net |
| (pool) | | PoW+Poseidon2 | | Kademlia |
+----+----+ +-------+-------+ +----+-----+
| | |
+----+---------------+---------------+----+
| Core Engine |
| Blocks | Transactions | State (UTXO) |
+-----+----------+----------+-------------+
| | |
+-----+--+ +---+----+ +--+------+
| Storage | | Crypto | | Wallet |
| (Sled) | | ML-DSA | | ML-DSA |
| | | SLH-DSA| | Shielded|
+---------+ | Plonky3| +---------+
+--------+
Cryptography Stack
ML-DSA-65 Post-Quantum
NIST FIPS 204. Lattice-based digital signatures for wallet keys and transaction signing.
SLH-DSA Post-Quantum
NIST FIPS 205. Hash-based signatures for node identity. 32-byte keys, 7.8 KB signatures.
Plonky3 STARKs Post-Quantum
AIR-based FRI STARKs for shielded transactions. No trusted setup required. Quantum-resistant proofs.
| Component | Technology | Purpose |
|---|---|---|
| Signatures | ML-DSA-65 + SLH-DSA | Transaction signing & node identity |
| Hashing | Poseidon2 (Goldilocks) | ZK-friendly hashing, PoW mining |
| ZK Proofs | Plonky3 STARKs | Shielded transactions, private balances |
| Consensus | PoW (Poseidon2) | Block production, 72-block difficulty adjustment |
| Storage | Sled (embedded) | Block & state persistence, UTXO set |
| Network | Kademlia DHT | Peer discovery, gossip propagation |
Synchronization & Anti-Fork
Fast-Sync Protocol v0.4.0
New nodes download a gzip-compressed state snapshot from any peer via /snapshot/download, then sync only missing blocks. Join the network in under 5 minutes instead of hours.
Heaviest Chain Rule
Fork choice based on cumulative proof-of-work (sum of all block difficulties), not longest chain. Prevents low-difficulty spam attacks — same approach as Bitcoin Core.
Checkpoint Finality
Every 100 blocks, a checkpoint is established. No chain reorganization is permitted beyond the latest checkpoint, providing deterministic finality.
| Protection | Description |
|---|---|
| Heaviest chain | Fork choice = cumulative work, not height |
| MAX_REORG_DEPTH = 100 | Hard limit — no reorg deeper than 100 blocks |
| Checkpoint finality | Every 100 blocks, immutable checkpoint |
| Anti-Fork Sync Gate | Miners must be within 2 blocks of tip to mine |
| Genesis verification | All nodes verify genesis hash at startup |
| Fast-Sync | Snapshot download + sync missing blocks (< 5 min) |
TSN Documentation — Trust Stack Network