Study & contribute to bitcoin and lightning open source
Interactive AI chat to learn about bitcoin technology and its history
Technical bitcoin search engine
Daily summary of key bitcoin tech development discussions and updates
Engaging bitcoin dev intro for coders using technical texts and code challenges
Review technical bitcoin transcripts and earn sats
Slides: https://www.dropbox.com/s/oo9o8ij62utvlfo/alex-bosworth-lightning-routing.pdf
Transcript of presentation on Channel Management (2018): https://btctranscripts.com/chaincode-labs/chaincode-residency/2018-10-22-alex-bosworth-channel-management/
With Lightning routing I think it is a very exciting topic because we’re doing something that no one has ever really done before, to build this peer-to-peer marketplace. It is a required component of the Lightning Network because the Lightning Network is dependent on this concept of liquidity. Capital needs to be placed in the right places, it is not a purely technical problem, it is also an economics problem. There are a bunch of different things that go into that. There are things that you’re trading. It is not just that you have to operate the routing node, you have operational costs, you have to run the hardware, buy the hardware but you also have to provide this Bitcoin which is a scarce resource. You can’t provide it everywhere, there’s even a cost to putting it on things. Then there’s also the question of where do you put it. There’s the data component.
If we have this analogy of paying other people to run services, this is already something that exists in the world, it is called the Cloud. You pay Dropbox or Amazon Web Services or Google Cloud, you pay them money and they’ll run things for you. What you’re really doing is you’re paying someone else to run a server for you. I would say Lightning is similar, routing nodes are similar to the cloud, other people are paying you to operate things but it is more like a storm. You are paying to lots of different people. It is not like you’re developing a single relationship with a single person. You are entering into this vibrant marketplace. This situation where you pay somebody else for their stuff, it works best when you need them. In the normal situation of the cloud, if you can just buy a hard drive and backup your hard drive maybe you don’t need Dropbox. But if you want this thing that works on all your computers and you don’t want to buy a hard drive maybe you do need Dropbox. The same principle is present with Lightning. You need other people in order to translate your payments across the globe, you need them. That’s why we have this marketplace in the first place. People ask me how do I run a routing node? The thing is there isn’t just one way to run a routing node. There are many different ways to run routing nodes. There are different types of problems that you are solving for people when you are operating a routing node.
I’ll start with the simplest version of a routing node which is kind of like the platonic ideal of a routing node. You have a node where you get a payment on one side, it goes out the other side, that’s what you’re doing when you’re routing, you’re reducing the inbound liquidity of one channel and you’re increasing the inbound liquidity of another channel. It really works best for you if payments just go one way and then they go the other way. They go back and they go forth. That’s the ping pong model of routing nodes. Once you have that you don’t really need a lot of capital, you don’t need a lot of data, you just need operational costs. That is something that can run on your Raspberry Pi. You just have a payment that goes one way and then it goes the other way. The thing to think about is wishing it was so easy to run a routing node, it not require any effort and I wish it didn’t require any capital. If those wishes did come true, because of the marketplace that would mean you wouldn’t earn anything. Everybody could compete. If you have this scenario where payments go back and forth perfectly it all boils down to operational cost. Operational cost is pretty low, you can run it on a Raspberry Pi. You are not going to make a lot in fees because maybe some people just want to do routing for the fun of it, they don’t care about fees. So that is a race to the bottom there. This is good for the payer but it is not good for you if you want to operate a routing node and make fees. The way you would get to this type of a node if you want to run this type of node, you want to avoid peering with nodes where the traffic isn’t bidirectional. A lot of nodes you can connect to in the network, they are just receiving traffic. A merchant is a good example. A lot of time a merchant is going to be receiving, receiving, receiving and not doing too much spending. Traffic is just going to go one way. You are not going to get that ping pong. It is even worse because once your liquidity drains out to that peer and it doesn’t come back you can no longer ping pong with other peers that are ping ponging. You don’t have any inbound anymore. The drain is bad, after a while it stops working by itself. But it is also bad because potentially it stops all your other channels from working. That’s what you want to do if you want to run a ping pong node, it is almost like you don’t want to do anything. You want to avoid situations where it is going to break your bidirectionality.
Another type of node that you can run is like a liquidity battery. The thing about traffic in the real world is that it isn’t just people ping ponging payments to each other. It isn’t paying to a merchant and then the merchant paying back instantly. There is a time delay. Maybe the merchant is using Lightning Loop or something and every month or every weekend they are pushing all the capital back out. But there is a time gap. Maybe you are routing payments to them but it can take a week or a month before they bounce back. In order for you to continue to do traffic in that time period you need to have capital. You need to have enough capital to weather that storm. That’s an opportunity where you can start to raise your fee because not everybody can compete on that. Not everybody wants to put their capital onto Lightning and not everybody has the capital to put onto Lightning. Now you are competing in a different section to the types of routing nodes that are out there. What you are doing is you are acting like a battery. You are saying “While the mempool is still hot we need to offload some into unbalanced channels on the Lightning Network. And then when the mempool cools down again we can use the blockchain and we can rebalance things out on the chain.” That can take months, it could take weeks. The more capital you have the better battery you are. A battery also serves another purpose that you are allowing people to outsource risk to you. So if I’m a merchant I might not want to have huge amounts of capital on my node. It is a risk to me, I have the risk that Bitcoin’s price is volatile, I have the risk of a hot wallet, maybe it will be taken. If you are a routing node they can push the capital in the channels back to you as a routing node and then you have to sit on that capital. There’s a fee involved, they can pay you a fee to sit on that capital for them with high inbound. That’s what merchants are doing. The one thing to think about though with a liquidity battery node is that you can’t just dump capital into your node. You also need other people to be dumping capital in your direction. You can only route as much out as you have in.
Another type of routing node is called inbound sourcing. You can mix and match all these different types of nodes depending on what you want to do. But one type of problem that I just described is if traffic is moving in one direction only, it is not ping ponging. It is sinking out, out, out. There are different kinds of nodes on the network that are like this. What happens in this case is that the node that provides the liquidity the cheapest to the drain destination, it becomes exhausted first. The next payer realizes the cheapest guy is exhausted to the drain so I’ll have to go with the next cheapest person and the next cheapest and the next cheapest. This is providing you with an opportunity to get some fees but you also have the problem which is that in a drain situation you are potentially losing your inbound liquidity. In order to profit from this situation you can find a way to get inbound liquidity and if you can find a way to get inbound liquidity at a cheaper cost than what you can earn in future routing fees you have an arbitrage trading opportunity. You can say “I am going to buy inbound liquidity by buying a channel from a channel seller. They are going to charge me ten basis points, 0.1 percent.” I know or I think in the future when traffic is going to come to this drain I am going to make 0.2 percent. I am going to be able to pocket the difference of 0.1 percent. That’s a way you can operate your node. It is pretty high touch, you have to be monitoring this. And it is relying on future behavior which is unpredictable. And you are competing with other people. Maybe someone is like “0.1 percent? I don’t need that. I can go for 0.01 percent.” But that’s a way you can make money with a routing node.
That’s introducing this concept of the requirement of a routing node to predict the future. Even a ping pong node, the most basic node, it has to predict the future in that it has to be predicting which nodes are going to be unidirectional, suck out all the inbound liquidity and stop routing. But you can take that to an extreme and say “If I know where traffic is going to go in the future then I can acquire more liquidity in that direction, either inbound or outbound directions. The way that you acquire liquidity is you either make a new channel, if I need more outbound liquidity to a destination I can create a new channel with them, there is a certain cost associated with that but it is not huge usually. Or I can use circular rebalancing to buy somebody else’s liquidity, either inbound or outbound. If I know there is going to be traffic coming from a specific destination inward to my node I can look at what somebody else is already charging for their inbound and then I can buy that from them. The same with outbound, somebody already has outbound, I have no outbound, I can buy their outbound. That’s a market, that’s a way for the market to decide what the price of routing should be. It is kind of a zero sum game. If I buy your inbound you no longer have it and I have it. Maybe you want to do it in the flip way. You don’t want to wait for so called organic traffic to use up your liquidity, you just want to wait for a liquid trader to buy it from you. You could set your fees cheaper to be attractive to those liquidity buyers. This is like you are a trader now, you are a trader on the market. There are a couple of other factors to consider when you are buying and selling this liquidity. One is that your node has a global reputation. If you have channels where you are unbalanced, the pathfinding will start to notice that and say “This node is not very reliable if I include it in my route.” So even though I am going to pay a higher fee to go somewhere else I am going to skip this node because it is not good at routing in general. Even if it is not on the channel that it cares about, it is on a different channel. This is already a feature in lnd and it can become more and more of a feature. I don’t want to waste my time with nodes that aren’t balancing themselves out. You can dump your reputation that way. Another thing to think about, if you acquire inbound liquidity or outbound liquidity to a destination you don’t know anything about it also gives you the chance to learn more. One of the best ways to buy liquidity isn’t in response to somebody who just pays you for it. If somebody just paid you 100 dollars for liquidity and then you see a chance to rebuy the same thing in the future at 20 dollars you are protecting yourself from the possibility that you just wasted 20 dollars. But if you never buy anything, if you never acquire any scarce resources you have no market signaling to yourself. You don’t know what is happening with the traffic on the network. So just creating liquidity for yourself in an inbound or outbound direction is kind of buying information.
Another type of routing node is what I call the last mile problem routing node. I hope you can see that there is not just one way to run your routing node. It is not there is a prescription of following these checkmarks and here is how a routing node is going to make money. It is a vibrant marketplace and different problems have different solutions. One problem people have is that they want to connect to the network and they want to start making payments. Maybe they want to run it on their phone or on their desktop, they don’t want to be a routing node themselves. They just want to connect to somebody else who is a routing node and is managing that problem. What they are going to want is private channels and they are going to want you to be around. It is a peer to peer network, anyone can turn off their node whenever they want, so they don’t want to be stranded. They put up 10,000 dollars and then the node they are connected to is never around so they have to force close and wait two weeks to get their 10,000 dollars back. They don’t want that. They want to find peers on the network that are going to be good connecting points for them to pay all the time and also to have the liquidity so they can pay to anywhere they want to pay to on the network. They also want private channels. From the routing node perspective this is difficult to provide. A private channel is non routable. It is a problem for merchants. Merchants have this issue where their customers want to pay them and them make a direct channel to the merchant but then they are offline all the time because they just made this channel on their mobile phone. The merchant is forced to sit on this capital they don’t want to sit on and they can’t move out to an exchange, they can’t do anything with it. So what merchants are going to do is they are going to refuse new channels or they are going to say the minimum channel size has to be pretty large. I don’t want somebody to sit on a bunch of little coins that I can’t do anything with. Or they are just going to reject all channels from people who are not routing nodes. This creates an opportunity for you as a routing node to say “I am willing to help people onboard onto the network. I don’t mind sitting on some deadweight BTC that is in some private channels. These last mile peers usually provide you with a really good resource that is limited. If they are paying to a legit destination on the network, someone who is well connected, what they are doing is they are giving you inbound liquidity. I am running my routing node, maybe I have 100 dollars of inbound liquidity and I have 1000 dollars of outbound liquidity, I made some channels to routing nodes. I am limited in how much I can route by that 100 dollars. If somebody comes to me who is a private node, just trying to get onto the network. They say “I’m staking 1000 dollars in a channel” and you are getting all of this inbound with the greater network which means that you can start doing more ping pong payments, do more liquidity battery payments, you can even sell that inbound to a drain. There are a lot of benefits to being one of these last mile nodes if that is what you want to sign up for.
So I went through some different types of routing nodes but the key message I want to get out there is that there isn’t just one type of routing node. You are trying to discover new market opportunities and you want to think as much outside the box as possible. You also don’t want to follow information 100 percent because other people are also reading that information and are probably already covering those market opportunities. You want to look for people who are under served and try to serve them. That’s where you are going to make your money and that is where you can be effective. One thing you can do is you can extend the Lightning Network. At Lightning Labs we run one of these submarine swap servers and we extend the network into the blockchain. We take Lightning payments offchain and we translate them onto Bitcoin onchain payments. We are doing a value added service on top of the network. That is not something that anyone can do out of the box, it is a little bit harder to do, so that means we can charge a fee, we can attract this traffic. Anybody can compete with us of course but this is something that takes a little bit of extra effort. What a keysend service is, keysend is a way to push a payment arbitrarily at anybody, a keysend service can allow you to provide swaps to anything in the Lightning protocol. I think this is something that is unexplored, we could work on making it more universal, making more tools for this. Let’s say you wanted to sell gift cards over the Lightning Network or you wanted to sell channel liquidity. You are willing to open up channels to people if they’ll pay you a certain amount. Whatever type of service you wanted to offer it can be offered with this push payment protocol called keysend where you can send a payment to a node and then you can attach arbitrary data. Then the node can send a payment back to you with a response. You can say “What’s the price for an Apple gift card?” Then the node at the receiving side can ping you back and say “If you want an Apple gift card pay this invoice and it costs this amount of Bitcoin.” Once you are offering these types of services you are operating a routing node into other areas. That was the original vision of Lightning, bridge not just Bitcoin people together but bridge all transactions. It is possible today, it is just not quite standardized.
I think those are the big ideas for routing nodes that I have. You can mix and match them. My node is just a node for Y’alls and it is nice to have a separate type of service because you can justify the cost of having a routing node by saying “I needed the node already to do some other kind of thing.” You can even start with one of these merchant nodes and then work your way into a routing node. Another thing I really want to stress about making money on the Lightning Network through routing is that liquidity is not the only product that has value. That is what you are buying and selling literally on Lightning. If somebody pays you a routing fee what they are paying you for is having the liquidity at the time they needed it. But if you think about it, the real thing you are making money on is not having the liquidity, it is having the correct liquidity. Having the correct liquidity in the correct place is data. If somebody can tell you that data and you can make money on it in the future you should be willing to pay them for the data. That is something else that is a potential growth area for the Lightning Network in terms of the routing node economy. We have this scarce resource which is where is the money flowing? It is in addition to liquidity, it is how to operate my node. I don’t want to share this for free. I have the opportunity with my own node to make money off of that information. I am not going to sell it for nothing. But in the future I can definitely see some kind of information sharing happening. Maybe there is some information that I can’t take profit on. I know somebody else will want it more than I will. I think this is good and bad for privacy overall on the Lightning Network. It is good in the sense that once we make information valuable we will be economically disincentivized from sharing it. It is protecting your privacy because people don’t want to share it. They will be losing potential profits if they tell people what transactions are happening. I also think this is a natural consequence of the market itself. You can take a look at the set of existing payments that you make and you can get an idea of where traffic is flowing and what is happening. Just because the fees themselves are telling you information. If you are paying to somewhere and the only available paths are expensive, the market is telling you the price for this liquidity is this because we’ve already exhausted all the cheap paths. Supply and demand has converged on this price. It gives you an idea of what supply and demand are. I think that is an interesting area to expand in addition to merchants, liquidity and routing. I think the most exciting thing is that this is the first peer-to-peer marketplace I’ve heard of that is working in a vibrant way. We are not just proxying. It is not like a peer-to-peer marketplace, an Ebay drop shipper or something. You don’t even need a public IP address, you don’t even need a Tor address. You can just be connecting to this peer-to-peer network. If this works, if this concept works then anybody can come on and pay other people I can see this being extended into any kind of peer-to-peer protocol. You are making payments to anybody in the world and everybody is competing with each other to offer the lowest cost services. I think that’s the exciting part about that. That’s all I have for the presentation.
Q - Can you give some order of magnitude what is considered enough capital for this battery use case?
A - It really depends on the traffic level and also the timing. I currently have a channel which is 5 Bitcoin with Bitfinex. It goes up and it goes down. I don’t think we’ve found the limit yet because that channel can become exhausted and it can go the other way which means there is a certain time limit on how capital moves that we are just not meeting yet. It also depends on the overall size of the network. If you have a 100 Bitcoin channel and the network is full of tiny, tiny amounts then it is unlikely that the money is going to move back in the other direction. I think that the max is pretty high but there is a limit which is the other channels.
Q - What is the recommended hardware to get started, a Raspberry Pi, internet requirements etc?
A - You can run it on a Raspberry Pi 4 kind of thing as far as syncing the blockchain. If you are running a routing node I wouldn’t take shortcuts. I wouldn’t run a SPV or something. It is very critical that you are validating everything because all of the security is based on the idea that you have the security of the blockchain. The difficult part is you want to have data redundancy probably if you are using a capital intensive node. If you have any significant amount of Bitcoin on there you want to make sure you are not holding your Bitcoin on disk that could fail. That is one of the trade-offs of the Lightning Network, your money is your data. It is not like you can just restore from seed and get all your money back. If you lose your data you potentially lose your funds. I would say the minimum is having redundant disk. Any kind of processing is probably fine. It depends also on your style. If you have a high capital node you need more disk because you want more reliability. And also if you are a last mile node, every peer costs you money. Even if they are doing nothing you are having to sync the graph with them, you are having to use some of your system resources with them. Every single peer means you need more operational cost, your node needs to be beefier. On a standard instance, a standard set of hardware like a Raspberry Pi, I wouldn’t run more than 100 peers. If you want to push out from that I would get more advanced hardware.
Q - Are there special recommendations for routing optimizations for the Sphinx protocol?
A - I don’t really know anything about Sphinx. It uses small payments so you might want to lower your routing fees. The default routing fee is 1 satoshi at least in lnd. That means that if your message travels along 10 hops it is already costing you a penny to send your message. There’s no reason you can’t lower that default. You can charge a thousandth of that. It can be a thousandth of a penny for those ten hops. If that’s what you want to specialize in that would be the first thing I would go for. If you looking at lnd forwarding and doing lots of little payments can actually be difficult on disk, on your system resources so you might want to optimize that. Make a real efficient, super big disk. Make a very fast CPU that can process lots of these messages because there is lots of overhead still.
Q - Are there any visual tools to look at the Lightning Network?
A - There were more tools created in the beginning that could graph out the Lightning Network, a bunch of nodes all connected to each other. But I haven’t seen new tools like that. One problem is that a lot of the data about the Lightning Network is hidden. It is also a problem if you go to a node ranking site, you don’t necessarily know if a node is just an old node that has lots of peers or if it is doing a great job. Maybe it is not doing a good job at all, it is just old and acquired a lot of different peers. When you graph that out in a digital representation it is not giving you a lot of signal there. It is just showing you that there are these big nodes that have tonnes of peers. Graph simulations also are taxing for CPU which stopped people from making them. One thing I have worked on is trying to make visualizations of data for my own node. I have data for who am I paying routing fees to, who am I forwarding through, what nodes have I been making money on? It is difficult to map out graph data so I try to move things into a simpler layout, like a table. From top to bottom tell me who is the best at this, who am I connected to, who have I been sending through? I have published some of that on Yalls.org. There are sections at the top where you can observe the network, you can click on different channels and nodes. You can also see my nodes and my nodes are also ranked on the basis of how activity is happening.
Q - I have a pair of channels where someone has opened an equal channel to me. How can we rebalance for free without constantly changing our fee rates?
A - If you have a channel with somebody else and you want to rebalance for free what you want to have happen is you want capital to move over the channel for free, which is easy, but then you want capital to move for free somewhere else, that’s the problem. Let’s say the other person is paying you, you want to pay them back, that is something you can use a submarine swap for but you have to pay for it. That’s not free. You’ll always have to pay for it because it requires a chain fee cost. Just because you two want to do something for free doesn’t mean other people want to do something for free. The miners want to make some fees if you want to regularly rebalance across the network. Other nodes want some fees. The cheapest way is if you do a custodial swap where they pay you offchain, you pay them back on a custodial service that allows free transfers. You could say it is a custodial service like Cash App. You pay me 100 dollars offchain and then I’ll pay you 100 dollars on Cash App. Or you could say it is like Liquid, custodial but based on different exchanges. You’d say “I’ll pay you 100 dollars in this.” But there is always a fee, even with Liquid how do you get your coins out of Liquid? You probably have to pay a 1 percent fee on that total. How do you get your money out of Cash App? They did offer free withdrawals but you are going to pay a chain fee because of the UTXO cost. It is an open ended problem.
Q - Is it better to have some big channels or many small channels?
A - I think it is better to have fewer channels that you can support, don’t overextend yourself if we are talking about public channels. If we are talking about private channels I think it is great to have tonnes of private channels as long as you can support them in terms of you’re happy to have a bunch of capital and deadweight peers sitting around. In that case you could have as many private peers as possible that you can support economically. As far as having a bunch of small public channels I think it is a bad idea because of that reliability that I talked about. Let’s say you have tonnes and tonnes of small channels. The odds are they won’t be being selected for regular larger payments which you want to be selected for. You want to put yourself in the market for those because otherwise you are cutting yourself off from potential routing fees. The other problem is the odds are if you have lots of small channels you probably can’t keep them balanced. Lots of nodes don’t have good liquidity. That means you are creating a bad reputation for your node. You have all these channels but whenever I try to route through you it is not working. lnd on the default configuration, if you have 30 tries and they all fail it will blacklist your entire node for a little while. It says “I tried a bunch of times with this node, it is not working. Even if there is a cheaper path I am going to skip it.”
Q - What do you consider a big or small channel? Where do you see the limit?
A - I like to think about the size in terms of the original sizing of the limits before the limits were extended to large channels. The original sizing was the maximum size of a channel would be 0.1677215 and then the maximum payment size would be a quarter of that so you would have an opportunity to aggregate if the traffic was all unidirectional. That means 4 million satoshis roughly is what I would say is the minimum size. Maybe 5 million satoshis just so you have some breathing room. This is the minimum size for a channel that can route just about any payment. And then I would go up from there. Maybe 10 times bigger, 50 million satoshis, that is pretty big assuming that you know nothing. Big is relative to the traffic. If there’s 10,000 dollars going across and you have a 11,000 dollar channel you don’t have a big channel, you have a small channel. It is based on your assumption of what the regular payment size would be. My assumption is the old assumption that Lightning started with which is 4 million satoshis.
Q - There were two questions about running a node behind Tor versus running it on clearnet. What would you personally prefer and can you run a routing node behind Tor or is it better on clearnet?
A - There is another option which is you don’t even have any connectivity as far as public address. I think Tor is a great option. There are some things that might prevent you from making the most money. Tor is slower than clearnet. This isn’t in pathfinding algorithms now but in the future if pathfinding algorithms give a penalty to nodes that are slower to route payments that could reduce the prevalence of Tor nodes. I actually make more money on my Tor node than I do on my clearnet node. If I were going to run a new node I would use Tor. It solves all the problems, it is nice. It is a marketplace so if there are too many Tor nodes and not enough clearnet nodes then there is more incentive to run a clearnet node. I don’t think there is one right answer.
Q - What is your advice about backups especially for high capacity nodes?
A - Well lnd doesn’t provide the ability to do backups. Instead what it has is this thing called the static channel backup. It is static so it doesn’t change, it is not a real backup as far as backing up the exact state of the channel. It is a backup of the funds, meaning it is a backup of what do I do in the case of a disaster. You can do that, that’s the best you can really do. You can take that file, which is updated when you make a new channel, and the contents of that file is who is my peer? That allows you to reach out to that peer if you lose all your data and say “Hey I need your help.” Your backup is really the fact that you have your money in a 2-of-2 output with somebody else. The other person has a copy of the transaction so every channel has a backup in that it has a peer. I think in the future we’ll get a better database for lnd and maybe if you’re using a different implementation it already has that. But it is a difficult problem and the only thing you can really do with lnd is focus very hard on keeping that channel backup replicated whenever you have a new channel.
Q - What are the things that give you the maximum number of transactions per second that can be done on a node? And what is the maximum that you have seen?
A - What is doing a transaction? You’re signing a new state. What are the barriers to signing new states? Number one is probably I/O. You have to tell your counterparty about the new state. To increase the transactions per second you need to reduce the biggest bottleneck which is the transmission time to them. That can be very low because you can connect to them over gigabit internet or something. You can physically locate very close to them if speed of light becomes a problem. Then maybe you have some bottleneck in terms of reading and writing states to the disk. Of course you can get faster disk. Instead of writing to disk you can write to memory. I would say the bottleneck is really I/O. What you are actually doing is you are doing some computation, maybe a signature, you could do an ASIC for all the computations you need to do. It gets pretty ludicrous in terms of what the plausible transactions per second could be. In practice I think the biggest barrier to transactions per second, if we are talking about lnd, is that lnd has this thing called the free list which is the way that it manages its disk. Transactions can really slow down if you are not turning on auto compaction, if you are not doing compaction of your disk. A lot of people don’t and it is not on by default. One thing that I do to increase my transaction speed is I delete all my payments, I try to delete all my past invoices. I compact my database because by default lnd never deletes anything off the disk for real. It just marks it as deleted. You have to take your node offline and then run this compaction step before restarting your node. In practice I’ve found that speed picks up 10x. In practice as far as seeing what payments people make I haven’t seen a lot of rapid fire payments but sometimes it happens. At least one transaction per second and it can get annoying actually because I have a Telegram bot that tells me when I have a payment forwarded. I have some grouping so that it doesn’t totally spam me but I’ve seen times when people are just spamming payments through me. Other times it is quiet. That is how it is most of the time. It is not like the Lightning Network is being totally saturated with traffic. Most of the time there are no payments going on.
Q - Can you explain base fee and transaction fee? What are good values? Also does it benefit nodes to be constantly rebalancing channels. I attempt to rebalance but I am typically spending 5-10 times more sats to rebalance my most active channels than I earn in all.
A - That’s a great question. Base fee and percentage fee, if you don’t know what that means, there are two components to the fee that you can charge people for routing that are baked into the protocol. One is a flat fee, if you route through me I always charge this. The default in lnd is 1 satoshi. Every time you want to do a forward through me I am going to charge you 1 satoshi. Then there is a percentage fee. Out of 1 million I am going to charge you n percentage of those. Percentage plus base is the total fee that you pay. I don’t really see a point to increasing the base fee. You might want to do that if you just have concerns about HTLCs getting stuck and going to the chain. But if you increase it too much it is shutting you out of routing. You should take into account the perceived risk of going to chain and having to have the HTLC pay for that. I wouldn’t change the base fee or I might make it lower. The other fee which is the fee rate, the percentage fee, that is based on something that you can run out of. You can just route back and forth a million payments, a billion payments over a channel. There is no problem there. It doesn’t make sense to have the flat fee too high because you can do that all day. But what you can’t do all day is you can’t use up all the liquidity in the channel. If somebody makes a payment through your channel, if you have a channel for a million dollars and somebody makes a million dollar payment, you only charge them the flat fee, you now can’t charge anymore fees. You’ve wasted that opportunity of allocating more traffic into the channel. I would charge the percentage fee and I would base that on the competitive marketplace. I don’t think there is one fee that you need to charge, it is based on what you see other people doing and what you can afford to do yourself. I also wouldn’t change things around a lot. People try to dynamically change the fees constantly but I believe in dynamically changing somewhat. By moving your fees all around you are becoming an unstable actor in the marketplace which other people can perceive. You are not just an island dealing with algorithms, other people can see that “This peer that I had is constantly changing their fees so I can’t really rely on them in the future. Why should I be connected to them? I can’t make any decisions based on what they are doing because I don’t know what they are going to do tomorrow.” Raising your fee to a super high level that is unexpected is equivalent to disconnecting your node, turning it off. It turns you into an unstable node from your peers’ perspective if not a software perspective.
Q - How can I view the internal ratings my lnd gives to other nodes? A more general question, how do you get an objective rating for your node in the network?
A - There are two types of ratings. One is ratings that other people compile about your node and then there are ratings your pathfinding has. Whenever you are making a payment you are gathering information based on failures and successes, which nodes are good at giving you a route and which nodes are bad, which channels are good and which channels are bad based on their history. If you use the lnd query routes call which will give you this aggregate confidence score across routes, you can also dump all the data out. It is query mission control. The pathfinding system is called mission control and you can analyze that data if you want. Then you can look in the logs to see every single error that happened or if you do send to route and query route in a loop you can see all the individual errors that happened on every different route. The pathfinding by default is not going to give you a pretty list. One thing that I do as far as reputation goes is I have this system on my node where I tag other nodes, I have a system of tags. And then every node that I encounter I am trying to classify them. I can use data from my node to have a form of classification. If I notice that something is in the wrong classification I’ll address that. That is something that I do myself for myself. Going back to the data slide of my presentation, if you want to be a good router your job is to connect inbound sources to outbound sources or to connect bidirectional sources to each other in a way that hasn’t happened before. That is information that you need to find. You probably want to be rigorous about how you find that information and be recording what you are seeing yourself. It is a job that you have to do yourself.
Q - How would you tag your nodes? I have a lot of nodes, is there a way to tag them with keywords, for example RTL?
A - I don’t know if RTL supports it, I have a tool for myself where I tag nodes. I give them a name and an icon so whenever I see them I know it is this type of node. I also do it for nodes that I would like to connect to in the future, maybe nodes I am thinking about disconnecting from. I also have a blacklist, there are certain nodes on the network I know are not good for routing so I avoid them for future routing. I left out the question on rebalancing. The basic problem is if you rebalance and you pay 10 dollars and then in the future you only get 1 dollar, the rebalancing you just did could have been counter rebalanced by the other person if they paid you 1 dollar. If you pay 10 dollars and they pay you 1 dollar that’s all you are doing. I think it is dangerous to do routing if you don’t understand what is happening. You can easily get into situations, especially if you automate this. I see people doing that all the time. They say “I want a node that just runs itself.” They give it a budget of this but they don’t really take into account that what you are doing when you do a rebalance is you are predicting the future. If you predict the future in the wrong way or you say “I’ll spend this, I don’t really care what happens in the future” you are opening up the opportunity for someone to drain money out of your node. You have to be pretty careful about that.
Q - How will the Lightning Network work as a privacy mechanism for Bitcoin?
A - I hope that we will be able to improve on the privacy aspects of the network. We are starting from a good position, my node has done tonnes and tonnes of transactions, also large amounts of transactions, the UTXO is very unrepresentative of where the money is in reality. The problem we have as far as privacy goes is that we haven’t had a lot of features address privacy. When you receive money you have to share your public key with somebody. The path it takes through the network, people in the middle can observe it pretty easily. The public network shares all these UTXOs so people know which UTXO is associated with which node. The channels themselves are easily identified onchain because you have a 2-of-2 output and there is not that many 2-of-2 outputs. There are plenty of technical improvements we could make to Lightning to make it more private. That implies that right now we don’t have the best privacy. You can’t use it and assume “It is private, it is perfectly private.” The thing that I think is really good about Lightning Network though is aside from taking the transactions out of this global broadcast system, is that when you do these coinjoins you are solving one problem, you are making it hard for people to trace back to your original source of funds, but you are creating a new problem in that you are tying yourself to weird behavior on the chain. Somebody who is non-discriminating, instead of saying “I notice that these coins are tied to this hack or some evil thing they just made up” they can say “Your coins are tied to something I don’t know about so I don’t like you anymore.” The thing that Lightning does is it says “Your coins from the perspective of coin analysis, the global broadcast, your coins are tied to this mass of coins that represents Lightning Network.” If there is so much overwhelming use of the Lightning Network that is legitimate it will be difficult to blanket blacklist all the coins that are related to that mass of coins that are on the network. That is how it works already. One of the best ways to get privacy on your coins is to send it to an exchange. There is so much traffic through exchanges that is legitimate that other people on the network can’t afford to blacklist an exchange for the most part. That’s a way to get anonymity out of coins. If exchanges do more AML, KYC and stuff it reduces the amount of privacy you get by mixing your coins into their pool of coins. Then it is nice to have another pool of coins, the Lightning Network, something that could be considered legitimate and necessary for regular transactions, it is hard to blacklist.
Q - How can people reach you if they have follow up questions? What is the best way to contact you or read up on what you were talking about?
A - If you are interested in any of the code that I write, tools I’m making, GitHub issues and pull requests, I’m on Telegram. If you are interested in Lighting Labs stuff like Lightning Loop, Lightning Labs operates a Slack, there’s a Loop channel or if you are interested in developing on lnd Lightning Labs has a community channel. That also gives people to participate in helping themselves.
Community-maintained archive to unlocking knowledge from technical bitcoin transcripts