Skip to content

Commit

Permalink
doc: README
Browse files Browse the repository at this point in the history
  • Loading branch information
studioTeaTwo committed Dec 12, 2023
1 parent 70e6e42 commit f773569
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 61 deletions.
43 changes: 19 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,33 @@
# create-svelte
# Self-Sovereign Blog

Everything you need to build a Svelte project, powered by [`create-svelte`](https://github.com/sveltejs/kit/tree/master/packages/create-svelte).
The self-sovereign blog is a showcase of "paywall without intermediaries".

## Creating a project
This blog is handcrafted by 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 realizes fast finality and micro payments. The proof of payment is shared between buyers and sellers through messaging using the Nostr protocol.

If you're seeing this, you've probably already done this step. Congrats!
Both Bitcoin and Nostar are the people's networks without specific authorities. So, this paywall is Self-Sovereignty, with no middlemen involved.

```bash
# create a new project in the current directory
npm create svelte@latest
## Overview

# create a new project in my-app
npm create svelte@latest my-app
```
![](doc/overview.png)

## Developing
The front server is responsible for:

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
1. delivering blog posts that are markdown-based
2. unlocking paywalled content
3. delivering invoices of paywall
4. setting up to subscribe to messages for the payment proof
5. asking payment authentication/authorization related to all of the above to the API server

```bash
npm run dev
Payment authentication/authorization for paywall follows the [Lightning HTTP 402 Protocol (L402 protocol)](https://github.com/lightning/blips/pull/26) 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.

# or start the server and open the app in a new browser tab
npm run dev -- --open
```
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](https://github.com/studioTeaTwo/simple-l402-server) for this blog which wraps the L402 API Key proxy called [Aperture](https://github.com/lightninglabs/aperture).

## Building
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.

To create a production version of your app:
Nostr protocol is a decentralized network similar to Bitcoin, which is used in this blog to share the proof of payments safety and securely without the need for any counterparty.

```bash
npm run build
```
## L402 protocol flow

You can preview the production build with `npm run preview`.
![](doc/challenge-response.sequence.png)

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
TODO
Binary file added doc/challenge-response.sequence.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 0 additions & 31 deletions doc/challenge-response.sequence.yml

This file was deleted.

Binary file added doc/overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion posts/002_ligtning-nostr/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ Entering the preimage manually is a problem. Nostr will be a solution.

![](./after.webm)

I'll post an overview and technical details at a later date, though, you can experience it below right now. Of course, it is also possible to prevent private key from revealing using NIP-07.
I'll post an overview and technical details at a later date, though, you can experience it below right now. Of course, it is also possible to prevent Nostr's private key from revealing using NIP-07.

<hr id="l402" hidden>
2 changes: 1 addition & 1 deletion src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { PUBLIC_BLOG_SERVER, PUBLIC_L402_SERVER, PUBLIC_SERVICE_NPUBKEY } from '
import type { CookieSerializeOptions } from 'cookie';

// Blog author
export const Title = 'Self Sovereign Blog';
export const Title = 'Self-Sovereign Blog';
export const Author = 'TeaTwo';
export const BitcoinDonationAddress = 'bc1q8pmsy0xfrkpr3vky9kw5kjmqrm0fsg70q963dg';

Expand Down
8 changes: 4 additions & 4 deletions src/routes/articles/[slug]/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@
<button type="button" on:click={handleClickNip07}>NIP-07</button>
<div class="paywall-nostr-description">
<p class="paywall-nostr-description-text">
We use LightningNetwork for paywalled content. First, log in to Nostr. Please pay the
LightningNetwork invoice after that. Nostr is used for the settlement synchronization
which passes the preimage by NIP-04 after paying the invoice. nsecKey is only stored
We use LightningNetwork for paywalled content. First, log in to Nostr, then pay your
LightningNetwork invoice. Nostr is used for the synchronization of payment proof which
passes the preimage by NIP-04 after paying the invoice. Your nsecKey is only stored
locally and doesn't share with server.
</p>
</div>
Expand Down Expand Up @@ -334,7 +334,7 @@
padding: 2rem;
overflow-x: auto;
}
:global(.post p>a) {
:global(.post p > a) {
text-decoration-line: underline;
}
article {
Expand Down

0 comments on commit f773569

Please sign in to comment.