itns-sidechain/lib/protocol/lethean.js
Claude dbe1c7952c
Some checks failed
Build / Test Coverage (push) Failing after 4s
Build / Lint & Doc (push) Failing after 1m32s
Build / Build & Test (push) Failing after 14s
feat(itns-sidechain): initial push
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 22:42:02 +01:00

101 lines
3.3 KiB
JavaScript

/*!
* lethean.js - ITNS sidechain parameter overrides for Lethean network
*
* Token: ITNS (IntenseCoin) — named after Lethean's original identity
*
* Economics:
* - Tiny block rewards (atomic scale)
* - Round numbers exchangeable 1:1 with LTHN
* - Dust = trust earned from serving the network
*
* Performance Tiers (by accumulated dust):
* Valiant (1M+) — Datacenter/regional peering (named for Lethean's original lead dev)
* Intense (100K+) — Dedicated server operator (named for IntenseCoin)
* Pioneer (10K+) — Home server / VPS operator
* Relay (1K+) — Lightweight relay node
* Seed (1+) — New gateway
*/
'use strict';
const consensus = require('./consensus');
/**
* ITNS sidechain overrides
* Apply these to consensus exports to create the Lethean network parameters
*/
const lethean = {
// Match LTHN's 12 decimal places for dust precision
EXP: 12,
COIN: Math.pow(10, 12),
// Tiny block reward — forces long-term commitment
// 0.000001 ITNS per block = need ~348 days solo to earn 1 exchangeable ITNS
// A datacenter region (100 nodes) earns 1 ITNS every ~3.5 days
BASE_REWARD: 1000000, // 0.000001 * 10^12
// Faster blocks for more trust accrual events
// 30 second blocks = ~2880 blocks/day
// Solo: 0.00288 ITNS/day (exchangeable) + work-based dust (trust)
POW_TARGET_SPACING: 30,
// Work proofs: dust accrues from actual network service
// DNS queries served, VPN sessions handled, bandwidth relayed
// 1 query = 1 atomic dust unit
// A busy gateway: ~1000 queries/block * 2880 blocks = 2.88M dust/day
// Pioneer in ~4 days, Intense in ~35 days, Valiant in ~1 year
// No airdrop, no premine — trust is earned
MAX_AIRDROP: 0,
MAX_INITIAL: 0,
// Max supply determined by halving schedule
// With 0.001 per block, halving every 170000 blocks (~59 days)
// Total supply converges to ~340 ITNS (exchangeable to 340 LTHN)
// Plus unlimited dust (trust) in atomic units
// Naming costs — registering .lthn subnames
// Free for alias holders (validated against main chain)
MIN_NAME_FEE: 0,
// Performance tier thresholds (dust units)
TIER_SEED: 1,
TIER_RELAY: 1000,
TIER_PIONEER: 10000,
TIER_INTENSE: 100000,
TIER_VALIANT: 1000000,
/**
* Get tier name from dust amount
* @param {Number} dust - atomic units of trust
* @returns {String} tier name
*/
getTier(dust) {
if (dust >= lethean.TIER_VALIANT) return 'Valiant';
if (dust >= lethean.TIER_INTENSE) return 'Intense';
if (dust >= lethean.TIER_PIONEER) return 'Pioneer';
if (dust >= lethean.TIER_RELAY) return 'Relay';
if (dust >= lethean.TIER_SEED) return 'Seed';
return 'None';
},
/**
* Split balance into exchangeable value and trust dust
* @param {Number} balance - total balance in atomic units
* @returns {Object} { exchangeable, dust, tier }
*/
splitBalance(balance) {
const coin = lethean.COIN;
const exchangeable = Math.floor(balance / coin);
const dust = balance % coin;
return {
exchangeable, // whole ITNS, exchangeable to LTHN
dust, // atomic remainder, trust score
tier: lethean.getTier(dust),
display: `${exchangeable}.${String(dust).padStart(12, '0')} ITNS`,
};
},
};
module.exports = lethean;