valid-stamp? ( stamp -- ? )
Hashcash

Prev:mint* ( tuple -- stamp )
Next:valid-date? ( yymmdd: string -- ? )


Vocabulary
hashcash

Inputs
stampa string


Outputs
?a boolean


Word description
Verify the stamp's validity. Only supports hashcash version 1. Expiry time / validity period is 28 days by default as it is the recommended value.

The decision about how long the stamp should be considered valid is up to the verifier. If it is too short, then it is possible for some applications that the stamp will expire before arriving at the recipient (e.g. with e-mail). The suggested value of 28 days should be safe for normal e-mail delivery delays. The choice is a trade-off between database size and risk of expiry prior to arrival, and depends on the application.

Different stamps in the same database can have different validity periods, so for example stamps for different resources with different validity periods can be stored in the same database, or the recipient may change the validity period for future stamps without affecting the validity of old stamps.

You can obtain the current value by executing the following line of code:
expiry-days get

You can modify the expiry time by modifying the value of the symbol expiry-days.
32 expiry-days set

This changes the expiry period to 32 days.

Examples
USING: hashcash ; "foo@bar.com" mint valid-stamp?
--- Data stack: t


Definition