Data Persistence
KayakNet persists all data locally to survive restarts and provide history.
Data Directory
Default location: ./data/
data/
├── identity.key # Node identity (Ed25519 keypair)
├── peers.json # Known peer addresses
├── config.json # Runtime configuration
├── dht/
│ └── records.json # DHT records
├── chat/
│ ├── rooms/
│ │ └── #general.json # Room messages
│ └── dms/
│ └── <node_id>.json # Direct messages
├── market/
│ ├── listings.json # All listings
│ └── my_listings.json # Your listings
├── escrow/
│ ├── orders.json # Order records
│ └── wallets.json # Crypto wallet data
├── names/
│ └── domains.json # .kyk registrations
└── cache/
└── ... # Temporary cacheIdentity Persistence
identity.key
Important:
Back this up!
Losing it = new identity
Never share with anyone
Chat Persistence
Room Messages
data/chat/rooms/#general.json:
Direct Messages
data/chat/dms/<recipient_id>.json:
Marketplace Persistence
Listings
data/market/listings.json:
Escrow Persistence
Orders
data/escrow/orders.json:
Domain Persistence
Registered Domains
data/names/domains.json:
Sync Mechanism
On Startup
Load local data from files
Connect to network
Request updates from peers
Merge with local data
Save merged state
During Runtime
Changes saved immediately
Background sync every 5 minutes
Conflict resolution by timestamp
Conflict Resolution
Newer timestamp wins
For listings: Seller's version wins
For domains: First registration wins
Backup & Recovery
Creating Backup
Restoring Backup
What to Backup
identity.key
Critical
Cannot recover
names/domains.json
High
Your domains
escrow/orders.json
High
Transaction records
chat/
Medium
Message history
market/my_listings.json
Medium
Your listings
peers.json
Low
Rebuilds quickly
Storage Limits
Default Limits
Chat messages per room
10,000
DM conversations
1,000
Listings cache
5,000
DHT records
10,000
Cleanup
Old data is automatically cleaned:
Expired DHT records: Deleted on expiry
Old messages: Keep last N
Failed escrows: Archive after 30 days
Custom Data Directory
Or environment variable:
Database Format
Currently using JSON files for simplicity.
Future plans:
SQLite for large datasets
LevelDB for DHT
Encrypted storage option
Last updated

