Igor Bubelov About Blog Notes Photos

May 2022

Notes · May 31, 2022

Table of Contents

News App

It’s been more than three months since I released News v0.3.4, so I should probably publish a new release pretty soon. The next version will finally have smoothed out screen transitions, and I’m also planning to promote built-in standalone backend out of beta. I had some progress with minimizing external dependencies and making standalone parser more standards-compliant, but this is a long-running effort, and it’ll take many more releases to reach the desired results.

https://github.com/bubelov/news

BTC Map

This is my second open source Android app published on F-Droid. I wouldn’t say that the publishing process was smooth since some F-Droid maintainers are biased against Bitcoin, but the app is now published and everything seems to be fine. It feels good to be able to avoid Google Play and still reach a pretty large audience.

My initial plan was to use Overpass API as a backend, but it looks like Overpass usually needs a few minutes to return all bitcoin-accepting places.

There are two most obvious ways to solve this issue:

  1. Bundle the data with the app
  2. Set up a fast cache and place it between Android client and Overpass API

I ended up combining both of those options and adding some GitHub magic on top of that. Here is how it works:

  1. I’ve set up a public GitHub repository at: https://github.com/bubelov/btcmap-data
  2. This repository has query.txt and data.json in its root directory
  3. The sole purpose of query.txt is to explain what we need from Overpass API, namely:
[out:json][timeout:300];
(
    node["currency:XBT"="yes"];
    way["currency:XBT"="yes"];
    relation["currency:XBT"="yes"];
    node["currency:BTC"="yes"];
    way["currency:BTC"="yes"];
    relation["currency:BTC"="yes"];
    node["payment:bitcoin"="yes"];
    way["payment:bitcoin"="yes"];
    relation["payment:bitcoin"="yes"];
);
out meta geom;
  1. The latest Overpass response should be saved to data.json
  2. Here is how you can populate or update the data repository:
curl -X POST -d "@query.txt" -o data.json https://overpass-api.de/api/interpreter
  1. Regular updates can be done automatically with the help of GitHub Actions: https://github.com/bubelov/btcmap-data/blob/main/.github/workflows/refresh-data.yml
  2. Now we have a self-contained and self-updating repository which caches OSM responses and you can even use it as a backend
  3. I’d like to avoid making GitHub angry, so I’ve set up a Nginx caching proxy on btcmap.org which is supposed to take most of the traffic

This process is pretty simple, transparent and auditable. All you might need is a webserver and curl and both of those programs are available out of the box in most Linux distributions.

Energy Crisis (Part 1)

I finally noticed that not only the gasoline prices went up by a lot recently. I now pay almost $0.15 for kWh of electricity, which is $200 a month with my current level of energy consumption.

I got curious if I can bring power consumption down and how different devices contribute to the total bill. Air-cons were the main suspects, but it turned out that the main abuser is LED light. How is it possible when LED is advertised as a magical power-saving measure. Well, they aren’t that hungry, and they consume about 15W each, but there are 26 LEDs in my house, so it can easily add up to 390 kWh.

Next month, I’ll run a little experiment which consists mainly of using fans instead of air-cons and not leaving lights on when no one needs them. Will see how it plays out, but my rough calculations are promising:

Expected power consumption

If those numbers are more or less correct, I should expect more than a 5-fold decrease in energy expenses.

Energy Crisis (Part 2)

I remember doing some calculations to figure out the payback period on a solar system in Thailand:

Solar Panels in Thailand

Since the energy prices went up, the payback period has to go down, and it did. It turns out there are come upsides in “legacy” energy sources getting more expensive, it could accelerate our transition to renewable energy. The transition is imminent, and it can be done by the market forces alone, but cheap and widely available government-backed credit would help, I guess.

Lightning Network

It wouldn’t be an exaggeration to say that the success of Bitcoin depends on Lightning Network. This is a level 2 solution created to solve Bitcoin’s scaling issues, and it introduces quite a few clever but complicated concepts which you should understand in order to run a node.

I’ve been running Core Lightning lately, and I like it more than LND so far. Both of those implementations are under active development and not yet production-ready, but they are stable enough to run them and make or route real payments.

Another interesting development in the Lightning world is CLBOSS:

https://github.com/ZmnSCPxj/clboss

This plugin can take control of your Lightning node and manage it automatically. It can open or close channels as well as to keep the liquidity on both ends of each channel in balance. It also watches transaction fees and prefers to operate when fees are low. Watching how CLBOSS operates can also be a good learning experience if you want to understand how a useful LN node should operate.