Skip to content

Paid Uploads

Variable Meaning
BLOSSOM_SATS_PER_MIB Price for each MiB, in satoshis. 0 is free
BLOSSOM_FREE_BYTES Bytes that are free
CASHU_MINTS Accepted Cashu mints
LND_URL LND node for Lightning
LND_CA, LND_MACAROON Files with its certificate and macaroon

With a price, at least one mint or a Lightning node is required.

Flow

  1. The client uploads, or asks first with HEAD /upload.
  2. Without enough credit, the server answers 402 with a Cashu request in X-Cashu-Request and an invoice in X-Lightning.
  3. The client pays and repeats the request with the token in X-Cashu or the preimage in X-Lightning.
blossomctl upload -server https://media.example -file a.png -cashu <token>

Prices are published in /.well-known/nostr/nip96.json.