• Stars
    star
    120
  • Rank 295,983 (Top 6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 7 years ago
  • Updated about 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Sell digital files with Bitcoin & Lightning âš¡

FileBazaar

npm release MIT license Pull Requests Welcome IRC

Sell digital files with Bitcoin & Lightning.

  • Simple setup and minimal configuration, just put some files in a directory and start the server.

  • Lightweight web browsing interface, works without JavaScript.

  • Generates previews for images, videos, audio, pdf and text documents.

Powered by âš¡ Lightning Charge.

FileBazaar demo

Quickstart

Setup Lightning Charge, then:

# Install dependencies for EXIF extraction and preview generation
$ apt install exiftool ffmpeg graphicsmagick unoconv

# Install dependencies for node-canvas (see https://github.com/Automattic/node-canvas#installation)
$ apt install libcairo2-dev libjpeg8-dev libpango1.0-dev libgif-dev build-essential g++

# Install filebazaar
$ npm install -g filebazaar

# Prepare a directory with the files you wish to sell and cd to it
$ mkdir ~/ForSale && cd ~/ForSale

# Initialize the `_filebazaar.yaml` config file
$ filebazaar init

# Edit the config file (`charge_token` is required, `token_secret` is auto-generated)
$ edit _filebazaar.yaml

# Start filebazaar!
$ filebazaar

Configuration

FileBazaar's configuration options can be managed using the _filebazaar.yaml file or via environment variables. All config options are optional and have sane defaults except for charge_token and token_secret, which are required. If you're accessing the web server remotely, you probably also want to set host and url. See lib/config.js for more details.

Below is an example _filebazaar.yaml file:

---

### Server settings

port: 9678
host: 127.0.0.1
env: production
url: http://my-public-url.com/

### Lightning Charge

charge_url: http://localhost:9112
charge_token: API_TOKEN_CONFIGURED_IN_CHARGE

### FileBazaar settings

# The directory containing the files for sale
# defaults to the directory containing the _filebazaar.yaml file
directory: /home/shesek/ForSale

# The default file price, can be overridden for individual files (see below)
default_price: 0.25 USD

# Expiry times
invoice_ttl: 3600 # lock-in exchange rate for 1 hour
download_ttl: 172800 # make download available for 2 days after payment

# Secret for generating HMAC access tokens (required)
token_secret: SOME_LONG_RANDOM_STRING

# Directory to keep cached preview files
# defaults to `{directory}/_filebazaar_cache`
cache_path: /path/to/filebazaar_cache

### Looks & feel

# See available themes on https://bootswatch.com
theme: yeti

# Add custom CSS
css: |
  body { background: blue }
  a { color: orange }

# Set custom views directory
views_dir: /path/to/custom/views

# Set custom static files directory
static_dir: /path/to/custom/static

### Files settings

files:
  Books/Mastering-Bitcoin.pdf:
    price: 5 USD
    button: Buy this book
    desc: >      
      Mastering Bitcoin is essential reading for everyone interested in learning about bitcoin.
      
      This field **supports markdown** and will show up on the file's page.

  # if you're only interested in setting the price, you can use:
  Books/Mastering-Bitcoin.pdf: 5 USD

  # if you want to configure multiple files inside the same directory, you can nest them:
  Media/: # (note the trailing slash)
    Books/Andreas/:
      Mastering-Bitcoin.pdf: 5 USD # /Media/Books/Andreas/Mastering-Bitcoin.pdf
      The-Internet-of-Money.pdf: 4 USD # /Media/Books/Andreas/The-Internet-of-Money.pdf

CLI

Initializing _filebazaar.yaml

You can use $ filebazaar init [directory] to initialize a new _filebazaar.yaml config file. A random token_secret will be added for you. If no [directory] is specified, the file will be created in the working directory.

Running FileBazaar

To start FileBazaar, run $ filebazaar [path]. You can either specify the path to the files directory or to the _filebazaar.yaml file. If no [path] is specified, defaults to the working directory.

File Preview

FileBazaar can currently generate previews for the following file types:

  • Images: a preview image will be generated by pixelating the left half of the image and adding watermark text using node-canvas and graphicsmagick (see example image).

  • Videos & audio: a preview will be generated by slicing off the first 30 seconds using ffmpeg.

  • Documents: a preview image of the first page of the document will be generated using unoconv (supports pdf, doc, docx, odt, and many others).

In addition, EXIF metadata will be extracted using exiftool and displayed for all file types.

License

MIT

More Repositories

1

lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
C
2,829
star
2

elements

Open Source implementation of advanced blockchain features extending the Bitcoin protocol
C++
1,044
star
3

lightning-charge

A simple drop-in solution for accepting lightning payments
JavaScript
553
star
4

secp256k1-zkp

Experimental fork of libsecp256k1 with support for pedersen commitments and range proofs.
C
288
star
5

libwally-core

Useful primitives for wallets
C
271
star
6

simplicity

Simplicity is a blockchain programming language designed as an alternative to Bitcoin script.
C
243
star
7

paypercall

Charge for HTTP APIs on a pay-per-call basis with Bitcoin and Lightning âš¡
JavaScript
147
star
8

scriptless-scripts

Documentation about scriptless scripts
TeX
130
star
9

woocommerce-gateway-lightning

A WooCommerce gateway for lightning payments
PHP
115
star
10

nanopos

A simple Lightning âš¡ point-of-sale system, powered by Lightning Charge
JavaScript
108
star
11

peerswap

Go
96
star
12

elementsproject.org

Source code for the ElementsProject.org website
CSS
90
star
13

nanotip

âš¡ Lightning Tip Box âš¡
JavaScript
85
star
14

lightning-charge-client-js

JavaScript client for lightning-charge
JavaScript
64
star
15

ifpaytt

If Pay Then That âš¡ Trigger IFTTT actions with Bitcoin Lightning payments
JavaScript
56
star
16

wordpress-lightning-publisher

âš¡ Lightning Publisher for WordPress
PHP
54
star
17

rust-elements

Rust support for Elements transaction/block deserialization
Rust
51
star
18

reserves

Proof-of-Reserves tool for Bitcoin
Rust
46
star
19

confidential-assets-demo

Confidential Assets Demo built on the Elements blockchain platform
Go
36
star
20

cross-input-aggregation

Thoughts on cross-input (signature) aggregation for Bitcoin
Rust
35
star
21

lightning-jukebox

A Lightning powered Jukebox âš¡ Pay with Bitcoin to choose your music.
JavaScript
35
star
22

rust-simplicity

C
34
star
23

elementsproject.github.io

https://elementsproject.org website
HTML
28
star
24

dicemix

Rust
24
star
25

lightning-charge-client-php

PHP client for lightning-charge
PHP
24
star
26

rust-secp256k1-zkp

C
23
star
27

cln-application

Core lightning application on Umbrel
TypeScript
21
star
28

ELIPs

Elements Improvement proposals
12
star
29

elements-miniscript

Rust
11
star
30

glightning

Go
7
star
31

peerswap-spec

7
star
32

borromean-signatures-writeup

TeX
6
star
33

elements-assets-exchange-demo

OTC-style exchange based on atomic swaps using Elements and confidential assets
JavaScript
5
star
34

qa-assets

Elements-related blobs used for quality assurance.
3
star
35

elementsbp-api-reference

[DEPRECATED: Moved to https://github.com/ElementsProject/elements/blob/elements-0.14.1/doc/elements-api.md] API Reference Documentation for the Elements Blockchain Platform
3
star
36

lightning-demos

2
star