This blog, "Self-Sovereign Blog", is a showcase for "Paywall Without Intermediaries". It will also be a showcase for Bitcoin as a medium of exchange.
after_low.mp4
There are three keys to realizing above: Self-made, Bitcoin, and Nostr.
Blog is handcrafted by JavaScript framework, SvelteKit, and can be hosted anywhere. Payments for paywall use Bitcoin which is the border-less internet native money, specifically Lightning Network which is the layer2 of Bitcoin and enables fast finality and micro payments. The proof of payment is shared between buyers and sellers through messaging using the Nostr protocol.
Both Bitcoin and Nostr are the people's network without specific authorities. So, this paywall is "Self-Sovereignty", with no middlemen involved.
The front server is responsible for:
- delivering blog posts that are markdown-based
- unlocking paywalled content
- delivering invoices to remove the paywall
- setting up to subscribe to encypted messages to share the payment proof
- asking payment authentication/authorization related to all of the above to the API server
Payment authentication/authorization for paywall follows the Lightning HTTP 402 Protocol (L402 protocol) that repurposes the HTTP 402 Payment Required
error code and is a standardized way of adding micropayments to any existing HTTP-REST or gRPC API.
The API server coodinates two networks that are Lightning Network for payments and Nostr protocol for messagings, and executes L402 protocol. You can check the sample implementation for this blog which wraps the L402 API Key proxy called Aperture.
Lightning Network is Bitcoin's layer2 used for payment network. Bitcoin is decentralized internet money, so users can pay from any wallet that supports Lightning Network.
Nostr protocol is a decentralized network similar to Bitcoin, which is used on this blog to share the proof of payment safety and securely without the need for any counterparty. To achieve this, we adopt NIP-04 to exchange direct message encrypted with AES-256-CBC.
Details are explained in this post.
I appreciate for the following codebases in addition to those listed in package managers that are very helpful in this development.
- Handcrafted blog by svelte https://github.com/mattjennings/sveltekit-blog-template
- Nostr client by svelte https://github.com/SnowCait/nostter
- Nostr client by svelte https://github.com/akiomik/nosvelte
- Apertue demo https://github.com/ellemouton/aperture-demo