delvingbitcoin

Expanding on BOLT12

Expanding on BOLT12

Original Postby andyschroder

Posted on: September 29, 2024 04:18 UTC

The recent merger of BOLT12 into the main repository, as documented in this pull request, marks a significant advancement in its development, with implementations beginning to emerge in practical scenarios.

This development prompts a discussion on potential enhancements and modifications to improve its functionality further. One area of interest is the mechanism by which invoice_request and invoice writers are required to replicate all fields from their predecessors, including those that are unknown, hinting at a structural flexibility that could allow for the incorporation of additional fields in a backward-compatible manner. A notable proposition in this context is the addition of a user field within the invoice_request, as detailed in a proposal found here.

Among the enhancements being considered is the introduction of an optional boolean refund_invoice_required field for offer writers. If set to true, it mandates invoice_request writers to include a refund_invoice field containing an encoded refund invoice, proposing the use of lni as a prefix for these invoices. This innovation aims to streamline the refund process, enabling merchants to automate refunds without necessitating direct interaction with customers for each transaction. This could be particularly useful in situations where merchants operate with static offers displayed on physical media, such as stickers, without the capability to generate dynamic invoice_requests for refunds.

Additionally, the suggestion to establish a offer_max_amount within the offer structure addresses the need to limit transactions to a maximum permissible amount. This feature caters to various operational constraints and preferences, such as inventory limitations, liquidity concerns, the use of HOLD invoices, and the desire to manage customer relationships and expectations regarding the scale of transactions. While the enforcement of maximum amounts through HTLCs may not be directly feasible, communicating such limits upfront could prevent misunderstandings and discourage attempts to exceed agreed transaction volumes.

The absence of an expiration mechanism for invoice_requests raises questions about the management of offer lifecycles, especially in contexts where timing is crucial, and the risk of delayed responses could invalidate the relevance of a transaction. Implementing an expiry for invoice_requests similar to that of offers and invoices could enhance the efficiency and reliability of the BOLT12 protocol by ensuring that all components of a transaction remain valid only within a mutually understood timeframe.

In conclusion, these discussions and proposals signify a collective effort to refine and evolve the BOLT12 standard, inviting feedback from the community to steer its development towards meeting the diverse needs and challenges of real-world implementation.