Git Product home page Git Product logo

lightning-tip-jar's Introduction

sats4tips

Your own personalized space for collecting tips in Bitcoin.

This project aims to be a demonstration of utilizing the Lightning network within a web application. Feel free to re-use any code that you find!

Features

  • Lightning Login (Authentication).
  • Static Pay Requests.
  • Payment Withdraws.
  • Individual custodial accounts.
  • Personal Payment Addresses (coming soon!)

Tech Stack

Lightning Server  : LND (github link)
Account Managment : Lnbits (github link)
Application Host  : Voltage (site link)
Webserver Host    : Vercel (site link)
Web Framework     : NextJS (site link)

Packages

react        : React framework.
next         : Next framework (uses React).
iron-session : Encrypted client-side sessions.
secp256k1    : For secp256k1 signatures.
bech32       : For bech32 (lnurl) encoding.
moment       : For extra time/date features.
qrcode       : For generating QR codes.
swr          : For managing fetch / caching responses.

Getting Started

Before getting started, you will need to setup an .env.local file with the following:

SECRET_KEY=<A random base64url encoded string. Encrypts server-side data.>
SESSION_NAME=<Reference name of your site. For iron-session cookie.>
SESSION_KEY=<A random base64url encoded string. Encrypts cookie data.>
LNBITS_URL=<URL endpoint of your lnbits instance.>
LNBITS_KEY=<Master user key of your lnbits instance.>
MONGO_DBNAME=<Name of your project's mongo database.>
MONGO_DBURI=<Full mongoURI pointing towards your MongoDB instance.>

From there, you can start with yarn or npm i in order to install all package dependencies.

Once that is complete, you should be able to start a local instance of the project using yarn dev or npm dev.

Open http://localhost:3000 with your browser to see the result!

If you would like to deploy to vercel, you can install their client using npm i -g vercel, then follow the prompts to setup an account and launch a preview build of your project.

Learn More

To learn more about the technology behind this project, take a look at the following resources:

  • LND documentation

  • LNBits documentation

  • Voltage documentation

  • Next.js Documentation - learn about Next.js features and API.

  • Learn Next.js - an interactive Next.js tutorial.

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

Contribution

Feel free to fork this project and contribute to the source code! We are currently still in the process of setting up tests for all the features, and could use some help!

Resources

LNUrl Reference Specification
https://github.com/fiatjaf/lnurl-rfc

LNUrl Playground
https://lnurl.fiatjaf.com

LNUrl Decoder https://lnurl.fiatjaf.com/codec

Lightning Invoice Decoder
https://lightningdecoder.com

lightning-tip-jar's People

Contributors

austinkelsay avatar cmdruid avatar scottklein7 avatar sutt avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

catdogchick

lightning-tip-jar's Issues

Security concern of displaying the voltage url when tipping?

Displays the voltage node URL when a customer scans the code to tip:

  • is this ok from a security perspective?
  • is can we control this setting somehow in LNbits (if we wanted to?)
  • note that on withdraw, the wallet refers to vercel.app domain as the counterparty

image

Wallet support & documentation

It would be nice to have a running track of which wallets work for the site. I'll use this issue to keep a running tab as I work on trying different wallets.

This info could go in some docs on the site or on github or just in a markdown. This will help if we try to get real people to use it too.

Also we could note any peculiarities we find with a wallet, perhaps they implemented a certain spec in a different way than others?

WithdrawPage + UserWallet Interactions

  • Don't display withdraw qr code if balance < minWithdrawable (fig1)

  • Do we want to allow user's to withdraw in millisat units, or round to nearest sat? (see fig2)

  • Is there a better message on error we can pass to wallets? (see fig3)

Fig1 - this failed to go through and couldn't edit the sats lower
image

Fig2 - this is the prompt when you scan the withdraw qr. The millisats are due to previous routing fees incurred by this wallet.
image

Fig3 - generic 500, no context (but it's due to a exceed balance error)
image

"Jumpy" re-render on RecentTipsBox

The RecentTipsBox re-renders onWindowFocus causing a toggle between Loading [fig1] and Populated [fig2].

How can get a re-render to run only when there's more tips to be added?

Note: this effect can be exaggerated by setting the Network Tab to "Throttle to Slow 3g" [fig0]

Fig0
image

Fig1
image

Fig2
image

Issue withdrawing Sats

Is this project still active? I was testing tips and seems some of my SATs are stuck and I'm unable to withdraw them.

I keep getting this error, does it mean I must have more than 10 SATs to withdraw? I'm hesitant to transfer more to test out my theory.

Can anyone help?
image

Problema al iniciar sesión

No funciona iniciar sesión con la dirección Lightning. Cada vez entra en una cuenta nueva y no a la inicial.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.