Skip to content

Instantly share code, notes, and snippets.

View fiatjaf's full-sized avatar

fiatjaf_ fiatjaf

View GitHub Profile
@plugnburn
plugnburn / README.md
Last active March 27, 2016 16:09
Psto: a single package.json to scaffold and run your single-post web page in no time

Psto

This is a no-brainer to get your single-post web page up and running. Just have to have Node and NPM installed, and /bin/sh pointing to Bash shell. Styling is powered by 999.css.

Steps:

  1. Place the below package.json into an empty directory and enter this directory in your command line prompt.
  2. Run npm run scaffold.
  3. Edit domain, title and author in the config section of your package.json. The domain may be either a Surge subdomain or your own (please refer to the Surge docs). If you're going to host your page yourself, you may leave domain empty.
data ToInt a = ToInt (a -> Int)
instance Functor ToInt where
-- note, f :: a -> b; g :: a -> Int, and the todo :: b -> Int
fmap f (ToInt g) = ToInt (error "todo")
class Contravariant f where
contramap :: (b -> a) -> f a -> f b
instance Contravariant ToInt where
@RobinLinus
RobinLinus / sats4files.md
Last active October 9, 2023 21:00
Sats4Files: Decentralized File Hosting based on Lightning payments

Sats4Files: Decentralized File Hosting based on Lightning

Sats4Files is a protocol for decentralized file hosting. It allows users to request data from untrusted servers, and upon receiving the encrypted data, they can pay for the decryption key via Lightning. The exchange is atomic, ensuring that the user only receives the data if they pay for it, and the seller only gets paid if they deliver the data. The protocol is an efficient form of verifiable encryption, which is similar to verifiable secret sharing using Shamir's algorithm.

This scheme is simplified and does not fully solve the problem, as discussed in the Limitations section. This writeup intends to spark interest to solve the remaining issues beyond the fixes that we suggest.

Sats4Files Problem

The client wants to buy from the server the file corresponding to a particular file_id.

Here, we assume we have PTLCs on Lightning instead of HTLCs. That means we can buy a discrete logarithm over Li