Jim Renkel [ARCHIVE] on Nostr: 📅 Original date posted:2017-12-20 📝 Original message: Hello, all! I'm a ...
📅 Original date posted:2017-12-20
📝 Original message:
Hello, all!
I'm a long-time computer networking developer, but a newbie to
cryptocurrency, and am interested in contributing to its development.
While looking at the lightning network design and code, I've come up
with an idea the would reduce the number of blockchain transactions used
by the LN, and the fees paid to confirm them, in a common LN use case.
I did a quick search and couldn't find this idea presented previously,
but I may have missed it. If so, or if the idea is faulty, I'm sure you
guys will let me know. :-)
And forgive me if I don't have the terminology quite right yet.
The use case I am referring to is the frequent, repeated purchases by a
customer from the same merchant over an extended period of time. I think
this will be a common use case.
For example: Alice buys a cup of coffee from Bob's Coffee Shoppe every
day, has done so for years, will do so for years.
To use the LN to pay for these purchases, Alice opens and funds an LN
channel to Bob. This takes one blockchain transaction.
As coffees are purchased every day, funds are transferred from Alice to
Bob in the channel without any blockchain transactions.
Alice cannot afford to fund the channel for an extended period of time,
and Bob is unwilling to wait an extended period of time to be paid for
the coffees Alice has purchased.
So every week or so, Alice and Bob close the channel, Alice gets back
any unspent funds, and Bob gets the funds that have been transferred to
him for Alice's purchases. Then Alice and Bob re-open the channel with
new funding from Alice. Closing and re-opening the channel each take one
blockchain transaction.
Over the life of the channel, if there are n close/re-open cycles, 2*n
blockchain transactions are required: 1 to open the channel initially, 2
each time the channel is closed and re-opened (n-1 times), and 1 to
close the channel finally.
If the LN were enhanced with an operation to deposit and withdraw
funding in the channel to and from the blockchain without closing the
channel, this could be done with a single blockchain transaction that is
essentially the merge of the closing and re-opening blockchain transactions.
In this example, each adjustment will only pay Bob his accumulated but
as yet unpaid funds and charge Alice for the new funds she places into
the channel, but leave Alice's unspent funds in the channel. The channel
could continue to operate between the launching and confirmation of the
adjustment transaction if Alice has unspent funds in the channel.
Then the n cycles would only require n+1 blockchain transactions: 1 to
initially open the channel, 1 each time the channel funding is adjusted
(total n-1), and 1 to finally close the channel. This is a significant
reduction in the number of blockchain transactions required, approaching
50% in the limit as n approaches infinity.
What about blockchain transaction fees? I've done the analysis, but it's
quite long (several conditions and dozens of combinations of conditions
to consider), so I won't include it here now. I will included it in
another post if anyone is interested and doesn't do the analysis for
themselves.
The bottom line of the analysis is that the number of inputs and the
number of outputs in the funding adjustment transaction are each never
greater than the sum of the number of inputs and the number of outputs,
respectively, in the channel opening and closing transactions that the
adjustment transaction replaces.
Thus the adjustment transaction is:
- never bigger than the closing and re-opening transactions put together,
- sometimes smaller, and
- occasionally significantly smaller.
And there's only one transaction instead of two, so ya always save on
the transaction header! :-)
Thus, the fee paid for the adjustment transaction, assuming the same fee
rate for all the transactions, is:
- never more than the sum of the fees paid for the closing and
re-opening transactions,
- sometimes less, and
- occasionally significantly less.
This reduction in fees is by an additive amount.
Because the channel remains open while waiting for the adjustment
transaction to confirm, there may be less urgency in having it confirm.
So it's fee rate can be reduced, reducing the fee paid by a
multiplicative amount.
Combined, these two effects lead to a reduction in total fees paid for
operating the channel, sometimes a significant reduction.
Comments expected and welcome.
If this high-level, bare-bones idea to seen to be worthy of further
consideration, I would like to work with the community to flesh out a
detailed specification, and, if consensus can be reached on that, to
participate in the implementation of it.
Jim Renkel
Published at
2023-06-09 12:48:15Event JSON
{
"id": "24d7bb84c37851ae831a42efa9389277b3b8efb3c68241d6958661b28b096dae",
"pubkey": "1d2a4ced35e739c890139d39691d33b6ea0ae63cdc9eb729af544a3a23c3f661",
"created_at": 1686314895,
"kind": 1,
"tags": [
[
"e",
"3bbbce7fffa8e1c3b65f9f927c6e196cf18e9c9c0eb8ec0438dcbdb2a5de0810",
"",
"reply"
],
[
"p",
"9456f7acb763eaab2e02bd8e60cf17df74f352c2ae579dce1f1dd25c95dd611c"
]
],
"content": "📅 Original date posted:2017-12-20\n📝 Original message:\nHello, all!\n\nI'm a long-time computer networking developer, but a newbie to \ncryptocurrency, and am interested in contributing to its development.\n\nWhile looking at the lightning network design and code, I've come up \nwith an idea the would reduce the number of blockchain transactions used \nby the LN, and the fees paid to confirm them, in a common LN use case.\n\nI did a quick search and couldn't find this idea presented previously, \nbut I may have missed it. If so, or if the idea is faulty, I'm sure you \nguys will let me know. :-)\n\nAnd forgive me if I don't have the terminology quite right yet.\n\nThe use case I am referring to is the frequent, repeated purchases by a \ncustomer from the same merchant over an extended period of time. I think \nthis will be a common use case.\n\nFor example: Alice buys a cup of coffee from Bob's Coffee Shoppe every \nday, has done so for years, will do so for years.\n\nTo use the LN to pay for these purchases, Alice opens and funds an LN \nchannel to Bob. This takes one blockchain transaction.\n\nAs coffees are purchased every day, funds are transferred from Alice to \nBob in the channel without any blockchain transactions.\n\nAlice cannot afford to fund the channel for an extended period of time, \nand Bob is unwilling to wait an extended period of time to be paid for \nthe coffees Alice has purchased.\n\nSo every week or so, Alice and Bob close the channel, Alice gets back \nany unspent funds, and Bob gets the funds that have been transferred to \nhim for Alice's purchases. Then Alice and Bob re-open the channel with \nnew funding from Alice. Closing and re-opening the channel each take one \nblockchain transaction.\n\nOver the life of the channel, if there are n close/re-open cycles, 2*n \nblockchain transactions are required: 1 to open the channel initially, 2 \neach time the channel is closed and re-opened (n-1 times), and 1 to \nclose the channel finally.\n\nIf the LN were enhanced with an operation to deposit and withdraw \nfunding in the channel to and from the blockchain without closing the \nchannel, this could be done with a single blockchain transaction that is \nessentially the merge of the closing and re-opening blockchain transactions.\n\nIn this example, each adjustment will only pay Bob his accumulated but \nas yet unpaid funds and charge Alice for the new funds she places into \nthe channel, but leave Alice's unspent funds in the channel. The channel \ncould continue to operate between the launching and confirmation of the \nadjustment transaction if Alice has unspent funds in the channel.\n\nThen the n cycles would only require n+1 blockchain transactions: 1 to \ninitially open the channel, 1 each time the channel funding is adjusted \n(total n-1), and 1 to finally close the channel. This is a significant \nreduction in the number of blockchain transactions required, approaching \n50% in the limit as n approaches infinity.\n\nWhat about blockchain transaction fees? I've done the analysis, but it's \nquite long (several conditions and dozens of combinations of conditions \nto consider), so I won't include it here now. I will included it in \nanother post if anyone is interested and doesn't do the analysis for \nthemselves.\n\nThe bottom line of the analysis is that the number of inputs and the \nnumber of outputs in the funding adjustment transaction are each never \ngreater than the sum of the number of inputs and the number of outputs, \nrespectively, in the channel opening and closing transactions that the \nadjustment transaction replaces.\n\nThus the adjustment transaction is:\n- never bigger than the closing and re-opening transactions put together,\n- sometimes smaller, and\n- occasionally significantly smaller.\n\nAnd there's only one transaction instead of two, so ya always save on \nthe transaction header! :-)\n\nThus, the fee paid for the adjustment transaction, assuming the same fee \nrate for all the transactions, is:\n- never more than the sum of the fees paid for the closing and \nre-opening transactions,\n- sometimes less, and\n- occasionally significantly less.\n\nThis reduction in fees is by an additive amount.\n\nBecause the channel remains open while waiting for the adjustment \ntransaction to confirm, there may be less urgency in having it confirm. \nSo it's fee rate can be reduced, reducing the fee paid by a \nmultiplicative amount.\n\nCombined, these two effects lead to a reduction in total fees paid for \noperating the channel, sometimes a significant reduction.\n\nComments expected and welcome.\n\nIf this high-level, bare-bones idea to seen to be worthy of further \nconsideration, I would like to work with the community to flesh out a \ndetailed specification, and, if consensus can be reached on that, to \nparticipate in the implementation of it.\n\nJim Renkel",
"sig": "e7b345104f2d0cec0eae3dddc27d15a2ced804a35e2eae5caa2776020c080fe4c058ea533c0bd9a04ed9b928cbbaa8a8dcd2b88af764a645a367beb22d422edb"
}