Skip to content

JASchilz/LightningKeychains

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lighting Keychains

A demonstration lightning network store, using the LND lightning client, written in Python using Flask and peewee. Currently running on testnet3 and viewable at https://lightningkeychains.com: try it out (it could be down)!

The simple branch is a kind of proof of concept that shows how easily you can integrate your favorite command line lightning network client with your favorite web framework. In particular, the file lnd.py provides the Python functions which interact with the LND client. I'll be developing a fully featured web store on the master branch that I'll deploy on mainnet and sell actual 3D printed keychains from.

Requirements

In addition to the package requirements listed in requirements.txt, you must also have a functioning LND client. LND must be installed, connected to the network, and available at the command line the store can create invoices and receive payments. If you encounter difficulty registering payments in the web store, first check that you are able to receive payments at the command line using lncli.

In particular, you much be able to do the following at the command line:

$ lncli addinvoice 2000
{ "r_hash": "3ab56...", "pay_req": "lntb5738nmq70..."}

$ lncli getinvoice 3ab56...
{...}

This project requires Python3.

Configuration

You can configure the application using the following environment variables

Name Description File
DATABASE_URL Database connection URL model.py
PORT The port to serve this web application on; default 5000 main.py
LND_PUBLIC_ADDRESS The address of your LND node, if public main.py
LND_PUBLIC_PORT The port of your LND node; peers will assume 9735 main.py

All environment configuration variables are optional. The LND_PUBLIC_ADDRESS variable is only required if your node is publically accessible and you want to publish its address on your store front.

Installation/Running

Supposing that LND is running and connected to the network, you can download and run the web store with:

$ git clone git@github.com:JASchilz/LightningKeychains.git
$ cd LightningKeychains
$ pip3 install -r requirements.txt   # Might want to do this inside a virtual environment.
$ python3 setup.py                   # Creates the database tables.
$ python3 main.py

On subsequent runs, you should only have to run python3 main.py.

On your machine, you might invoke Python3 and Pip3 using the commands python and pip, but in any case be sure that you are running Python v3.

Documenting how to deploy to a production environment is outside the scope of this project. For more information, you can read deployment instructions from Flask and peewee.

Further Development

When the LND opens to mainnet, I may roll the https://lightningkeychains.com (it could be down) store to mainnet and begin selling actual 3D printed keychains. To support that, I would program in e-mail sending and an administrative interface that I could use to process orders.

About

A demonstration Lightning Network store in Flask.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published