blossom/buds/07.md

1.3 KiB

BUD-07

Paid upload and download

draft optional

Cashu payments for uploads and downloads

Paid Upload

The server may require payment for uploading blob by returning a 402 status code the PUT /upload endpoint (and HEAD /upload if BUD-06 is supported)

Paid Downloads

The server may also require payment for downloads by responding with a 402 status code for GET /<sha256 and HEAD /<sha256> endpoints

Payment Flow

When the server is requesting payment for an endpoint it MUST respond with 402 and a X-Cashu header containing a base64 encoded json object (payment request)

The payment request should contain an amount, mints, unit, and pubkey fields

  • amount The amount of ecash being requested
  • mints An array of mints that this server uses
  • unit The cashu unit from the mints
  • pubkey (optional) a 33 byte pubkey to lock the tokens too. see NUT-11

When the client receives a 402 response and with a X-Cashu header it may retry the request with a payment

The payment should be a serialized cashu token according to NUT-00

Payment Checks

Optionally a server may respond with 402 to the HEAD /upload, HEAD /<sha156> if it supports BUD-06