btclnfrst - A Bitcoin Lightning Experiment

May 28, 2019


Bitcoin Lightning Forest (btclnfrst) is an experiment in accepting Bitcoin Lightning Network payments to plant trees in a virtual forest.

I was curious about the difficulty in setting up a Bitcoin Lightning Payment gateway, to learn about how Lightning Network (LN) functions, and what the challenges are.

If you are unfamiliar with the Lightning Network, it’s a “micropayments protocol that enables instant, low-cost Bitcoin transactions”.

You can find more information here:

How it works

btclnfrst runs on the Bitcoin TESTNET, which can be used to test Bitcoin (and Lightning) applications.

This app is similar in functionality to Starblocks, where you can buy pretend coffees using Lightning on TESTNET. However, in contrast to Starblocks, you can actually see the result of your “purchase” when you plant your trees in the shared virtual forest.

The workflow is straightforward and similar to any online shopping website:

Add items to your cart → Proceed to checkout → Make payment → Use your purchase.

Making the payment and seeing your trees being planted is the interesting part.

I have deployed my own Lightning node on a Digital Ocean droplet, and wrote a small server than uses RPC calls to the LN node to create payment requests and subscribe to payments (if there’s any interest in this I will can share it with pleasure).

If you are interested in setting up your own Lightning Node, I highly recommend this guide by Stadicus. It is for a Raspberry PI but can easily be adapted to another type of Linux Host.

Choosing your trees

I have implemented 4 types of trees with arbitrary prices in SAT (SAT = Satoshis, where 1 SAT = 1/100 000 000 BTC, or 100 000 000 SAT = 1 BTC). Lightning is for micropayments so SAT is a common unit:

Shopping cart


When you choose “Checkout”, it will take you to the payment page:

Shopping cart

What happens behind the scenes is that a “payment request” for a specific amount and destination is generated. In this case for 2850 SAT, and the destination is my Lightning node. This information is encoded in the payment request:


Once you have a payment request, there are two useful websites where you can send TESTNET Bitcoin using Lightning: or

The payment request can also include a memo. I have included the cart contents in the memo. If you use and click the “decode” button you can see the amount and memo:

Shopping cart

If you’re using another node and need to connect to my payment node as a peer or open a channel, the address is:


Payment & planting

My app will then subscribe to events on my Lightning node to wait for a payment. Once payment is received you can proceed to planting your trees:

This is a shared forest and it will show in real-time then other users plant trees:


The Lightning Network is a very interesting concept, with a lot of potential for small BTC payments. Bitcoin is just too slow and expensive to buy things like coffee.

Lightning requires you to create channels to other nodes and fund these channels (on the Bitcoin blockchain), so you must ensure you create channels to receive payments. This is known as inbound liquidity and there are way to obtain it, e.g. How to get Inbound Liquidity on LN.

Setting up your own LN node is not trivial and quite technical, as you need to set up a BTC node and an LN node. If popularity grows I expect to see more LN wallet providers to come to market, both for consumers and merchants.

Then there are alternative hybrid micropayments alternatives (e.g. SPEDN by Flexa) which might prove more popular with consumers and merchants.


The Lightning Network is still in its infancy, but has the potential to be the “cash” of Bitcoin (queue a flamewar 🔥).

I encourage you to try my app and also to experiment with LN - money can actually be fun.