Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Peer selection

7 messages, Dec 12 to 14, 2017. Started by Stan Kladko.

Stan Kladko (3), ZmnSCPxj (3), William Casarin

Permalink First message in the Wayback Machine

Stan Kladko permalink original

I have been reading LN specs, one question that I am trying to answer is how do I find a peer for my lightning connections.

Lets say I want to connect to the network with 6 links, each having $100.

1. How do I select the nodes to peer with?
2. How do I make them to do deposits - ideally I want them to match $100 each.
    But since they are presumably already sufficiently connected to
the network, why would they lock more funds?
3. How do I find out if someone wants to connect to me?
ZmnSCPxj in reply to Stan Kladko permalink original

Good morning Stan,

Quoted text (1 line)
>1. How do I select the nodes to peer with?

By whatever selection criteria you wish.

In practice, lnd offers an "auto-pilot" where it selects peers to channel with automatically using some heuristic (which I do not know). My understanding, c-lightning will eventually offer a similar feature at some point in the future.

Presumably node gossip will let you learn of other nodes that you might channel with in the future.

Quoted text (1 line)
>2. How do I make them to do deposits - ideally I want them to match $100 each.

Currently, channels are initially single-funded. There is a proposal https://github.com/lightningnetwork/lightning-rfc/pull/184 for dual-funded channel setup, but did not make it into 1.0.

Quoted text (2 lines)
>But since they are presumably already sufficiently connected to
>the network, why would they lock more funds?

It helps to consider that you are not particularly special, and neither are the existing nodes on the network particularly special.

If you have a reason to open a channel to an arbitrary node, then other nodes have a reason to open a channel to an arbitrary node, which might be you. Even if the network grows large, that also means there are more participants who might decide, via whatever heuristic, to channel to your node.

If you intend to connect for the purpose of becoming a hub and earning routing fees, if you have some onchain bitcoins you can afford to invest, then it is to your interest to channel with relatively new and low-connectivity nodes. Such nodes might receive payments and if you are one of the few routes (or the only route) you then get a higher chance of being routed through. Inverting this, if you have a new node with a few channels, others aspiring to become hubs will want to lock spare funds to channel to your node in case you become a very prolific user (sender or receiver) of the network in the future.

Quoted text (1 line)
>3.  How do I find out if someone wants to connect to me?

The node connects to yours and sends channel funding messages.

Regards, ZmnSCPxj

Stan Kladko in reply to ZmnSCPxj permalink original

I see - thank you.

How to I discover nodes - is there any UI to see nodes currently running on the network ?

Quoted text (2 lines)
> 3.  How do I find out if someone wants to connect to me?
> The node connects to yours and sends channel funding messages.

In this case there is some kind of an UI where I can accept or reject - correct? Or I auto-accept everyone that connects to me?

Quoted text (1 line)
> If you intend to connect for the purpose of becoming a hub and earning routing fees, if you have some onchain bitcoins you can afford to invest, then it is to your interest to channel with  relatively new and low-connectivity nodes.

If I become a hub, how much to I earn, approximately in routing fees? Is it a percentage of transactions? Are routing fees the same for all hubs?

If I am connecting to the network and see many hubs - how can I select which hub to connect to? Is there any performance/reputation info available for any hub?

On Wed, Dec 13, 2017 at 2:36 AM, ZmnSCPxj <ZmnSCPxj at protonmail.com> wrote:

Quoted text (49 lines)
> Good morning Stan,
>
>>1. How do I select the nodes to peer with?
>
> By whatever selection criteria you wish.
>
> In practice, lnd offers an "auto-pilot" where it selects peers to channel
> with automatically using some heuristic (which I do not know).  My
> understanding, c-lightning will eventually offer a similar feature at some
> point in the future.
>
> Presumably node gossip will let you learn of other nodes that you might
> channel with in the future.
>
>>2. How do I make them to do deposits - ideally I want them to match $100
>> each.
>
> Currently, channels are initially single-funded.  There is a proposal
> https://github.com/lightningnetwork/lightning-rfc/pull/184 for dual-funded
> channel setup, but did not make it into 1.0.
>
>>But since they are presumably already sufficiently connected to
>>the network, why would they lock more funds?
>
> It helps to consider that you are not particularly special, and neither are
> the existing nodes on the network particularly special.
>
> If you have a reason to open a channel to an arbitrary node, then other
> nodes have a reason to open a channel to an arbitrary node, which might be
> you.  Even if the network grows large, that also means there are more
> participants who might decide, via whatever heuristic, to channel to your
> node.
>
> If you intend to connect for the purpose of becoming a hub and earning
> routing fees, if you have some onchain bitcoins you can afford to invest,
> then it is to your interest to channel with relatively new and
> low-connectivity nodes. Such nodes might receive payments and if you are one
> of the few routes (or the only route) you then get a higher chance of being
> routed through.  Inverting this, if you have a new node with a few channels,
> others aspiring to become hubs will want to lock spare funds to channel to
> your node in case you become a very prolific user (sender or receiver) of
> the network in the future.
>
>>3.  How do I find out if someone wants to connect to me?
>
> The node connects to yours and sends channel funding messages.
>
> Regards,
> ZmnSCPxj
ZmnSCPxj in reply to Stan Kladko permalink original

Good morning Stan,

Quoted text (2 lines)
>How to I discover nodes - is there any UI to see nodes currently
>running on the network ?

There are no UIs to my knowledge. Current LN programs keep track of this in their databases, although each one varies in detail. Presumably their individual main developers know how to extract this information.

My understanding is that network bootstrap involves some LN nodes being discoverable via DNS, then your node will connect to them, request node gossip, then it (if you use some kind of auto-pilot channeling system like what lnd has) will select from the node information it acquires to select some nodes to connect and channel to.

Note a precision, there is a difference between "connect" and "channel". To connect, means only that you contact them over the network and consumes only bandwidth and some small amount of CPU power on your node. To channel, means to commit some bitcoins to a payment channel between you.

Quoted text (5 lines)
>>>How do I find out if someone wants to connect to me?
>>The node connects to yours and sends channel funding messages.
>
>In this case there is some kind of an UI where I can accept or reject - correct?
>Or I auto-accept everyone that connects to me?

None. You auto-accept incoming channel requests. You might, if you are up to it, program your node to reject some nodes via any heuristic you choose, but you would have to implement that yourself. I know of no current LN software that has or intends to have such a feature, as there are little downside to accepting all channels --- you only spend less than a kilobyte of storage for each newly-opened channel --- while the upside is that a channel to you is a potential route which you can charge for, or a route you can receive funds through.

Quoted text (6 lines)
>>If you intend to connect for the purpose of becoming a hub and earning routing fees, if you have some onchain bitcoins you can afford to invest, then it is to your interest to
>channel with relatively new and low-connectivity nodes.
>
>If I become a hub, how much to I earn, approximately in routing fees?
>Is it a percentage of transactions? Are routing fees the same for all
>hubs?

Each node indicates as part of its information a "fixed fee" and a "proportional fee". The "fixed fee" is imposed per successful routing attempt, while the "proportional fee" is a ratio of the value traveling through the node when it is on the route. It is expected that there will be many nodes through which people can route, so there will be much competition and eventually the system will settle to a state where most nodes charge the same low fee.

Quoted text (3 lines)
>If I am connecting to the network and see many hubs - how can I select
>which hub to connect to? Is there any performance/reputation info
>available for any hub?

There are none. Presumably your auto-channeling program will gather statistics and other information to make some guesses on which nodes have good performance.

Note that, there is nothing that specially privileges hubs, and this is deliberate. Any node can become a hub without permission or special treatment of the network, if by "hub" we mean "node with high number of channels". Indeed, even the DNS bootstrap, to my knowledge, should only be used to gather initial node gossip to acquire some *other* nodes that can potentially be channeled to.

Regards, ZmnSCPxj

Stan Kladko in reply to ZmnSCPxj permalink original

Thank you

Presumably many nodes will be behind firewalls. Are there any firewall traversal mechanisms included (or some type of an overlay network)?)

On Wed, Dec 13, 2017 at 2:53 PM, ZmnSCPxj <ZmnSCPxj at protonmail.com> wrote:

Quoted text (70 lines)
> Good morning Stan,
>
>>How to I discover nodes - is there any UI to see nodes currently
>>running on the network ?
>
> There are no UIs to my knowledge. Current LN programs keep track of this in
> their databases, although each one varies in detail. Presumably their
> individual main developers know how to extract this information.
>
> My understanding is that network bootstrap involves some LN nodes being
> discoverable via DNS, then your node will connect to them, request node
> gossip, then it (if you use some kind of auto-pilot channeling system like
> what lnd has) will select from the node information it acquires to select
> some nodes to connect and channel to.
>
> Note a precision, there is a difference between "connect" and "channel".  To
> connect, means only that you contact them over the network and consumes only
> bandwidth and some small amount of CPU power on your node.  To channel,
> means to commit some bitcoins to a payment channel between you.
>
>>>>How do I find out if someone wants to connect to me?
>>>The node connects to yours and sends channel funding messages.
>>
>>In this case there is some kind of an UI where I can accept or reject -
>> correct?
>>Or I auto-accept everyone that connects to me?
>
> None.  You auto-accept incoming channel requests.  You might, if you are up
> to it, program your node to reject some nodes via any heuristic you choose,
> but you would have to implement that yourself.  I know of no current LN
> software that has or intends to have such a feature, as there are little
> downside to accepting all channels --- you only spend less than a kilobyte
> of storage for each newly-opened channel --- while the upside is that a
> channel to you is a potential route which you can charge for, or a route you
> can receive funds through.
>
>>>If you intend to connect for the purpose of becoming a hub and earning
>>> routing fees, if you have some onchain bitcoins you can afford to invest,
>>> then it is to your interest to
>>channel with relatively new and low-connectivity nodes.
>>
>>If I become a hub, how much to I earn, approximately in routing fees?
>>Is it a percentage of transactions? Are routing fees the same for all
>>hubs?
>
> Each node indicates as part of its information a "fixed fee" and a
> "proportional fee".  The "fixed fee" is imposed per successful routing
> attempt, while the "proportional fee" is a ratio of the value traveling
> through the node when it is on the route.  It is expected that there will be
> many nodes through which  people can route, so there will be much
> competition and eventually the system will settle to a state where most
> nodes charge the same low fee.
>
>>If I am connecting to the network and see many hubs - how can I select
>>which hub to connect to? Is there any performance/reputation info
>>available for any hub?
>
> There are none.  Presumably your auto-channeling program will gather
> statistics and other information to make some guesses on which nodes have
> good performance.
>
> Note that, there is nothing that specially privileges hubs, and this is
> deliberate.  Any node can become a hub without permission or special
> treatment of the network, if by "hub" we mean "node with high number of
> channels".  Indeed, even the DNS bootstrap, to my knowledge, should only be
> used to gather initial node gossip to acquire some *other* nodes that can
> potentially be channeled to.
>
> Regards,
> ZmnSCPxj
ZmnSCPxj in reply to Stan Kladko permalink original

Good morning Stan,

The protocol allows nodes to be behind Tor hidden services (.onion domain names). Tor hidden services automatically have NAT punching and firewall traversal, as long as the firewall allows Tor protocol to go through.

I do not know if there are already LN software that actually supports being run as a Tor hidden service yet, however.

Regards, ZmnSCPxj

Sent with ProtonMail Secure Email.

-------- Original Message -------- Subject: Re: [Lightning-dev] Peer selection Local Time: December 13, 2017 9:04 PM UTC Time: December 13, 2017 1:04 PM From: stan.kladko at galacticexchange.io To: ZmnSCPxj <ZmnSCPxj at protonmail.com> lightning-dev at lists.linuxfoundation.org <lightning-dev at lists.linuxfoundation.org>

Thank you

Presumably many nodes will be behind firewalls. Are there any firewall traversal mechanisms included (or some type of an overlay network)?)

On Wed, Dec 13, 2017 at 2:53 PM, ZmnSCPxj ZmnSCPxj at protonmail.com wrote: Good morning Stan, How to I discover nodes - is there any UI to see nodes currently running on the network ? There are no UIs to my knowledge. Current LN programs keep track of this in their databases, although each one varies in detail. Presumably their individual main developers know how to extract this information. My understanding is that network bootstrap involves some LN nodes being discoverable via DNS, then your node will connect to them, request node gossip, then it (if you use some kind of auto-pilot channeling system like what lnd has) will select from the node information it acquires to select some nodes to connect and channel to. Note a precision, there is a difference between "connect" and "channel". To connect, means only that you contact them over the network and consumes only bandwidth and some small amount of CPU power on your node. To channel, means to commit some bitcoins to a payment channel between you. How do I find out if someone wants to connect to me? The node connects to yours and sends channel funding messages. In this case there is some kind of an UI where I can accept or reject - correct? Or I auto-accept everyone that connects to me? None. You auto-accept incoming channel requests. You might, if you are up to it, program your node to reject some nodes via any heuristic you choose, but you would have to implement that yourself. I know of no current LN software that has or intends to have such a feature, as there are little downside to accepting all channels --- you only spend less than a kilobyte of storage for each newly-opened channel --- while the upside is that a channel to you is a potential route which you can charge for, or a route you can receive funds through. If you intend to connect for the purpose of becoming a hub and earning routing fees, if you have some onchain bitcoins you can afford to invest, then it is to your interest to channel with relatively new and low-connectivity nodes. If I become a hub, how much to I earn, approximately in routing fees? Is it a percentage of transactions? Are routing fees the same for all hubs? Each node indicates as part of its information a "fixed fee" and a "proportional fee". The "fixed fee" is imposed per successful routing attempt, while the "proportional fee" is a ratio of the value traveling through the node when it is on the route. It is expected that there will be many nodes through which people can route, so there will be much competition and eventually the system will settle to a state where most nodes charge the same low fee. If I am connecting to the network and see many hubs - how can I select which hub to connect to? Is there any performance/reputation info available for any hub? There are none. Presumably your auto-channeling program will gather statistics and other information to make some guesses on which nodes have good performance. Note that, there is nothing that specially privileges hubs, and this is deliberate. Any node can become a hub without permission or special treatment of the network, if by "hub" we mean "node with high number of channels". Indeed, even the DNS bootstrap, to my knowledge, should only be used to gather initial node gossip to acquire some other nodes that can potentially be channeled to. Regards, ZmnSCPxj

William Casarin in reply to ZmnSCPxj permalink original

ZmnSCPxj via Lightning-dev <lightning-dev at lists.linuxfoundation.org> writes:

Quoted text (6 lines)
> Good morning Stan,
>
>>How to I discover nodes - is there any UI to see nodes currently
>>running on the network ?
>
> There are no UIs to my knowledge. Current LN programs keep track of this in their databases, although each one varies in detail. Presumably their individual main developers know how to extract this information.

I found this one today [1]. I used it to connect to a couple nodes.

[1] https://explorer.acinq.co