lightninglabs / lightninglabs/taproot-assets

Add enhanced trustless swap itest (anyonecanspend scriptkey)

Open
#857 1 comment 0 reactions 1 assignee View on GitHub

@GeorgeTsagk is already working on this.

Since Feb 3, 2026.

enhancement itests sighash swaps
Dominant language
Go
Stars
525
Forks
150
Avg merge
2d 15h
Merged PRs (30d)
31

Description

## Description

In https://github.com/lightninglabs/taproot-assets/pull/804 we added an itest that follows the trustless swap flow originally described in https://github.com/lightninglabs/taproot-assets/issues/577. That version of the trustless swap ran into some limitations and we had to add a design restriction -- alice can only swap a "whole coin", i.e there can not be any asset change going back to the creator of the swap.

This is because due to the non-interactive nature of the swap, the control of the asset root needs to belong to the swap receiver. By doing so, the swap receiver would be able to burn the creator's asset change. If the swap creator never pays any change back to themselves there's no risk, hence the swap flow makes sense for both parties.

## Enhanced Version

There is a different approach to this, which would not require the swap receiver to be in control of the asset root. The swap creator can pay the amount they wish to swap to an anyone-can-spend script key on the asset level, and let the swap receiver anchor it to an outpoint that they control. This way, the swap receiver will effectively be in full control of the swapped amount.

On the bitcoin level, the swap creator would again use `SIGHASH_SINGLE | ANYONECANPAY` to allow for the swap receiver to plug-in their own btc (to satisfy the creator) and also create extra outputs for their own anchor and btc change.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.