Trade Steps
A successful trade consists of these steps, each being posted as a Nostr event:
-
Client asks for PoW
The client posts an Ask containing the Nostr event to be mined, the target difficulty, the price and the timeframe within which a solution is wanted.
-
Provider(s) post blinded solution and invoice
One or more providers can decide to start mining, depending on the client's request and reputation.
Once a matching nonce is found, the provider creates a BOLT11 invoice. The solution consists of: the mined event ID, the PoW nonce, and the new event timestamp. The provider blinds the nonce by
xor
-ing it with the invoice preimage, then posts the invoice and the blinded solution. -
Client pays an invoice and unblinds the solution
The Client may get several blinded solutions. The solutions that are obviously invalid can be discarded: those that come too late, those without enough PoW in the new event ID, and those with an invalid invoice.
The client chooses a possibly-valid blinded solution and pays the invoice. This reveals the preimage, with which the client unblinds the nonce. The client can reconstruct the mined event.
-
Client or provider post preimage
Once the solution is unblinded, the client can see if the nonce is correct or incorrect. If it's incorrect, posting the preimage will allow others to see the provider acted dishonestly and to therefore count this towards this provider's negative reputation. If the nonce is correct, posting the preimage will prove the client paid for a solution posted on time, which increases the client's reputation.
The client will likely post the preimage for the first solution received. If more miners posted valid solutions on time, they may want to post their own preimages once the client posts another provider's preimage. The providers may want to do this to prove they mined correctly, which increases their positive reputation, even if their solution wasn't chosen for this specific trade.