Add DeriveAndStoreKey RPC - #288
Open
GeorgeTsagk wants to merge 2 commits into
Open
Conversation
GeorgeTsagk
added a commit
to GeorgeTsagk/taproot-assets
that referenced
this pull request
Aug 18, 2026
Recording a key in LND implies recording every key that precedes it, so restoring a key family's index is one DeriveAndStoreKey call per family instead of one DeriveNextKey per index. LND keeps that operation monotonic and bounds the number of keys it derives, so the local advance loop, the rewind guard and the maxKeyIndexAdvance limit are no longer needed here. Requires an LND with the DeriveAndStoreKey RPC (lightningnetwork/lnd#11095) and the lndclient wrapper for it (lightninglabs/lndclient#288).
GeorgeTsagk
added a commit
to GeorgeTsagk/taproot-assets
that referenced
this pull request
Aug 18, 2026
Recording a key in LND implies recording every key that precedes it, so restoring a key family's index is one DeriveAndStoreKey call per family instead of one DeriveNextKey per index. LND keeps that operation monotonic and bounds the number of keys it derives, so the local advance loop, the rewind guard and the maxKeyIndexAdvance limit are no longer needed here. Requires an LND with the DeriveAndStoreKey RPC (lightningnetwork/lnd#11095) and the lndclient wrapper for it (lightninglabs/lndclient#288).
GeorgeTsagk
added a commit
to GeorgeTsagk/taproot-assets
that referenced
this pull request
Aug 18, 2026
Recording a key in LND implies recording every key that precedes it, so restoring a key family's index is one DeriveAndStoreKey call per family instead of one DeriveNextKey per index. LND keeps that operation monotonic and bounds the number of keys it derives, so the local advance loop, the rewind guard and the maxKeyIndexAdvance limit are no longer needed here. Requires an LND with the DeriveAndStoreKey RPC (lightningnetwork/lnd#11095) and the lndclient wrapper for it (lightninglabs/lndclient#288).
GeorgeTsagk
added a commit
to GeorgeTsagk/taproot-assets
that referenced
this pull request
Aug 18, 2026
Recording a key in LND implies recording every key that precedes it, so restoring a key family's index is one DeriveAndStoreKey call per family instead of one DeriveNextKey per index. LND keeps that operation monotonic and bounds the number of keys it derives, so the local advance loop, the rewind guard and the maxKeyIndexAdvance limit are no longer needed here. Requires an LND with the DeriveAndStoreKey RPC (lightningnetwork/lnd#11095) and the lndclient wrapper for it (lightninglabs/lndclient#288).
Wraps lnd's new DeriveAndStoreKey RPC, which derives a key at an arbitrary index and also records it in the wallet. Recording a key is what lets the wallet map the key's public key back to its locator, which it needs in order to sign with the key, and it advances the key family's derivation index past the recorded index.
The wrapper added in the previous commit calls an RPC that does not exist in any released LND yet, so this points the LND dependency at the branch of lightningnetwork/lnd#11095 to make the build work in the meantime. This commit must be dropped in favor of a normal LND version bump before this branch can be merged.
GeorgeTsagk
force-pushed
the
derive-and-store-key
branch
from
August 19, 2026 12:39
2c8ee79 to
7d3fdf0
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Wraps lnd's new
DeriveAndStoreKeyRPC, which derives a key at an arbitrary index and also records it in the wallet. Recording a key is what lets the wallet map the key's public key back to its locator, which it needs in order to sign with the key, and it advances the key family's derivation index past the recorded index.Depends on lightningnetwork/lnd#11095