How it works?
Syscoin Testnet Faucet is a proof of work faucet inspired by Hashcash.
the faucet is prevented by requiring the user to provide a proof of work over a server created challenge and through limiting frequency of sessions from each IP address.
The more work the user proves, the more coins the server sends. The user can thus obtain a small amount
of coins fairly quickly or they can decide to let their computer calculate slightly longer in order to get more
coins. All basic parameters and limits are configurable on the server.
How The faucet operates?
- The user requests the main page, fills in the target tSYS address and submits the form.
The server creates a session for the user which consists of the user's IP address, the target tSYS address A, the timestamp T, and a random challenge C.
The server sends the challenge C back to the user.
- The user starts to calculate responses Ri = SHA512(i | C) while incrementing the nonce
i. The user keeps the lowest Ri value as its best result.
As long as the best result is lower than the required limit for the minimal payout, the user can end the computation at any time by
submitting the results to the server. The submission of the result includes the challenge C and
the nonce i. If the user does not stop the computation, the client script tries to find the best solution
for 180 seconds and then submits the best result automatically. The client script also stops the computation and submits the result if the minimal hash, which guarantees the maximal payout, is reached.
- Given the user's IP address, challenge C and nonce i, the server can look up the session of the user in its in-memory database,
from which it checks that the challenge still exists, the
timestamp T is not older than the maximal submission time (600 seconds), and that
Ri = SHA512(i | C) is below the configurable minimum required limit for the minimal payout. Then the
server calculates the number of coins V to send to the user's address A using
formula V = ((2512 - 1) / Ri) / Q, where Q is configurable coefficient
that specifies how many hashes is the user expected to calculate to be rewarded with 1 tSYS.
The server then marks the user's session in its in-memory database as completed.
The session is evicted from the server's in-memory database after the maximal submission time. If the user submits the form before the previous session is completed, a new session is created. However, if the previous session is completed, the user is not allowed to create a new session until the previous one is evicted.