Bitcoin Lightning Network #2: We must first become the Lightning Network
Lightning Network payments are routed through nodes to optimize for cost and reliability. Will payments route through super-connected “hubs”? Will they collect and share your information with the government? Andreas finds out.
In the first part of my Lightning Network review I compiled and ran the Lightning Network Daemon, lnd. Today I’ll add more funds to my node and see how many channels I can open. Will payments routed through my node make me money?
TL;DR: Maintaining a Lightning Network payment hub is stressful and makes very little profit. Hopefully the risk will decrease and profit increase as the Lightning Network gains traffic.
I have split this review of the Bitcoin Lightning Network into multiple parts for better readability. Subscribe to the newsletter and I’ll tell you when I publish the next part.
Parts of the review
- Compiling and running a node
- Becoming a hub
- Paying for services
- Shopping for goods
- Final thoughts
(De)centralization
Visual representations of the Lightning Network are often posted online. They sometimes show the network as being highly decentralized/homogenous. Other times the network appears to be centralized around a few super-connected nodes referred to as hubs.
Critics of the Lightning Network believe that:
- All payments will route through a few hubs
- Hubs will act like banks, collecting passports and utility bills for KYC
- Hubs must apply for money transmission licenses
Proponents of the Lightning Network offer a much brighter picture:
- Lightning Network will improve decentralization by giving less power to mining cartels
- Privacy/fungibility will improve through the use of multi-hop payment channels and the Tor network
King of the Nodes
When I started writing the review the total capacity of the Lightning Network was slightly over 20 BTC (around $130,000). I decide to shake things up.
The deposits to my node have confirmed. I set up a terminal window on the lnd
node with four panes. Each pane polls my node for stats.
Bitcoin amounts are displayed in satoshis. To convert from satoshis/sats to bitcoin, I divide the number by 100 million or 10⁸.
The top-left pane shows the output of lncli walletbalance
. This tells me how much on-chain bitcoin is held in the node. The unconfirmed_balance
shows how many bitcoin are in yet-to-be-mined transactions. I guess these transactions are from opening and closing Lightning Network payment channels.
The top-right pane shows the output of the lncli channelbalance
command. This shows the total capacity of all my open channels, balance
. The pending_open_balance
number shows how much bitcoin is being used to establish channels.
The bottom-right pane shows the output of the lncli getinfo
command. I pay attention to the num_pending_channels
and num_active_channels
. These are the numbers I want to go up.
I struggle to get a sense of what lnd
is doing. There is always a large amount of unconfirmed bitcoin. lnd
could be using a low on-chain fee setting and taking long to confirm.
I look up some recent transactions in a block explorer.
The Bitcoin network fees are quite low and yet the transaction confirmed quickly. I may need to wait for more channels to close so that I have more unspent outputs.
I edit the lnd
config to demand higher fees for routing transactions and allow more channels to be open. lnd
is currently using all my system resources. I don’t mind restarting it.
The settings are difficult to understand. I increase the bitcoin.basefee
and bitcoin.feerate
values until other nodes stop opening channels with me.
I set the values for bitcoin.basefee
and bitcoin.feerate
to 100 times the defaults and restart lnd
.
While I wait to see how the new settings affect my Lightning Network node, I verify my node with robtex.com. I discover that lnd.shitcoin.com
is the world’s leading Lightning Network node!
Mixed reactions
Reactions to my experiment on social media are mixed. The increase in capacity of the Lightning Network is celebrated by some.
Others voice their concern.
Performance
My Lightning Network node has established over 200 payment channels with 250 peers. The node capacity is exceeding 40 bitcoin.
The num_pending_channels
remains the same for several hours. I worry that my node has crashed. I restart lnd
.
I freak out.
The num_active_channels
is zero. Many lncli
commands fail to execute with a timeout errors. I hope lnd
is restoring and verifying its internal database.
After 20 minutes the normal channel stats are back. Is this because of all my channels?
I consult my friend Felix Weis. He recommends disabling ZeroMQ notifications from bitcoind
about new transactions. lnd
should be able to scan through these transactions once they’re included in a block.
I change the autopilot.minchansize
and autopilot.maxchansize
settings of lnd
to the hard-coded maximum channel size of the Lightning Network, 16777215
satoshis (0.16777215 bitcoin). This should lead to fewer, but higher value payment channels.
I notice a performance improvement. lnd
is eating less CPU.
Payment hub profitability
I don’t expect to make much profit from other users routing payments through my node. Lightning Network on the Bitcoin mainnet is new. There aren’t yet many services/merchants accepting Lightning Network payments.
I wonder how much I’ve currently profited from routing payments. I try the lncli feereport
command.
$ lncli feereport | tail
"channel_point": "deebb505608db2b06413b6cff3c41ec03197f2163f4d574d5a5aa6e5cd2670c3:0",
"base_fee_msat": "998",
"fee_per_mil": "1",
"fee_rate": 0.000001
}
],
"day_fee_sum": "1109",
"week_fee_sum": "4204",
"month_fee_sum": "4289"
}
The month_fee_sum
comes to 4289
satoshis, or 0.00004289 bitcoin ($0.31). I also wonder how any payments have been routed.
I write a small script using awk
that summarizes the output of lncli fwdinghistory
. The command syntax is difficult to get right. I ask on the Lightning Network Slack chat and eventually figure it out.
$ lncli fwdinghistory --max_events 100000 --start_time=1 --end_time=1541624604 | awk -F\" '/fee/ { n++; x+=$4/1e8*7350 } END { printf "Routed %s, making $%s USD\n",n,x }'Routed 260, making $0.312963 USD
The node has routed 260 payments for other users, averaging a profit of $0.0012 USD per transaction. I doubt that this will cover the costs of running the node, but leave the node running for now.
Maintaining a Lightning Network payment hub is stressful and makes very little profit. Hopefully the risk will decrease and profit increase as the Lightning Network gains traffic.
In part three I’ll try to put my Lightning Network node to use and start paying for services. Maybe I’ll even do some gambling. Subscribe to the newsletter below to find out.
See you back here for part three, blockchainers!
About The Author
Andreas Brekken is the CEO of Shitcoin.com and has been obsessed with cryptocurrency since 2011. He was the CTO/co-founder of Justcoin.com and later worked as an engineer with Kraken.com.
Follow me on Medium and Twitter for more reviews.