March 23, 2026

Capitalizations Index – B ∞/21M

How to build a simple LAPP(lightning-app) using BTCPay/c-lightning/lightning-charge

How to build a simple lapp(lightning-app) using btcpay/c-lightning/lightning-charge

How to build a simple LAPP(lightning-app) using BTCPay/c-lightning/lightning-charge

How to build a simple lapp(lightning-app) using btcpay/c-lightning/lightning-charge

Now with your BTCPay server setup and configured, you’ll want to make sure that you configured your Lightning implementation correctly, if you’re confused check the official btcpay docs.

In the services section you want to make sure that c-lightning charge-server appears.

Now let’s move on to our web application. Let’s make a directory to hold our application, then create an express backend using express generator and a react front-end using react-create-app. If you have your own methods, ignore this.

Next, we’ll install the required npm packages.

Now, we’ll set up our lightning-charge-client. In this step you’ll need to grab the credentials from your btcpay server. You’ll access this in server settings → services → C-Lightning (Charge server) → see information.

In our back-end we’ll set up lightning-charge-client using credentials from above, like this

// Initialize the client
const ChargeClient = require(“lightning-charge-client”);
// new is optional
const ln_charge = new ChargeClient(
“https://btcpay.myawesomedomain.com",
“mysupersecretkey”
);

For this basic example, we’ll create 2 simple routes. 1 route will create an Invoice, the other will wait until that invoice is payed. I’ve kept them simple, but you can imaging passing data into the Invoice and adjusting the satoshis based on your lApps need.

The first back-end route will simply call lightning-charge-client to create an invoice with given parameters

router.post(“/createInvoice”, async (req, res, next) => );
return res.json();
});

The second back-end route will wait until that invoice is payed and eventually return a payload

router.get(“/fetchInvoice/:id/wait”, async (req, res, next) => );
else if (paid === false)
console.log(“invoice expired and can no longer be paid”);
else if (paid === null)
console.log(“timeout reached without payment”);
} while (paid === null);
});

I hope that you’re already thinking about the possibilities!

Now in our front end, we’re going to make a button that when clicked will request an invoice from our back-end, pass the invoice payload into a QR code, display a popup, and lastly wait until invoice is paid.

Here we request an invoice from our back-end then render a modal, you can imagine sending data in the post and creating a custom-invoice as per your needs.

Note: using react-hooks

First, let’s make a button that when clicked requests our back-end to create a lightning invoice

async function onButtonClick() 

Then we’ll pass the invoice data over to a QR

async function loadQr(BOLT11) );
setQrCode(qrCode);
}

Lastly, wait until that invoice is paid in full, and return some action to user.

async function waitForPayment(invoiceId) /wait`
);
return payment ? paymentSuccess() : waitForPayment(invoiceId);
}

That’s all! You’ve just built a basic lightning-app using BTCPay/c-lightning/lightning-charge. PLEASE keep in mind I kept this simple for demonstration purposes only. I hope you enjoyed reading!

Here’s the finished product!

Full code is posted on Github here → https://github.com/thedon-chris/quick-lncharge-app

Twitter: https://twitter.com/Thedon_chris

Github: https://github.com/thedon-chris

Published at Sat, 30 Mar 2019 01:16:07 +0000

Previous Article

Crypto Bear Market Provides Opportunity For Major Corps, As CP Group Acquires Omise

Next Article

Is bitcoin breaking out?

You might be interested in …

10 VPN Services Providers That Accept Bitcoin

Bitcoinist has compiled a list of ten VPN providers that will gladly offer you their services for your bitcoin


Why VPN?

One of the primary reasons for purchasing a VPN service is to keep your online activity private. It is ironic, then, that some still choose to buy their VPN service via a payment method tantamount to a suitcase filled with marked bills and a transponder — which, if you’ve ever seen No Country for Old Men, you’ll know is a very bad idea.

The most commonly used online payment methods, PayPal and credit cards, are among the easiest to trace, funneling out buyer information to tax entities, third-party processors, and enormous — as well as enormously connected — financial institutions. As if this weren’t bad enough, PayPal and credit cards also charge steep transaction fees that drain revenues from VPN providers, making them dependent on income that can, at the whim of the banks and legislation, vanish without a trace — unlike the information they will keep on you.

networking

Looking for privacy along the entire transaction many consumers now opt for anonymous payment methods like bitcoin to purchase VPN services. With bitcoin, as long as you employ the full range of the system’s features — like secure wallets and aliases — your transactions will not identify you.

Also, since bitcoin is a decentralized payment method, no corporation, government, or financial institution can shut it down. Lastly, bitcoin is fast, cheap, and safe: Its transactions wait on no clearing times, its transaction fees are often far lower than those of a standard credit card, and it provides excellent fraud protection.

Because of this, several prominent VPN providers now accept bitcoin payments (while some no longer accept credit card payments at all). Since the differences between these providers can be a bit nuanced, however, a third-party VPN site can help you in figuring out which VPN is the best fit for you.

Top 10 bitcoin-Friendly VPN Services

TorGuard

With more than 1250 servers in over 42 countries, TorGuard ranks highly among the elite VPN providers. It even works in countries where VPN protocols are government-filtered, such as Iran, China, Syria, and the UAE. However, there is no trial software and some consider the website a little confusing to navigate.

Private Internet Access

This VPN service is known for its minimalist efficiency. Ad-blocking, one-click activation, and fast performance are among its highlights, though a few users find its spare design off-putting.

IPVanish VPN

Solid speeds, a straightforward interface, and automatic IP address cycling are a few perks of IPVanish. It is spendier than some other VPNs, however, and though its interface is user-friendly, visually it leaves something to be desired.

ExpressVPN

Express VPN

Netflix, BitTorrent, and P2P are all accessible with the highly versatile Express VPN. Though international downloads are fast, in general this VPN tends to be on the slower side. Also, like IPVanish, it is expensive.

VPNArea

Registered in Bulgaria, hosted in Switzerland, and operating in 54 countries (including Saudi Arabia, South Africa, and Russia), VPNArea provides unlimited bandwidth and a kill switch system. VPNArea has been accused, however, of poor customer service and slow speeds in the more out-of-the-way countries.

Air VPN

No logs, port forwarding, and a stable connection make Air VPN a favorite among those wishing to protect their anonymity. Among its cons: It does not offer an abundance of server locations, and using the service can sometimes necessitate an advanced knowledge of VPN configuration.

IronSocket

This service is direct and easy to understand, and its users love the ability to download customized open VPN settings. Even so, some reviewers have cited its lack of special features (like a kill switch and DNS leak protection) as deal breakers.

Anonine

This VPN boasts IP shuffling, no restrictions, and a no-logging policy. Even so, its customer service has left a few users feeling less than satisfied.

BlockCDN

SaferVPN

With a dedicated Chrome extension for added security, SaferVPN delivers a reliable performance and welcoming interface. On the downside, it does keep logs and requires additional payment to get more connections.

ShadeYou

ShadeYou is simple to use, allows five simultaneous connections, and its Dutch registration source guarantees maximum privacy by law. Some users have criticized small defects in its webpage, though, as well as occasionally slow speeds.

These are 10 good VPN providers that accept bitcoin, there are probably more as there are dozens of VPN companies out there, but these will all do the job for you. If you want to dive into the details of each we do recommend visiting a third party comparison site for real in-depth analysis.

Have you paid for VPN services in bitcoin? Share your experience below!


Images courtesy of Shutterstock, ExpressVPN

The post 10 VPN Services Providers That Accept Bitcoin appeared first on Bitcoinist.com.

WHAT IS NGS COIN? – NEW GENERATION SECURITY –

WHAT IS NGS COIN? – NEW GENERATION SECURITY – NGS Coin is a platform for the future of funding that is built on top of the Ethereum blockchain. It accelerates growth of start-up companies by […]