Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Transaction time

4 messages, Dec 15 to 16, 2015. Started by Denis Gorbachev.

Denis Gorbachev (2), Rusty Russell, Mark F

Permalink First message in the Wayback Machine

Denis Gorbachev permalink original

Assuming a simple case of "Consumer - Relay - Provider" (2 hops), how long should it take for provider to receive the payment?

Rusty Russell in reply to Denis Gorbachev permalink original

Denis Gorbachev <denis.d.gorbachev at gmail.com> writes:

Quoted text (2 lines)
> Assuming a simple case of "Consumer - Relay - Provider" (2 hops), how long
> should it take for provider to receive the payment?

Assuming established channels already (assuming CPU is instant, so we're just paying for network latency):

Consumer offers Relay a contract:
        C -> R: update_add_htlc
        R -> C: update_accept
        C -> R: update_signature
        R -> C: update_complete*
Relay offers Provider a contract:
        R -> P: update_add_htlc
        P -> R: update_accept
        R -> P: update_signature
        P -> R: update_complete*
Provider closes contract with relay:
        P -> R: update_fulfill_htlc
        R -> P: update_accept
        P -> R: update_signature
        R -> P: update_complete*
Relay closes contract with Client:
        R -> C: update_fulfill_htlc
        C -> R: update_accept
        R -> C: update_signature
        C -> R: update_complete*

You don't need to wait for the update_complete packets to arrive, so that works out to 3 RTTs per hop. You might expect up to 10 hops in a large lightning network, so 30 RTTs.

I'm in Australia, and my bitcoin node latency averages 330ms (ouch!). So that would be 10 seconds.

Hope that helps! Rusty.

Mark F in reply to Rusty Russell permalink original

It should be noted that this estimation is biasing towards worst-case-latency/best-case-decentralization. Even though we will make conscious efforts to keep lightning networks as decentralized as possible, it is still the case that we will see some centralization pressure due to the desire for low latency transactions. I expect that the average user's experience of a 10-hop payment would be on the order of 1-2 seconds, with the inner-hops being between Tier-1 datacenter nodes primarily with payment channels chosen based on network proximity. A 'near' payment to someone closer to them would be under a second. But it is very good to know that a network consisting entirely of last-mile endpoints geographically distributed around the world would only have a worst-case transaction time of only about 10s or so. Even that is doable for PoS.

On Wed, Dec 16, 2015 at 8:04 AM, Rusty Russell <rusty at rustcorp.com.au> wrote:

Quoted text (46 lines)
> Denis Gorbachev <denis.d.gorbachev at gmail.com> writes:
> > Assuming a simple case of "Consumer - Relay - Provider" (2 hops), how
> long
> > should it take for provider to receive the payment?
>
> Assuming established channels already (assuming CPU is instant, so we're
> just paying for network latency):
>
> Consumer offers Relay a contract:
>         C -> R: update_add_htlc
>         R -> C: update_accept
>         C -> R: update_signature
>         R -> C: update_complete*
>
> Relay offers Provider a contract:
>         R -> P: update_add_htlc
>         P -> R: update_accept
>         R -> P: update_signature
>         P -> R: update_complete*
>
> Provider closes contract with relay:
>         P -> R: update_fulfill_htlc
>         R -> P: update_accept
>         P -> R: update_signature
>         R -> P: update_complete*
>
> Relay closes contract with Client:
>         R -> C: update_fulfill_htlc
>         C -> R: update_accept
>         R -> C: update_signature
>         C -> R: update_complete*
>
> You don't need to wait for the update_complete packets to arrive, so
> that works out to 3 RTTs per hop.  You might expect up to 10 hops in a
> large lightning network, so 30 RTTs.
>
> I'm in Australia, and my bitcoin node latency averages 330ms (ouch!).
> So that would be 10 seconds.
>
> Hope that helps!
> Rusty.
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
Denis Gorbachev in reply to Mark F permalink original

Rusty, Mark - thanks for the explanations!

On Wed, Dec 16, 2015 at 10:49 AM Mark Friedenbach <mark at friedenbach.org> wrote:

Quoted text (64 lines)
> It should be noted that this estimation is biasing towards
> worst-case-latency/best-case-decentralization. Even though we will make
> conscious efforts to keep lightning networks as decentralized as possible,
> it is still the case that we will see some centralization pressure due to
> the desire for low latency transactions. I expect that the average user's
> experience of a 10-hop payment would be on the order of 1-2 seconds, with
> the inner-hops being between Tier-1 datacenter nodes primarily with payment
> channels chosen based on network proximity. A 'near' payment to someone
> closer to them would be under a second. But it is very good to know that a
> network consisting entirely of last-mile endpoints geographically
> distributed around the world would only have a worst-case transaction time
> of only about 10s or so. Even that is doable for PoS.
>
> On Wed, Dec 16, 2015 at 8:04 AM, Rusty Russell <rusty at rustcorp.com.au>
> wrote:
>
>> Denis Gorbachev <denis.d.gorbachev at gmail.com> writes:
>> > Assuming a simple case of "Consumer - Relay - Provider" (2 hops), how
>> long
>> > should it take for provider to receive the payment?
>>
>> Assuming established channels already (assuming CPU is instant, so we're
>> just paying for network latency):
>>
>> Consumer offers Relay a contract:
>>         C -> R: update_add_htlc
>>         R -> C: update_accept
>>         C -> R: update_signature
>>         R -> C: update_complete*
>>
>> Relay offers Provider a contract:
>>         R -> P: update_add_htlc
>>         P -> R: update_accept
>>         R -> P: update_signature
>>         P -> R: update_complete*
>>
>> Provider closes contract with relay:
>>         P -> R: update_fulfill_htlc
>>         R -> P: update_accept
>>         P -> R: update_signature
>>         R -> P: update_complete*
>>
>> Relay closes contract with Client:
>>         R -> C: update_fulfill_htlc
>>         C -> R: update_accept
>>         R -> C: update_signature
>>         C -> R: update_complete*
>>
>> You don't need to wait for the update_complete packets to arrive, so
>> that works out to 3 RTTs per hop.  You might expect up to 10 hops in a
>> large lightning network, so 30 RTTs.
>>
>> I'm in Australia, and my bitcoin node latency averages 330ms (ouch!).
>> So that would be 10 seconds.
>>
>> Hope that helps!
>> Rusty.
>>
> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
> --

@DenGorbachev <https://twitter.com/DenGorbachev>