More scalable data storage

This commit is contained in:
2026-10-19 20:17:10 -04:00
parent 0b9061372b
commit baad477ca5
16 changed files with 346 additions and 168 deletions
+6 -3
View File
@@ -1,9 +1,9 @@
import type { Article } from './protocol.ts';
import type { MintStatsSnapshot } from './enrichment.ts';
export const NETWORK = 'wikideck-randomx-testnet-4' as const;
export const NETWORK = 'wikideck-randomx-testnet-5' as const;
export const CONSENSUS = {
version: 4, targetSeconds: 30, retargetInterval: 10, medianWindow: 11,
version: 5, targetSeconds: 15 * 60, retargetInterval: 10, medianWindow: 11,
commitments: 'sha256-domain-separated-counted-merkle-v1', randomx: '1.2.1', powEndian: 'big',
maxFutureSeconds: 120, epochBlocks: 2048, epochDelay: 64,
maxTransactions: 64, coinbaseMaturity: 2, maxBlockBytes: 64 * 1024,
@@ -14,7 +14,7 @@ export type NftTransfer = {
sequence: number; publicKey: string; signature: string;
};
export type BlockHeader = {
version: 4; network: typeof NETWORK; chainId: string; height: number;
version: 5; network: typeof NETWORK; chainId: string; height: number;
previousHash: string; createdAt: number; article: Article; statsSnapshot: MintStatsSnapshot;
owner: string; publicKey: string; nonce: number; target: string; key: string;
transactionsRoot: string; stateRoot: string;
@@ -26,6 +26,9 @@ export type MiningTemplate = {
header: BlockHeader; transactions: NftTransfer[]; blob: string; nonceOffset: number;
};
export type NftState = Record<string, { owner: string; sequence: number; mintedHeight: number; pageId: number }>;
/** Persistent overlay: a block stores only NFT entries it changed, sharing its parent's state. */
export type NftStateLayer = { kind: 'layer'; parent: NftStateView; changes: NftState };
export type NftStateView = NftState | NftStateLayer;
export type TestnetSnapshot = {
network: typeof NETWORK; chainId: string; genesis: string; tip: string; cumulativeWork: string;
blocks: TestnetBlock[]; transfers: NftTransfer[]; pendingTransfers: NftTransfer[];
+2 -2
View File
@@ -1,5 +1,5 @@
// Browser/Node WebCrypto only: this module never reads storage or sends data.
const NETWORK = 'wikideck-randomx-testnet-4';
const NETWORK = 'wikideck-randomx-testnet-5';
const ITERATIONS = 600_000;
const MAX_BYTES = 32 * 1024;
const encoder = new TextEncoder();
@@ -7,7 +7,7 @@ const encoder = new TextEncoder();
export type WalletBackup = {
format: 'wikideck-wallet-backup';
version: 1;
network: 'wikideck-randomx-testnet-4';
network: 'wikideck-randomx-testnet-5';
kdf: 'PBKDF2-SHA256';
iterations: 600000;
cipher: 'AES-256-GCM';