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 ef91f61
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 60 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 allows for 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:
1. delivering blog posts that are markdown-based
2. unlocking paywalled content
3. delivering invoices
4. subscribing to messages
5. asking payment authentication/authorization to the API server for all of the above

Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
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.

```bash
npm run dev
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).

# or start the server and open the app in a new browser tab
npm run dev -- --open
```
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.

## Building
Nostr protocol is a decentralized network similar to Bitcoin, which is used in this blog to share proof of payments safety and securely without the need for any counterparty.

To create a production version of your app:
## L402 protocol flow

```bash
npm run build
```
![](doc/challenge-response.sequence.png)

You can preview the production build with `npm run preview`.
TODO

> To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
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 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 ef91f61

Please sign in to comment.