BLOG -
Adoption stories
An interview with MoneyBadger’s CEO, Carel van Wyk, reveals the secrets behind their software.
Lightning wallet integration sounds complicated, but it doesn't have to be. A Blink developer solved it in approximately three lines of code. Here's the story behind the elegant solution that currently powers MoneyBadger's payment system.
Last month, Blink published the MoneyBadger story. We covered the company’s origin story in conjunction with retail giant Pick n Pay, their initial 2-app setup, and how MoneyBadger plugged into South Africa’s QR ecosystem. A piece was missing, though. How did Blink help MoneyBadger with Lightning wallet integration? We thought the explanation was too technical, but we were wrong.
In a recent Citadel Dispatch episode, Carel van Wyk, MoneyBadger’s CEO and founder, laid it all out clearly. Here’s the episode:
He and Odell covered everything we mentioned in our pioneering article, plus interesting new tangents, such as the project’s actual usage numbers and its replicability beyond South Africa, the country's tax context, Cash App’s design, and possible consumer friction at checkout.
The host admired that MoneyBadger is “meeting the merchants where they're at.” Carel van Wyk stated the company’s objective clearly: “The mission is to make Bitcoin money. In other words, medium of exchange would be what's important for us.”
However, for us, Lightning integration and the MoneyBadger + Blink connection were the highlights.
The first thing Carel van Wyk did was to clarify, “we don't provide the QR code to the retailer or to the shop.” This is how it works: “Typically, what happens is that with their existing infrastructure, they have a mechanism to generate a shop-specific or a merchant-specific QR code.”
First, MoneyBadger worked with Pick n Pay’s existing payment provider. “They manage the payment’s flow: from generating the code, providing the basket information, and then accepting the payment.” Once they figured that out, they did “the exact same thing with at least four other payment providers.”
The challenge, then, was “to bridge that non Lightning QR code to a Lightning invoice and ultimately to a Lightning wallet to complete the payment.” Lightning integration is easier said than done, because Lightning wallets didn’t want to introduce dependencies to their code. Their initial solution was creating “the MoneyBadger QR code scanner or the MoneyBadger app,” Carel van Wyk explains:
“That scanner can read a proprietary QR code from the merchant, and then it can generate a Lightning invoice, a BOLT 11 invoice, and then it can launch your preferred Lightning wallet.”
And thus, Lightning integration through a 2-app setup was born. However…
The 2-app setup solved a problem, but people wanted something simpler. The users demanded Lightning wallet integration. This is the question the MoneyBadger team was facing: “is it possible to scan and pay with a generic lighting wallet at the proprietary merchant QR code?”
MoneyBadger wasn’t in the business of creating its own Lightning wallet; what they were looking for was interoperability. This is where Blink and its developers come in to deliver Lightning integration.
“We went to Blink as one of these very popular wallets in South Africa and we said, guys, what if we provided an API so that the Blink wallet can do the same thing as the Money Badger translating app?”
The idea was to “build the translation feature straight into Blink,” so that the wallet could “scan a Pick n Pay or other merchant QR code and retrieve the Lightning invoice without this secondary app.” That is, Lightning integration between the wallet and MoneyBadger the service, not the app. At first, Blink wasn’t interested, because it meant adding “this regional dependency to a global wallet code base.” However:
“Blink wallet developers came up with a clever solution that avoids third party APIs entirely. They said, well, if we use Lightning addresses in a clever way, then we can use open source specifications, open source protocols.”
How is that possible? Well, we’re glad you asked.
It’s controversial, but it works. At first, even Carel van Wyk was skeptical. “When they explained this to me, I thought, I don't know if that's going to work. But we did a proof of concept, we implemented it, and it turned out that it actually works really well.” Lightning wallet integration accomplished, goodbye to the 2-app setup. South Africans could now scan with Blink and pay directly at Pick n Pay.
This is how it works:
The “controversial change” is that the wallet “needs to do a pattern match on the QR code. It needs to look at the QR code data and know that this is a QR code for a merchant that MoneyBadger supports.”
Once the wallet identifies a Pick n Pay QR code, “It can use the QR code data as the user portion of the Lightning address, and then, obviously, the server portion would be MoneyBadger.
So with the simple pattern recognition and a match, you can craft a special lighting address.” This address is dynamic and single-use for that QR code specifically. “And then, it can retrieve the BOLT 11 from the MoneyBadger server.”
This solution’s most important characteristic is that it accomplishes Lightning integration without third-party APIs. It uses “existing open standards to retrieve BOLT 11 invoices for proprietary QR codes.”
Some developers think it’s “crazy,” “too hacky,” or that it stretches “the definitions of what the spec says.” However, the impact on the wallet is minimal, and it works. The solution consists of “maybe like three lines of code.”
These are the three lines:
import {
convertMerchantQRToLightningAddress,
merchants,
strictUriEncode,
} from "./merchants"
It’s not perfect, though. To accomplish Lightning integration, it introduces “centralized service provider dependency in the flow of the QR scanner, but it's so light and minimal that if we were to disappear tomorrow, it would have no impact on anyone.To remove that code would be very, very simple change.”
The coolest characteristic of MoneyBadger and Blink’s Lightning integration is that it’s open-source and permissionless innovation. Other wallets can simply integrate the solution, become interoperable, and presumably increase their customer base in South Africa in one sweep. They don’t even have to talk to MoneyBadger or Blink.
In 2024, someone asked how to add it to Aqua, and Blink’s own Dolcalmi answered: “It is pretty easy, just need to add a small change to the QR reader to detect/convert PicknPay QR content to a ln address,” and then linked to the solution’s GitHub page.
It worked, because Aqua is part of this list of wallets that anybody can use to pay for almost everything in South Africa. So far, Blitz, Machankura, Breez, Layerz, and Aqua have implemented the solution. The other wallets on the list have not integrated it yet, so users will need to install the MoneyBadger App to scan the QR codes.
What is your wallet of choice waiting for to join the Lightning integration party? South Africa is waiting for them.
On to the Bitcoin as a medium of exchange topic, MoneyBadger’s CEO Carel van Wyk has a message for non-believers: “If you are not spending Bitcoin, then you're actually short Bitcoin because it means that you have fiat to spend.”
Taking it down a notch, he asks: “How deeply do you actually believe in Bitcoin as money for freedom?” Not everyone sees it that way, and that’s ok, but, “If it's something that you actually care about, (...) consider the effort of spending Bitcoin, because what you're doing then is you're creating demand for acceptance. If nobody's spending it, there's no demand for acceptance, and the circle doesn't grow.”
We have to show the world that accepting Bitcoin is good for business. “If one merchant realizes, you know, I'm tapping into a unique market here, then the others will follow. That's the only way to grow it.” We have only one shot at this, and the time is now. “If we don't spend it today, if we don't create that market of Bitcoin spenders and that demand today, it might not be possible to create in the future.”
In conclusion, Bitcoin is money. Use it or lose it.
Start receiving and sending bitcoin now