Skip to content

Commit

Permalink
Update KeysManager link (#226)
Browse files Browse the repository at this point in the history
  • Loading branch information
mattoshibtc authored Sep 14, 2023
1 parent 19e8450 commit 1453ca8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions docs/key_management.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Key Management

LDK provides a simple default `KeysManager` implementation that takes a 32-byte seed for use as a BIP 32 extended key and derives keys from that. Check out the [Rust docs](https://docs.rs/lightning/*/lightning/chain/keysinterface/struct.KeysManager.html).
LDK provides a simple default `KeysManager` implementation that takes a 32-byte seed for use as a BIP 32 extended key and derives keys from that. Check out the [Rust docs](https://docs.rs/lightning/*/lightning/sign/struct.KeysManager.html).

However, LDK also allows to customize the way key material and entropy are sourced through custom implementations of the `NodeSigner`, `SignerProvider`, and `EntropySource` traits located in `chain::keysinterface`. These traits include basic methods to provide public and private key material, as well as pseudorandom numbers.
However, LDK also allows to customize the way key material and entropy are sourced through custom implementations of the `NodeSigner`, `SignerProvider`, and `EntropySource` traits located in `sign`. These traits include basic methods to provide public and private key material, as well as pseudorandom numbers.

A `KeysManager` can be constructed simply with only a 32-byte seed and some random integers which ensure uniqueness across restarts (defined as `starting_time_secs` and `starting_time_nanos`):

Expand All @@ -13,7 +13,7 @@ A `KeysManager` can be constructed simply with only a 32-byte seed and some rand
// Fill in random_32_bytes with secure random data, or, on restart, reload the seed from disk.
let mut random_32_bytes = [0; 32];
let start_time = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH).unwrap();
let keys_interface_impl = lightning::chain::keysinterface::KeysManager::new(&random_32_bytes, start_time.as_secs(), start_time.subsec_nanos());
let keys_interface_impl = lightning::sign::KeysManager::new(&random_32_bytes, start_time.as_secs(), start_time.subsec_nanos());
```

</template>
Expand Down Expand Up @@ -181,7 +181,7 @@ An advantage to this approach is that the LDK entropy is contained within your i

# Spending On-Chain Funds

When a channel has been closed and some outputs on chain are spendable only by us, LDK provides a `util::events::Event::SpendableOutputs` event in return from `ChannelMonitor::get_and_clear_pending_events()`. It contains a list of `chain::keysinterface::SpendableOutputDescriptor` objects which describe the output and provide all necessary information to spend it.
When a channel has been closed and some outputs on chain are spendable only by us, LDK provides a `util::events::Event::SpendableOutputs` event in return from `ChannelMonitor::get_and_clear_pending_events()`. It contains a list of `sign::SpendableOutputDescriptor` objects which describe the output and provide all necessary information to spend it.

If you're using `KeysManager` directly, a utility method is provided which can generate a signed transaction given a list of `
SpendableOutputDescriptor` objects. `KeysManager::spend_spendable_outputs` can be called any time after receiving the `SpendableOutputDescriptor` objects to build a spending transaction, including delaying until sending funds to an external destination or opening a new channel. Note that if you open new channels directly with `SpendableOutputDescriptor` objects, you must ensure all closing/destination scripts provided to LDK are SegWit (either native or P2SH-wrapped).
Expand Down
2 changes: 1 addition & 1 deletion docs/overview/private_key_management.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ LDK provides a default implementation for key management, but you can choose to

While LDK's default implementation is currently located within the `rust-lightning` crate, it is still considered a sample module.

[LDK's `KeysManager` docs](https://docs.rs/lightning/*/lightning/chain/keysinterface/struct.KeysManager.html).
[LDK's `KeysManager` docs](https://docs.rs/lightning/*/lightning/sign/struct.KeysManager.html).
2 changes: 1 addition & 1 deletion docs/tutorials/build_a_node_in_java.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ generation is unique across restarts.

**Dependencies:** random bytes

**References:** [Rust docs](https://docs.rs/lightning/*/lightning/chain/keysinterface/struct.KeysManager.html), [Java bindings](https://github.com/lightningdevkit/ldk-garbagecollected/blob/main/src/main/java/org/ldk/structs/KeysManager.java), [Key Management guide](/key_management.md)
**References:** [Rust docs](https://docs.rs/lightning/*/lightning/sign/struct.KeysManager.html), [Java bindings](https://github.com/lightningdevkit/ldk-garbagecollected/blob/main/src/main/java/org/ldk/structs/KeysManager.java), [Key Management guide](/key_management.md)

### 10. Read `ChannelMonitor`s from disk

Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/build_a_node_in_rust.md
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ generation is unique across restarts.

**Dependencies:** random bytes

**References:** [`KeysManager` docs](https://docs.rs/lightning/*/lightning/chain/keysinterface/struct.KeysManager.html), [Key Management guide](/key_management.md)
**References:** [`KeysManager` docs](https://docs.rs/lightning/*/lightning/sign/struct.KeysManager.html), [Key Management guide](/key_management.md)

### Step 7. Read `ChannelMonitor` state from disk

Expand Down

0 comments on commit 1453ca8

Please sign in to comment.