System Constants

System Constants

Hard-coded constants used across the XE network. Every value below is traceable to a named constant in the xeprotocol/core source; the Go node and the embedded web UI must agree on all of them.

Units and supply

ConstantValueSource
AssetXE / AssetXUSD decimals6core/amount.go
UnitsPerToken1,000,000core/amount.go
MaxMemoBytes64 bytescore/memo.go
GenesisSupply42,000,000 XE (4.2×10¹³ µXE)core/genesis.go

On-chain amounts — balances, send amounts, lease cost and stake, pending sends — are uint64 micro-units: 1 XE = 1_000_000 µXE, and the same for XUSD. They travel on the wire as plain JSON numbers, not strings. Where integer division on an amount cannot be avoided, the rounding policy is always round up (ceilDiv, core/ledger.go).

Memos are allowed on send and burn blocks only, and must be valid UTF-8 of at most 64 bytes.

Proof of work

ConstantValueNotes
core.DefaultDifficulty0xfffff80000000000~2M expected attempts, ~1s on a single core
core.TestDifficulty0x0000000000000002Near-instant, for tests only
chat.DefaultPoWDifficulty0xffffc00000000000~2¹⁸ expected attempts, for chat envelopes

Block PoW and chat PoW are deliberately separate constants — they price different kinds of spam. A node advertises the thresholds it enforces as hex strings in GET /node (pow_difficulty, chat_pow_difficulty); "0" means PoW is disabled. Clients should read them from the node rather than hardcoding.

See Proof of Work for algorithm details.

Timing

ConstantValueUsed by
DefaultTimestampWindow±1 hourBlock timestamp validation
Vote window (voteWindowNanos)±5 minutesVote acceptance
DefaultMaxAttestationSkew±10 minutesLease attestation validation (genesis-pinnable)
chat.MaxEnvelopeSkew±5 minutesChat envelope freshness
fallbackDelay10 secondsFallback conflict resolution after detection
lockStabilityWindow3 secondsDelay before the 67% converge-quorum commit-lock may form
Stale conflict sweep15 secondsPeriodic conflict re-drive and cleanup
revoteBackoff15 secondsMinimum interval between sweep-driven converge re-emits
phantomEvictionDelay30 secondsEviction of unbacked phantom candidates
phantomUnretrievableTimeout10 minutesDrop deadline for a live but unretrievable phantom
failedPromotionTTL30 secondsQuarantine for a winner that failed full promotion
periodicSyncInterval10 secondsFrontier sync interval
syncCooldown5 seconds per peerPer-peer sync throttle
Bootstrap watchdog30 secondsRe-dial interval for disconnected bootstrap peers
Directory TTL30 minutesAccount directory entry expiry

[!INFO] Timestamp windows The block timestamp window (±1 hour) is intentionally generous to accommodate clock drift between nodes. Votes use a tighter ±5 minute window because representatives are expected to have reasonably synchronized clocks.

Size limits

Protocol limits

ConstantValueDescription
maxConflictHashes10Maximum competing block hashes per conflict
maxPendingVotesPerConflict10Votes buffered for a not-yet-known conflict
MaxAttestationsPerBlock20Maximum timekeeper attestations per lease block
MaxGossipMessageSize262,144 bytes (256 KB)Maximum gossip pubsub message
maxSyncRequestBytes1 MiBMaximum sync request payload
maxSyncResponseBytes10 MiBMaximum sync response page
maxTotalBlocks / maxServerBlocks10,000 per sessionBlocks transferred in one sync session
maxFrontiers10,000Frontier entries honoured in a sync request
Sync page size64 default, 256 maxBlocks per sync response page

State chain limits

ConstantValueDescription
MaxKeyLength128 bytesMaximum key length for KV operations
MaxValueSize65,536 bytes (64 KB)Maximum value size for KV operations
MaxBlockSize262,144 bytes (256 KB)Maximum serialized state chain block

Messaging limits

ConstantValueDescription
MsgMaxRequestSize65,536 bytes (64 KB)Maximum /xe/msg/1.0.0 request
MsgMaxResponseSize65,536 bytes (64 KB)Maximum /xe/msg/1.0.0 response
chat.MaxMessageBytes8,192 bytes (8 KiB)Maximum chat message body

Lease economics

[!WARNING] Pre-mainnet values These are the constants compiled into core/ledger.go today, on a testnet-only network. They may still change before mainnet. See Cost Model.

ConstantValueDescription
LeaseVCPURate20,000 µXUSD / vCPU / hourPer-vCPU cost
LeaseMemGBRate10,000 µXUSD / GB / hourPer-GB memory cost
LeaseDiskGBRate1,000 µXUSD / GB / hourPer-GB disk cost
LeaseStakeDivisor5Stake = ⌈cost / 5⌉, minimum 1 µXUSD
LeaseMaxDuration31,536,000 secondsLongest allowed lease (365 days)

Cost is computed in whole hours (partial hours round up) and whole GB of memory (partial GB round up), then scaled by the provider's price multiplier, which is carried ×1000 (1000 = 1.000×) and ceiling-divided back out.

[!EXAMPLE] Cost calculation The worked target from core/ledger.go: 1 vCPU, 1 GB memory, 10 GB disk for 1 day at a 1.000× multiplier.

perHourMicro = 1×20_000 + 1×10_000 + 10×1_000 = 40_000 µXUSD/hour
hours        = 24
costMicro    = 40_000 × 24 = 960_000 µXUSD   (= 0.96 XUSD)
stake        = ceil(960_000 / 5) = 192_000 µXUSD

The XE emitted to the provider on settlement is not equal to the cost: it is ceil(cost × R_capped / 1000), where R_capped is the epoch's emission ratio (scaled ×1000) locked into the lease_accept block. See Cost Model and Economics for the emission curve.

Lease timing

ConstantMainnet defaultDescription
DefaultLeaseMinDuration60 secondsShortest allowed lease
DefaultLeaseSettleGrace1 hourExpiry → end of the provider settle window
DefaultLeaseForceSettleGap25 minutesDead zone before the consumer force-settle window opens
DefaultLeaseEscrowExpiry365 daysExpiry → escrow burn deadline
DefaultLeaseArchiveGap1 hourLocal GC delay past the consensus deadline

Force-settle becomes eligible at expiry + LeaseSettleGrace + LeaseForceSettleGap — 1 hour 25 minutes after expiry on the defaults above.

[!IMPORTANT] Lease timing is pinned in genesis These are the production (mainnet) defaults. A network may override any of them in its genesis block, which is where every node gets its values from — a compressed test network is a different genesis, not a different binary. Read a live network's effective values from GET /node (lease_timing), not from these constants.

Performance certificates

ConstantValueDescription
BenchmarkIterations375,000,000Sequential SHA-256 hash chain
MemoryTableSize8,388,608Memory table entries (256 MB at 32 bytes each)
MemoryReads1,000,000Sequential-dependency random reads from the memory table
WorkloadVersion3Benchmark algorithm version (increment on changes)
CertificateValidity7 daysHow long a certificate is valid after issuance

See Performance Evaluation for benchmark and scoring details.

Consensus

ConstantValueDescription
Quorum threshold67%Delegated weight in final votes required to finalize
Connection manager low water100 peersMinimum peer target
Connection manager high water400 peersMaximum peer target
Connection grace period1 minuteNew connection protection window

API

ConstantValueDescription
Read rate limit200 req/sec, burst 1,000Per-IP bucket for GET requests
Write rate limit10 req/sec, burst 50Per-IP bucket for POST requests
rateLimiterTTL5 minutesIdle eviction for a per-IP limiter entry
maxRateLimiterIPs100,000Cap on tracked IPs before new ones are rejected
maxRequestBytes1 MiBMaximum HTTP request body
Page limit100 default, 1,000 max?limit= on paginated endpoints
Default API port8080xe node --api-port
Default libp2p port9000xe node --port
Default UI port8000xe node --ui-port
Default CORS originhttp://localhost:3000Used when --cors-origin is unset

Reads and writes get separate per-IP buckets: browsing the chain must never trip the limiter, while POST mutations (block submission, chat, directory registration) are held to a much tighter rate.

See also