Discover more from bolt.observer
Auto Swaps Explained
Liquidity automation with workflows
The management of liquidity on a lightning node remains one of the most critical pain points in the industry. Depleted channels, offline nodes, unreachable peers, and skyrocketing on-chain fees are just the first bullet points of a long list of issues that can arise on a node. Without proper tooling to detect and take action automatically, a node operator's day can turn into hundreds of manual tasks.
We have developed a workflow-based lightning node automation solution to simplify the process and eliminate the need for manual intervention. The solution simplifies the connection of various applications and services by harnessing the power of conditional logic and custom triggers, enabling seamless interactions and task execution.
So, how does this make liquidity management easier? We have added a boltz plugin to our agent, allowing automatic swaps execution. We have been using their services for a long time and wanted to enable our clients to transform their business rules into streamlined workflows, while automating liquidity management with submarine swaps. The process is simple: configure automated rules to manage your liquidity with swaps.
Submarine swap is a particular type of atomic swap between on-chain and off-chain funds. This means it does not bear counterparty risk. Either the swap will go through entirely, or nothing will happen. It works in a similar trustless fashion as payments on the lightning network via HTLCs (hashed time-lock contracts). In practice, if the exchange is dishonest, your funds might get locked up for a while, but you will not lose money.
There are three common scenarios where submarine swaps can be used to address liquidity challenges in Lightning Network channels:
Low inbound liquidity: Perform a reverse submarine swap (swap-out) to push funds to the other side of the channel and receive on-chain funds.
Low outbound liquidity: Perform an on-chain transaction, and the swap service provider will pay your invoice to refill the channel, also known as a swap-in.
Low channel inbound liquidity: Perform a reverse submarine swap (swap-out) to pay only through specific channels.
In practice, an operator initiates a submarine swap when the liquidity is too low. This is a manual process, and often, it implies a delay between the depletion of a channel and the detection of that state, making the channel unusable for some time. No one really wants to spend 24/7 behind a node to check when a swap is needed.
Here comes the idea of an automated swap, aka auto swaps.
What are auto swaps?
An auto swap is a proactive action configured by a node operator in anticipation of potential liquidity issues in the future, aiming to restore liquidity to a predefined level. It is executed automatically when the specified trigger conditions are met.
Unlike regular swaps that involve a fixed amount, auto swaps are designed to maintain a desired liquidity level as a reference. Auto swaps can trigger multiple swaps to restore liquidity to the desired level, ensuring that the channel or node remains adequately funded. Here is an illustration of 2 auto swaps-out executed as soon as the trigger is activated:
If you feel like automating some of the most time-consuming tasks, we provide an explanation of a workflow creation with swaps in this thread.
Context of high on-chain fees
You might be wondering if auto swaps can still be used in the context of skyrocketing on-chain fees since submarine swaps require at least one on-chain transaction. The answer is yes, and we can keep these fees under control even when the mempool is crowded.
The agent has been thought to allow granular configuration of actions with opt-in flags, and one option allows the swap cost control. To achieve this, configure the agent with the —
maxfeepercentage flag to set an upper limit on the cost of a swap. For instance, setting —
maxfeepercentage to 1% means that the total cost of an 8M sat swap, including Boltz fees, off-chain fees, and on-chain fees, will never exceed 80k sats.
For more details on swaps cost breakdown, we provide examples of fees estimation for optiondifferent use cases.
The journey doesn't end here! We're constantly striving to enhance our services with optionnew plugins, allowing you to streamline liquidity management and execute your strategies. The Lightning network industry is still in its early stages, and we need to foster many use cases to answer the needs of our growing community. Therefore, our agent is equipped with a plugin system that enables you to create custom workflows with triggers and actions.
We value your input and would love to hear which plugins you believe should be given priority. Your feedback is incredibly valuable because it enables us to tailor our offerings to meet your needs and provide the best possible solutions to the community.
Thanks for reading bolt.observer! Subscribe for free to receive new posts and support my work.