Skip to content

Commit dc555d0

Browse files
benthecarmanclaude
andcommitted
Add initial guides & documentation
Add docs/ directory with guides for getting started, configuration, the gRPC API, Tor setup, and production operations. Add per-crate READMEs for ldk-server-client, ldk-server-grpc, and ldk-server-cli. Include READMEs in lib.rs via doc = include_str! so rustdoc validates the code examples. Update the root README to link to the new docs and fix outdated REST/port references. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5bd1c61 commit dc555d0

15 files changed

Lines changed: 1065 additions & 66 deletions

File tree

CONTRIBUTING.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cargo build --release # Production build (LTO enabled)
1313
## Running
1414

1515
```bash
16-
cargo run --bin ldk-server ./ldk-server/ldk-server-config.toml
16+
cargo run --bin ldk-server ./contrib/ldk-server-config.toml
1717
```
1818

1919
## Testing
@@ -54,7 +54,7 @@ cargo fmt --all
5454

5555
## Configuration
5656

57-
- Config template with all options: `ldk-server/ldk-server-config.toml`
57+
- Config template with all options: `contrib/ldk-server-config.toml`
5858
- When updating config options, also update the tests in `ldk-server/src/util/config.rs`
5959

6060
## Before Submitting

README.md

Lines changed: 24 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ a Lightning node while exposing a robust, language-agnostic API via [Protocol Bu
1515
- Deploy a Lightning Network node with minimal configuration, no coding required.
1616

1717
- **API-First Design**:
18-
- Exposes a well-defined API using Protobuf, allowing seamless integration with HTTP-clients or applications.
18+
- Exposes a well-defined gRPC API using Protobuf, allowing seamless integration with any language.
1919

2020
- **Powered by LDK**:
2121
- Built on top of LDK-Node, leveraging the modular, reliable, and high-performance architecture of LDK.
@@ -26,67 +26,38 @@ a Lightning node while exposing a robust, language-agnostic API via [Protocol Bu
2626

2727
### Project Status
2828

29-
🚧 **Work in Progress**:
30-
- **APIs Under Development**: Expect breaking changes as the project evolves.
31-
- **Potential Bugs and Inconsistencies**: While progress is being made toward stability, unexpected behavior may occur.
32-
- **Improved Logging and Error Handling Coming Soon**: Current error handling is rudimentary (specially for CLI), and usability improvements are actively being worked on.
33-
- **Pending Testing**: Not tested, hence don't use it for production!
29+
**Work in Progress**:
30+
- APIs are under development. Expect breaking changes as the project evolves.
31+
- Not tested for production use.
32+
- We welcome your feedback and contributions to help shape the future of LDK Server!
3433

35-
We welcome your feedback and contributions to help shape the future of LDK Server!
34+
### Quick Start
3635

37-
38-
### Configuration
39-
Refer `./ldk-server/ldk-server-config.toml` to see available configuration options.
40-
41-
You can configure the node via a TOML file, environment variables, or CLI arguments. All options are optional — values provided via CLI override environment variables, which override the values in the TOML file.
42-
43-
### Building
44-
```
36+
```bash
4537
git clone https://github.com/lightningdevkit/ldk-server.git
46-
cargo build
47-
```
48-
49-
### Running
50-
- Using a config file:
51-
```
52-
cargo run --bin ldk-server ./ldk-server/ldk-server-config.toml
38+
cd ldk-server
39+
cargo build --release
40+
cp contrib/ldk-server-config.toml my-config.toml # edit with your settings
41+
./target/release/ldk-server my-config.toml
5342
```
5443

55-
- Using environment variables (all optional):
56-
```
57-
export LDK_SERVER_NODE_NETWORK=regtest
58-
export LDK_SERVER_NODE_LISTENING_ADDRESS=localhost:3001
59-
export LDK_SERVER_NODE_REST_SERVICE_ADDRESS=127.0.0.1:3002
60-
export LDK_SERVER_NODE_ALIAS=LDK-Server
61-
export LDK_SERVER_BITCOIND_RPC_ADDRESS=127.0.0.1:18443
62-
export LDK_SERVER_BITCOIND_RPC_USER=your-rpc-user
63-
export LDK_SERVER_BITCOIND_RPC_PASSWORD=your-rpc-password
64-
export LDK_SERVER_STORAGE_DIR_PATH=/path/to/storage
65-
cargo run --bin ldk-server
66-
```
67-
68-
Interact with the node using CLI:
69-
```
70-
ldk-server-cli -b localhost:3002 --api-key your-secret-api-key --tls-cert /path/to/tls_cert.pem onchain-receive # To generate onchain-receive address.
71-
ldk-server-cli -b localhost:3002 --api-key your-secret-api-key --tls-cert /path/to/tls_cert.pem help # To print help/available commands.
72-
```
73-
74-
### Shell Completions
44+
See [Getting Started](docs/getting-started.md) for a full walkthrough.
7545

76-
The CLI supports generating shell completions for Bash, Zsh, Fish, Elvish, and PowerShell.
46+
### Documentation
7747

78-
Add completions to your shell config:
79-
```bash
80-
# Bash (add to ~/.bashrc)
81-
eval "$(ldk-server-cli completions bash)"
48+
| Document | Description |
49+
|----------|-------------|
50+
| [Getting Started](docs/getting-started.md) | Install, configure, and run your first node |
51+
| [Configuration](docs/configuration.md) | All config options, environment variables, and Bitcoin backend tradeoffs |
52+
| [API Guide](docs/api-guide.md) | gRPC transport, authentication, and endpoint reference |
53+
| [Tor](docs/tor.md) | Connecting to and receiving connections over Tor |
54+
| [Operations](docs/operations.md) | Production deployment, backups, and monitoring |
8255

83-
# Zsh (add to ~/.zshrc)
84-
eval "$(ldk-server-cli completions zsh)"
56+
### API
8557

86-
# Fish (add to ~/.config/fish/config.fish)
87-
ldk-server-cli completions fish | source
88-
```
58+
The canonical API definitions are in [`ldk-server-grpc/src/proto/`](ldk-server-grpc/src/proto/). A ready-made
59+
Rust client library is provided in [`ldk-server-client/`](ldk-server-client/).
8960

90-
## Contributing
61+
### Contributing
9162

9263
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on building, testing, code style, and development workflow.
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# Lightning node settings
22
[node]
33
network = "regtest" # Bitcoin network to use
4-
listening_addresses = ["localhost:3001"] # Lightning node listening addresses
5-
announcement_addresses = ["54.3.7.81:3001"] # Lightning node announcement addresses
6-
#grpc_service_address = "127.0.0.1:3536" # LDK Server gRPC address (optional, defaults to 127.0.0.1:3536)
4+
listening_addresses = ["localhost:9735"] # Lightning node listening addresses
5+
#announcement_addresses = ["54.3.7.81:9735"] # Lightning node announcement addresses
6+
#grpc_service_address = "127.0.0.1:3536" # LDK Server gRPC address (optional, defaults to 127.0.0.1:3536)
77
alias = "ldk_server" # Lightning node alias
88
#pathfinding_scores_source_url = "" # External Pathfinding Scores Source
99
#rgs_server_url = "https://rapidsync.lightningdevkit.org/snapshot/v2/" # Optional: RGS URL for rapid gossip sync
@@ -14,12 +14,12 @@ dir_path = "/tmp/ldk-server/" # Path for LDK and BDK data persis
1414

1515
[log]
1616
level = "Debug" # Log level (Error, Warn, Info, Debug, Trace)
17-
file = "/tmp/ldk-server/ldk-server.log" # Log file path
17+
#file = "/tmp/ldk-server/ldk-server.log" # Log file path
1818

1919
[tls]
2020
#cert_path = "/path/to/tls.crt" # Path to TLS certificate, by default uses dir_path/tls.crt
2121
#key_path = "/path/to/tls.key" # Path to TLS private key, by default uses dir_path/tls.key
22-
hosts = ["example.com"] # Allowed hosts for TLS, will always include "localhost" and "127.0.0.1"
22+
#hosts = ["example.com"] # Allowed hosts for TLS, will always include "localhost" and "127.0.0.1"
2323

2424
# Must set one of bitcoind, electrum, or esplora
2525

@@ -100,4 +100,4 @@ poll_metrics_interval = 60 # The polling interval for metrics in seconds.
100100
# Tor Config
101101
[tor]
102102
# Only connections to OnionV3 peers will be made via this proxy; other connections (IPv4 peers, Electrum server) will not be routed over Tor.
103-
#proxy_address = "" # Tor daemon SOCKS proxy address.
103+
#proxy_address = "127.0.0.1:9050" # Tor daemon SOCKS proxy address.

contrib/ldk-server.service

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[Unit]
2+
Description=LDK Server Lightning Node
3+
After=network-online.target bitcoind.service
4+
Wants=network-online.target
5+
6+
[Service]
7+
Type=notify
8+
ExecStart=/usr/local/bin/ldk-server /etc/ldk-server/config.toml
9+
Restart=always
10+
RestartSec=10
11+
12+
# Security hardening
13+
User=ldk-server
14+
ProtectSystem=strict
15+
NoNewPrivileges=true
16+
PrivateTmp=true
17+
PrivateDevices=true
18+
MemoryDenyWriteExecute=true
19+
ReadWritePaths=/var/lib/ldk-server
20+
21+
[Install]
22+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)