Less noise, more data. Get the biggest data report on software developer careers in South Africa.

Dev Report mobile

Buying Electricity with Bitcoin: The “LightningWatts” Proof of Concept

5 April 2022, by Shannagh Hare

Luno co-founder Carel van Wyk built a passion project that takes Bitcoin closer to the holy grail of peer-to-peer payments. His newly launched app LightningWatts enables users to buy electricity with Bitcoin.

Buying Electricity with Bitcoin, the “LightningWatts” Proof of Concept

Champions of Bitcoin often tout the leading cryptocurrency as digital energy, which is why it’s so fitting that Carel is busy with a new project that allows users to buy electricity using their Bitcoin. Mining Bitcoin requires electricity, Carel says, “LightningWatts does the opposite.”

The alpha version of LightningWatts was launched in October last year and uses the Lightning network as a payment rail to bridge the challenges that come with scaling Bitcoin transactions.

Bitcoin concepts

  • Sats is to Bitcoin what cents are to rands
  • Fiat money is currency issued by a central bank, which we use to pay our taxes and to transact with
  • Hodling is a jocular term referring to investors holding onto their Bitcoin regardless of what the market is doing. Hodl has also come to mean “hold on for dear life”

Why use Lightning?

The Lightning network was created to chip away at the blockchain trilemma that burdens every decentralised cryptocurrency. Every blockchain aspires to be decentralised, secure and scalable, but supporting one or two of these attributes is generally done at the expense of another.

The Lightning network is a “layer-2 network” built on top of Bitcoin that signs transactions and updates channel balances instead of recording it on the blockchain, as is the case on the Bitcoin network, using a hash time-lock contract (HTLC). In this way, the network sidesteps the high fees and lag associated with Bitcoin transactions.

In practice, this means that LightningWatts users with a Lightning network wallet installed on their phone can almost instantly buy electricity using Bitcoin. But here’s the burning question: Why would any sane hodlr spend precious, finite sats on a resource that dissipates in a flash? Well, if you continue stacking sats, one day your fiat balance will be replaced entirely by Bitcoin, which means that your coins will eventually be used to buy things. “This proof of concept will hopefully one day help you to deconvert yourself,” Carel explains in the FAQ section on the LightningWatts app.

Carel’s Crypto Convert project: The Hold invoice mechanism

LightningWatts is part of Carel’s bigger Crypto Convert project. “The app is related to the problem of Bitcoin payments,” he says. Essentially, it’s a proof of concept for the Hold invoice mechanism built into the Lightning network.

“The gold standard for Bitcoin payments is walking into a coffee shop and being able to buy a coffee,” says Carel. “It’s a small payment that needs to happen quickly, and it must be reliable. In the past, this wasn’t easily achievable,” he notes.

There are a few key challenges to achieving this gold standard on the Bitcoin network, most of which revolve around the long time it takes to verify a transaction. To overcome this, merchants can choose to accept zero-confirmation transactions, but this opens up the risk of double spending. In other words, a sender can send the same Bitcoin to two recipients, but this would usually be picked up by the network resulting in only one transaction being validated. By accepting an unconfirmed transaction, merchants run the risk of accepting the digital version of counterfeit money. There are other problems, too.

There’s no way for the receiver to control the amount being paid to their public Bitcoin address. “The receiver has very little control over the amount that is sent or the time it takes to send the transaction. I can provide you with the address now and you can pay me tomorrow, even next week,” Carel says. “In a nutshell, the problem with Bitcoin payments is that the sender can easily send too little, too much, or too late,” he explains.

A Hold invoice solves these problems by enabling the sender to accept or reject invoices, or let them simply time out. Merchants decide the expiry window of the invoice. Think of a hold invoice as a delayed settlement mechanism that gives a merchant the power to accept or reject payments based on a set of parameters. It ensures that the Bitcoin transaction is valid and matches the goods delivered. As Trey Griffith’s, founder of Sparkswap, explains in a presentation on Hold invoice applications, it’s the most effective version of a delivery-versus- payment system in the world today.

Using a Hold invoice, merchants can provide instant refunds to clients without having to deal with varying fees on the blockchain. Imagine an online retailer accepts a BTC payment for a product before realising the product is out of stock. They would have to refund the money, leading to transaction fees on the blockchain. A Hold invoice gives the retailer the opportunity to check their stock and confirm if they can fulfil their end of the transaction.

How LightningWatts works

Users visit the LightningWatts web app, punch in their electricity meter number and decide on an amount between R25 and R1000. They then choose “Get payment details” which generates a Lightning network invoice that’s like a complex QR code. The user then uses their Lightning network wallet like Muun to scan the QR code, which is valid for 15 minutes. The transaction is finalised the second a user sends the funds, after which an electricity voucher is generated. If the system fails to generate a voucher because the meter is unsupported, the Lightning transaction is invalidated and the user’s Bitcoin is returned to their wallet.

LightningWatts Tech stack

Carel used the following tech stack to build LightningWatts:

  • Go - “I like working with Go, especially for concurrent stuff”
  • Vue - “A very nice front-end framework”
  • Sqlite - “Because I’m lazy and didn’t want to spend the time spinning up a Docker instance on MySQL”
  • AWS on an EC2 instance
  • Bitcoin and Lightning network

Investec Programmable banking for business

Other features such as the Investec Transfer API are in the staging process. The Transfer API would enable a company like LightningWatts to manage cash flow within different accounts. By using this Transfer API, you set up limits that, once reached, funds will be automatically transferred.

What’s next?

“Right now, LightningWatts is more like a business card,” Carel says. “It’s like, hey, I’ve built this technology. It’s working. It’s really cool. I’ll use this as a demo or a proof of concept to show how well it can work for any merchant integration.”

Next up for LightningWatts is launching a public beta, after which Carel aims to pitch the Lightning network and Bitcoin payment system to payments providers. The plan is to partner with a payments provider and help onboard their merchants onto the Lightning network. “They can decide whether to hold the Bitcoin or I’ll convert it for them into Rands,” he says.


Get involved in the Programmable Banking Community.

If you have questions or just want to say hi to the Programmable Banking Community core team, you can pop us a mail, and we will get back to you.

If you want to see more from what the community has been up to, you can:

offerzen_investec_Developer_Finance_Guide_Banner_for_Blog_posts-7

Recent posts

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.