Skip to main content

Module nonce

Module nonce 

Source
Expand description

Process-wide (wallet, subaccount) nonce manager for Derive self-custodial requests.

Nonces are UNIX nanoseconds, allocated monotonically per (wallet, subaccount) across client instances in the same process. Clock rollback advances the last issued value, provided it remains inside the inclusive order window [now minus 90 days, now plus 1 hour]. Local time approximates server time; a clock offset beyond the window still causes venue rejection. Login timestamps remain milliseconds.

A process-wide DashMap shares state and a compare-exchange loop serializes allocations under contention. Wallet hex is normalized to lowercase.

Structs§

NonceManager
Thread-safe process-wide nonce allocator keyed by (wallet, subaccount_id).

Enums§

NonceError
Errors raised by NonceManager.