Repository navigation
Conversation
LND's remote signer is given the BOLT 3 tweak SHA256(per_commitment_point || basepoint), never the per-commitment point, so bolt3_derive cannot serve it. LND signs the HTLC and delayed outputs of a commitment with keys derived this way. Add bolt3_derive_from_tweak and its public key variant to the core, the C API and every binding, with tests and spec. DKLs23 0.6.2 has no such call, so the core applies the shift through Party's public fields, as ShareMap does with a factor of one. The tweak is only ever added, never multiplied.
Jossec101
force-pushed
the
feat/bolt3-derive-from-tweak
branch
from
December 1, 2026 16:26
967c482 to
15362c4
Compare
Jossec101
marked this pull request as ready for review
December 1, 2026 16:54
markettes
approved these changes
Dec 2, 2026
| let tweak = Option::<Scalar>::from(Scalar::from_repr(repr.into())) | ||
| .ok_or_else(|| TssError::InvalidConfig("invalid tweak".into()))?; | ||
| if bool::from(tweak.is_zero()) { | ||
| return Err(bolt3_error(Bolt3Error::HashOutOfRange)); |
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.
Why
LND's remote signer receives the BOLT 3 tweak
SHA256(per_commitment_point || basepoint)and never the per-commitment point: it is signrpc'ssingle_tweak, and PSBT field0x51in LND's remote-signing client.bolt3_deriveneeds the point, so it cannot serve that signer.What
bolt3::bolt3_derive_from_tweakandbolt3_derive_from_tweak_public_keysgive thebolt3_deriveresult from the tweak. They are secp256k1 only, like the other BOLT 3 calls. A zero, out-of-range or wrong-length tweak is refused.x + t), never multiplied. A signature underX + t·Gis a signature underXon the hashm + r·t, and the session binding fixestbeforerexists.Party's public fields, as DKLs23'sShareMapdoes with a factor of one.tss_bolt3_derive_from_tweakandtss_bolt3_derive_from_tweak_pubkey_package, with the header regenerated. Go, WASM, Node, React Native, Python and .NET wrappers. Spec 03, 06 and 07.bolt3_derive. The derived shares sign. Invalid inputs are refused.Tests
cargo test --locked --workspace --release, clippy with-D warnings,cargo fmt --check.-tags libtss_local,libtss_testhooks), Python, .NET and Node against the release build. WASM withwasm-pack test --node --features testing.