optional
author: calle
With the spendable check, wallets can ask the mint whether a specific token is already spent. This can be useful for different reasons. For example, when Alice
prepares a token to be sent to Carol
, she can mark these tokens in her database as pending. She can then, periodically or upon user input, check with the mint, if the token is still spendable or if it has been redeemed by Carol
already (thus not spendable anymore). Another use case is for wallets that want to delete spent proofs from their database. Before deleting a proof, a wallet can check if the token is still spendable to be sure that they don't delete an unspent token by accident.
Request of Alice
:
POST https://mint.host:3338/check
With the data being of the form CheckSpendableRequest
:
{
"proofs": Proofs
}
Proofs
is a list (array) of Proof
s (see NUT-0). Alice
CAN provide a full Proof
but MUST provide at least the secret
(which is the only thing that Bob
needs to check whether the token has been spent).
With curl:
curl -X POST https://mint.host:3338/check -d \
{
"proofs":
[
{
"secret": "S+tDfc1Lfsrb06zaRdVTed6Izg"
},
{
...
}
]
}
Response of Bob
:
Bob
will respond with a CheckSpendableResponse
{
"spendable": Array[bool]
}
Where [bool]
is an array of booleans indicating whether the provided Proof
is still spendable. Important: The list of booleans MUST be in the same order as the proofs provided by Alice
in the request.