lightning-dev
Scaling Lightning With Simple Covenants
Posted on: November 15, 2023 19:59 UTC
In the exploration of the balance between trust/safety and capital efficiency in payment channels, a proposed solution for managing the risks associated with casual users spending all available funds is to require them to prepay cost-of-capital fees for the entire lifetime of the channel.
This method ensures that dedicated users can maintain an extended active channel lifetime without compromising safety. The suggested active lifetime spans approximately 110,000 blocks or roughly 2.1 years, with the option for casual users to establish new channels every 10,000 blocks, or about 2.5 months. The paper referenced introduces a rollover period to accommodate potential unavailability of the casual user, coupled with a timeout-tree mechanism that has both an active lifetime of 25 months and an inactive lifetime, which presents an added risk, of one week for processing leaves onchain.
To mitigate risk and ensure scalability, an analysis was conducted to determine the feasibility of including all timeout-tree leaves onchain before their expiration. With full block capacity devoted to leaves, approximately 100 million leaves could be put onchain annually. However, scaling up to billions of leaves might necessitate compromises between safety and capital efficiency. The parameters of the analysis consider various factors such as block size, feerate, value of leaves, and cost of capital. A Python program was created to calculate the optimal inactive lifetime by minimizing the cost of capital and the expected cost of putting leaves onchain, with the goal of having all leaves onchain before the timeout-trees expire.
The program's tunable parameters include active lifetime, rollover period, transaction sizes, feerate, probability of onchain settlement, number of leaves, total value, and cost of capital. Under assumed values, the results suggest allocating up to 65% of block space for timeout-tree leaves, resulting in an inactive lifetime of 1.55 years and an expected cost of 2.5% of the casual user’s funds. These findings and the corresponding tools are accessible via GitHub, with specific values and results detailed in the provided files.
Overall, this analysis seeks to quantify the tradeoff between trust/safety and capital efficiency and offers a framework to evaluate scalability limits within the context of payment channels.