Skip to content

waved: pay asset deposits from the daemon wallet - #1533

Merged
darioAnongba merged 7 commits into
mainfrom
darioAnongba/asset-deposit-funding
Nov 13, 2026
Merged

darioAnongba merged 7 commits into
mainfrom
darioAnongba/asset-deposit-funding

Conversation

@darioAnongba

@darioAnongba darioAnongba commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

The daemon wallet pays and signs the Bitcoin side of an asset deposit, and tapd signs its own asset anchors when it publishes the transfer. waved talks only to tapd: the assets.lnd connection to the lnd behind tapd is removed.

  • Funding. The Onboarder gives the daemon wallet an outputs-only template holding the deposit output and any asset change. The anchors' value, net of the fee for their key-path weight, comes off those outputs down to dust, so the wallet selects only what the anchors leave uncovered; any value left over goes to the wallet's change. Each wallet adapter (lnd, lwwallet, btcwallet) funds it through FundTemplate, which adds inputs and change and leases the inputs without signing. Nested SegWit coins are kept out of selection, because their scriptSig would change the txid tapd seals.
  • Commit. The Onboarder lays the transaction out as anchors, wallet inputs, asset outputs, wallet change, and commits it to tapd as caller-funded exact, so tapd adds no input or output. Anchors carry backend-signed plans and wallet inputs carry caller-signed plans.
  • Retries. The funded template is journaled with its leases before tapd commits, and the leases are renewed until the deposit publishes, so a retry spends the same coins. A refused commit, or a fee above max_fee_sat, releases them; releases and the journal write outlive a cancelled RPC.
  • Signing. The wallet signs and finalizes only its own inputs (SignInputs), on a copy in which the anchors carry no derivation info, so a wallet sharing tapd's lnd cannot sign them. tapd signs the anchors at publish.
  • Fees. A confirmation target resolves through the chain backend's sat/kWU estimate, which the lnd and neutrino backends expose next to their whole sat/vB EstimateFee.

Needs a tapd that signs its own anchor inputs at publish (lightninglabs/taproot-assets#2383, on tapd main), and tap-sdk reporting that capability (lightninglabs/tap-sdk#199). go.mod pins tap-sdk main, which pins tapd main. waved refuses a deposit with FailedPrecondition before recording it when tapd is older than v0.9.0 (development builds report 0.8.99), and the asset deposit systests skip on such a tapd: they skip on the harness's v0.8.5 and pass locally against tapd main. A backend that tap-sdk does not report as signing its anchors fails a deposit with FailedPrecondition before anything is sealed, and the wallet's leased coins are released. Defaults are unchanged. The ledger books the boarded VTXOs as transfers in; booking them like a Bitcoin boarding deposit is a follow-up.

Base automatically changed from darioAnongba/asset-boarding to main November 7, 2026 00:08
@darioAnongba
darioAnongba force-pushed the darioAnongba/asset-deposit-funding branch from 1f62236 to 303547d Compare November 7, 2026 00:13
@darioAnongba darioAnongba self-assigned this Nov 9, 2026
@darioAnongba

Copy link
Copy Markdown
Collaborator Author

/gateway review

@lightninglabs-gateway

Copy link
Copy Markdown

Cannot run /gateway review on a draft PR. Mark it ready for review first.

@darioAnongba
darioAnongba marked this pull request as ready for review November 9, 2026 13:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T13:30:21.113222Z 303547d Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 303547d8c5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tapassets/onboarding.go Resolved
Comment thread tapassets/onboarding.go Resolved
@darioAnongba
darioAnongba force-pushed the darioAnongba/asset-deposit-funding branch 3 times, most recently from 6bbf195 to 554549b Compare November 10, 2026 13:52
@darioAnongba
darioAnongba force-pushed the darioAnongba/asset-deposit-funding branch 2 times, most recently from 95ea542 to 72b8437 Compare November 13, 2026 12:32
The lnd, lwwallet and btcwallet adapters gain FundTemplate, which adds
wallet inputs and change to an outputs-only PSBT at a sat/kWU rate and
leases all of its inputs or none, without signing. SignInputs signs and
finalizes only the inputs whose derivation info the wallet can derive.
FundPsbt funds through FundTemplate and then finalizes.
The Onboarder commits a caller-funded exact transaction: an
OnboardingFunder pays, from native SegWit coins, what the spent tapd
anchors leave uncovered plus the fee, and signs only its own inputs,
while tapd signs its anchors at publish. The funded template is
journaled with its inputs leased before tapd commits, and its leases
are renewed until it publishes, so a retry spends the same coins. A
refused commit releases them.
EstimateFeePerKW returns the fee estimator's rate at full precision,
which EstimateFee truncates to whole sat/vB.
DepositAsset pays and signs the deposit's Bitcoin from the daemon
wallet, and tapd signs its own asset inputs at publish. The daemon
connects only to tapd, and a tapd that tap-sdk does not report as
signing those inputs fails the deposit with FailedPrecondition. Nested
SegWit coins are leased away from coin selection while the wallet
funds, and a confirmation target resolves through the chain backend's
sat/kWU estimate.
DepositAsset needs the tapd backend and a tapd that signs its own asset
inputs at publish. It does not connect to the lnd behind tapd.
The deposit tests run waved on a funded lnd of its own, apart from the
lnd behind tapd, and check that a deposit spends only tapd's anchors and
the daemon wallet's coins.
@darioAnongba
darioAnongba force-pushed the darioAnongba/asset-deposit-funding branch from 72b8437 to cf3f739 Compare November 13, 2026 19:26
@darioAnongba
darioAnongba merged commit 58a7dbf into main Nov 13, 2026
29 of 30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant