How the ALTCHA PoW mechanism works
mainThe ALTCHA Proof-of-Work (PoW) mechanism follows a three-step lifecycle involving the server and the client.
1. Challenge Creation (Server)
The server generates a cryptographically secure challenge. This includes the algorithm, cost, nonce, salt, and difficulty targets (keyPrefix or keySignature). The challenge is signed with an HMAC to ensure integrity.
Optional Parameters:
expiresAt: A Unix timestamp for challenge expiration.data: An arbitrary key-value map (object).
2. Solution Finding (Client)
The client performs a brute-force search. It iterates through a counter (starting from 0), appending it to the nonce to create a password. It then derives a key using the specified algorithm and parameters. The search stops when the derivedKeyHex starts with the required keyPrefix.
3. Solution Verification (Server)
The server validates the solution by performing three checks:
- Integrity: Validates the HMAC signature of the challenge parameters.
- Expiration: Checks if the current time is past
expiresAt. - Correctness: Executes a single KDF calculation using the submitted
counterand compares the result to the submittedderivedKey(or validates againstkeySignaturein deterministic mode).