Table of Contents

Interface IAccountCreationPuzzleProvider

Namespace
FishMMO.Server
Assembly
FishMMO.Server.dll

Scaffold interface for client-side proof-of-work (PoW) puzzles issued during account creation. The global hourly cap (maxGlobalAccountCreationsPerHour) absorbs the impact of registration floods, but spending the budget still costs the server real database I/O. A small PoW puzzle (e.g. a SHA-256 difficulty challenge) shifts the cost asymmetry: an attacker pays CPU per attempt while a legitimate user pays only milliseconds.

The intended production implementation:

  • Server issues a (challenge, difficulty) tuple bound to the handshake nonce and connection,
  • Client solves and returns a nonce such that H(challenge || nonce) has the required leading zero bits,
  • Server verifies in <1ms and proceeds with account creation.

The puzzle MUST be bound to the connection / handshake to prevent pre-mining a stockpile of valid solutions. Difficulty is increased dynamically when the global cap is approaching saturation.

public interface IAccountCreationPuzzleProvider

Methods

IssueAsync(string, CancellationToken)

Issues a fresh puzzle. Implementations bind it to connectionContext.

Task<AccountCreationPuzzle> IssueAsync(string connectionContext, CancellationToken cancellationToken)

Parameters

connectionContext string
cancellationToken CancellationToken

Returns

Task<AccountCreationPuzzle>

VerifySolution(AccountCreationPuzzle, byte[])

Verifies a client solution. Returns false for stale, reused, or invalid solutions.

bool VerifySolution(AccountCreationPuzzle puzzle, byte[] solutionNonce)

Parameters

puzzle AccountCreationPuzzle
solutionNonce byte[]

Returns

bool