September 12, 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 …

JCO: A Solution to Brewing ICO-palypse

Initial Coin Offerings (ICOs) have been under steadily increasing scrutiny by the US Securities and Exchange Commission (SEC), leaving many companies and would-be investors wondering if they should risk getting into the ICO craze or leave well enough alone.

In early December, the SEC even filed charges against PlexCorps, a company that had raised over $15 million by promising to deliver returns in excess of 1,354% percent over a one-month period. Later in the month, the SEC froze trading on a hot bitcoin stock, The Crypto Company, citing “concerns regarding the accuracy and adequacy of information.”

This has been the general gist of many of the SEC actions in regards to ICOs, sending shockwaves through the cryptocurrency investment world.

 “This space is on fire and everyone wants in, but all this uncertainty around ICOs is making investors nervous,” says Fintech entrepreneur and Finova Financial CEO Gregory Keough. “The ICO model was a good first iteration, but we saw that it was time to take it to a next-level approach that provides compliance while still delivering a type of crowdfunding opportunity.”

JCO Offers ICO 2.0 Alternative

With his attorneys at Cooley LLP, Keough has created what he describes as “ICO 2.0” – a next-gen hybrid of ICO and initial public offering (IPO) structured to comply with SEC regulations using the JOBS Act Regulation A+ to include non-certified investors in a pathway to the world’s first equity-linked token. He hopes his JOBS Crypto Offering (JCO) model will provide a new avenue for startups to raise capital from a larger pool of investors.

“The crypto-investment market is maturing very quickly,” says Keough. “With the SEC’s actions, we’re already moving past the sort of lawless new frontier mentality that was so exciting when bitcoin and ICOs first took off. Investors are looking for more secure ways to get into the crypto craze, and we are working with Cooley LLP to fill this market demand.”

Introduced in the U.S. in November, the JCO is a new crowdfunding mechanism using the blockchain and cryptocurrency to allow companies to raise capital more readily through cryptocurrency investments and an initial public offering of stock in compliance with the JOBS Act Regulation A+.

First Equity-Linked Token Offering

Finova’s own token will carry the unique attribute of being linked to a share of equity in Finova and will provide for an ERC-20 Ethereum token standard that can be traded in cryptocurrency and is also backed by assets in a U.S. corporation (the ERC-20 standard makes assets more easily interchangeable). Upon issuance of tokens, the token will have the ability to pay the dividend directly to the wallet registered to the individual.

The JCO is being launched to offer an investment opportunity in Finova Financial, a socially responsible provider of digital financial technologies with a stated mission of creating a more inclusive financial system and providing a path to financial health for the 2 billion people outside of the traditional financial system. Founded in 2015 by an executive team with a deep background in traditional banking, Finova is backed by more than $100M in capital, led by CoVenture.

At the moment, Finova is in the process of offering a Simple Agreement for Future Tokens (SAFT) in a presale to accredited investors that will act as the first step on the path to issuing SEC-regulated securities to non-accredited investors.

“Our goal was to create an investment model that democratizes access to capital as well as investment opportunities,” says Keough. “We worked with the community and our attorneys to design what we hope will be a model many can use to give early-stage companies access to the largest pool of capital possible.”

To learn more about JCO, visit: http://jco.finovafinancial.com

 

The post JCO: A Solution to Brewing ICO-palypse appeared first on NewsBTC.