Inspiration

As a big believer in bitcoin I've been super-excited by the developments in the Lightning Network layer 2 scaling solution. It takes bitcoin's relatively slow, cumbersome, expensive network and turns it into a payment system that is potentially on par with bank credit cards.

I wanted to learn more about the Lightning Network but even after I installed and funded a wallet, there just wasn't much I could do with it. I wasn't really looking to use it to just convert it back to fiat to buy gift cards. Meh.

And I learn best when I'm building a project of my own. I need to be hands-on. So after a few brainstorming sessions with friends, I came up with the idea to build a super-simple arcade game for the web that would be pay-to-play at an absurdly cheap rate--100 satoshis (about 1 cent). And by "super-simple" I was thinking 8-bit gaming or even Tetris level graphics since this was going to be a passion project that I'd build in my free time. And the point wasn't to spend enormous time on graphics; anyone can do that. The point was to build a working Lightning Node Lapp.

The a-ha moment for the game came when I realized that Lightning Network invoices (QR codes) looked like mazes. Then the pieces quickly started falling into place from there. Friends have likened it to a bit like Pac-Man but with our own twists on the gameplay. And it's just tons of fun to see 8-bit stacks of bitcoin just waiting to be saved, all why fleeing from the evil fiat that's chasing us!

What it does

EscapeQR is a fun web-based arcade game that uses the Lightning Network in a pay-to-play model. Just like an old-school arcade cabinet, but instead of dropping quarters into a machine, you complete a microtransaction on the Lightning Network. It's meant to be a demonstration of how simple, how fast, and how amazing the Lightning Network is. The hope is to encourage more people to install Lightning Network wallets and learn how it works by playing EscapeQR with super low-stakes transactions.

To that end we're building onboarding resources to help people learn about Lightning and set up their first Lightning wallet. We're even funding their wallets with some free sats via our Lightning faucet!

How I built it

The game is completely written in Javascript, compiled and optimized via webpack and NodeJS. Since I wanted it to be a web-based arcade game, there really wasn't any other option. I had to learn how to spin up my own bitcoin and Lightning Network node. I used the excellent btcpayserver, hosted on a LunaNode VPS.

The backend is built in python/django. Its main job is to manage API requests to my Lightning Network node (create invoice, get invoice status). The server layer also saves high scores. It's running serverless on AWS Lambda to save costs and talks to an RDS Postgres database. Static assets are on S3.

The final piece was blockstack and twitter sign-in integration. Players can always opt to skip sign-in and play anonymously, but if they do sign in, they'll have access to a record of their personal best high scores. We also plan on running some social media promotions ("Highest score this month wins...") that will only be available to players who sign in.

Challenges I ran into

Experimenting with the Lightning Network node and setting up payment channels wasn't easy and still isn't perfected. I was able to make sure that most of the major custodial Lightning Network wallets would be able to find a payment channel to my node and that there'll be at least some liquidity there to work with.

Accomplishments that I'm proud of

The whole dang thing, honestly! The game is simple but the feedback has been great and people are enjoying the game mechanics. The simple 8-bit bitcoin logo is just cool. I had them printed up as stickers and handed them out at the Bitcoin 2019 Conference and they were definitely a hit!

The majority of my projects are in python so this was a really heavy Javascript lift for me. But I'm such a better programmer now than I was when I was first learning Javascript years ago that it all went shockingly smoothly. I organized the project classes really well and isolated the various bits of functionality (e.g. the Renderer class was the only one that knew anything about the pixels on the screen; the GameManager class, well, you can guess; etc. etc.). Because of that structure it was incredibly easy to add new game mechanics and new features without creating a tangle of spaghetti code (which is generally what I think of when it comes to JS).

And it was really cool to get to present the project on the Crypto Bit Bus which took various crypto influencers from LA up to SF for Bitcoin 2019. Even though that crew is super-deep in the bitcoin/crypto community, most of them had never made a Lightning Network transaction before. It was great to guide these people that I follow daily on twitter and YouTube and teach them a bit about such a cool, important new piece of the bitcoin ecosystem.

What I learned

The Lightning Network is really impressive. I like playing EscapeQR on my laptop but doing the Lightning payment through my phone. That way I can see the speed from the phone click to the game reacting--usually in less than one second. There's something almost magical to see one device trigger an action on another like that.

The custodial Lightning Network wallets all pretty much work as expected and weren't any harder to use than any other typical crypto wallet. The non-custodial wallets... yeesh. Channel management. Liquidity management. Way too hard for all but the most hard core power users.

The vendors' side is definitely a challenge. It's just too difficult to get a Lightning Network node configured with decent payment channels that have any incoming liquidity. Late in the process I came across OpenNode which seems to be a much better option for vendors. No, you don't have full control of the funds going through OpenNode, but they've made it so easy to create a new account and your business can immediately start receiving Lightning Network transactions. I swapped EscapeQR over to OpenNode and (aside from some documentation shortcomings) have been thrilled with the change.

What's next for EscapeQR

More behind-the-scenes code improvements, deeper signed-in user experience, UI refinements, social media promo campaign to launch some competitions to drum up usage.

If there's time (and energy and brainpower), I'd also love to do an integration with one of my other projects: WAXBadges. It's an open platform for an eternal achievements system that lives on the WAX blockchain. For example, I could create a "Survivor" achievement for making it to Level 10 in EscapeQR. Once you unlock it, the server would call my WAXBadges smart contract and grant the signed-in user that achievement. That data would then persist publicly forever as long as WAX's mainnet is operational. I also built a WAXBadges Achievements Explorer (explorer.waxbadges.com) so users can see their achievement and share them out to social media. Would be fun to do a hype campaign for new EscapeQR achievements and cross-promote it via the @WAXBadges account to bring both of my small communities together.

Built With

Share this project:
×

Updates

kdmukai Mukai posted an update

We now have a free Lightning faucet!

We launched it just in time for the "Bitcoin Is _" conference in LA! EscapeQR now has a full education path to help newcomers learn more about the Lightning Network, guide them to install one of our recommended LN wallets, and then hit our faucet to fund their new wallet with some free sats so they can make their first microtransactions!

We were eager to share the news at the conference and hand out our awesome 8-bit bitcoin stickers! Got to talk up EscapeQR with Jimmy Song, Olaoluwa “roasbeef” Osuntokun from Lightning Labs, Alex Gladstein (co-author of "The Little Bitcoin Book"), Jeremy Welch (founder & CEO of Casa), one half of the amazing Cyber Code Twins, and event host Russell Okung (LA Chargers left tackle and mega bitcoin evangelist!).

The faucet is only 500 sats, but that's enough to play EscapeQR's pay-to-play layer five times. We're in talks to set up a faucet sponsor so we can offer a bigger amount and/or more frequently.

Log in or sign up for Devpost to join the conversation.

kdmukai Mukai posted an update

Added a free-to-play layer so people can try it out without having the Lightning invoice step be a hard roadblock.

Twitter sign-in now also supported.

Migrated away from my Lightning node to invoicing via OpenNode's API for basically guaranteed solid payment routing and liquidity. I think it totally makes sense to opt for a more custodial solution in exchange for payment channels that are managed way better than I can do on my own.

Log in or sign up for Devpost to join the conversation.