|
| 1 | +# Getting started |
| 2 | + |
| 3 | +Welcome to the Lightning Development Kit documentation! |
| 4 | + |
| 5 | +If you have any questions about anything related to LDK, feel free to ask our community on [GitHub Discussions](https://github.com/orgs/lightningdevkit/discussions) or join us on [Discord](https://discord.gg/5AcknnMfBw). |
| 6 | + |
| 7 | +## System Requirements |
| 8 | +MacOS, Windows and Linux are supported. |
| 9 | +## Installation |
| 10 | +To add LDK to a project, run: |
| 11 | + |
| 12 | +<CodeSwitcher :languages="{rust:'Rust', java:'Java', kotlin:'Kotlin', javascript:'JavaScript'}"> |
| 13 | + <template v-slot:rust> |
| 14 | + |
| 15 | + ```toml |
| 16 | + # Add the following dependencies to your cargo.toml and replace {VERSION} with the version number you want to use. |
| 17 | + |
| 18 | + [dependencies] |
| 19 | + lightning = { version = {VERSION}, features = ["max_level_trace"] } |
| 20 | + lightning-block-sync = { version = {VERSION}, features = [ "rpc-client" ] } |
| 21 | + lightning-invoice = { version = {VERSION} } |
| 22 | + lightning-net-tokio = { version = {VERSION} } |
| 23 | + lightning-persister = { version = {VERSION} } |
| 24 | + lightning-background-processor = { version = {VERSION} } |
| 25 | + lightning-rapid-gossip-sync = { version = {VERSION} } |
| 26 | + ``` |
| 27 | + |
| 28 | + </template> |
| 29 | + <template v-slot:java> |
| 30 | + |
| 31 | + ```xml |
| 32 | + <!-- |
| 33 | + For Maven, add the following dependency to your POM and replace {VERSION} with the |
| 34 | + version number you want to use. |
| 35 | + --> |
| 36 | + |
| 37 | + <dependency> |
| 38 | + <groupId>org.lightningdevkit</groupId> |
| 39 | + <artifactId>ldk-java</artifactId> |
| 40 | + <version>{VERSION}</version> |
| 41 | + </dependency> |
| 42 | + ``` |
| 43 | + |
| 44 | + ```kotlin |
| 45 | + /* |
| 46 | + For Gradle, add the following dependency to your build.gradle and replace {VERSION} with |
| 47 | + the version number you want to use. |
| 48 | + */ |
| 49 | + |
| 50 | + dependencies { |
| 51 | + // ... |
| 52 | + implementation 'org.lightningdevkit:ldk-java:{VERSION}' |
| 53 | + // ... |
| 54 | + } |
| 55 | + ``` |
| 56 | + |
| 57 | + </template> |
| 58 | + <template v-slot:kotlin> |
| 59 | + |
| 60 | + ```kotlin |
| 61 | + /* To include the LDK Kotlin bindings in an Android project download the latest binary from https://github.com/lightningdevkit/ldk-garbagecollected/releases and place it in your libs directory. |
| 62 | + Then add to your build.gradle file: |
| 63 | + */ |
| 64 | + |
| 65 | + dependencies { |
| 66 | + // ... |
| 67 | + implementation fileTree(include: ['*.aar'], dir: 'libs') |
| 68 | + // ... |
| 69 | + } |
| 70 | + ``` |
| 71 | + |
| 72 | + </template> |
| 73 | + <template v-slot:javascript> |
| 74 | + |
| 75 | + ```javascript |
| 76 | + npm i lightningdevkit --save |
| 77 | + ``` |
| 78 | + |
| 79 | + </template> |
| 80 | +</CodeSwitcher> |
| 81 | + |
| 82 | +Example usage after installation is complete: |
| 83 | + |
| 84 | +<CodeSwitcher :languages="{rust:'Rust', java:'Java', kotlin:'Kotlin', javascript:'JavaScript'}"> |
| 85 | + <template v-slot:rust> |
| 86 | + |
| 87 | + ```rust |
| 88 | + use lightning::chain::chaininterface::FeeEstimator; |
| 89 | + ``` |
| 90 | + |
| 91 | + </template> |
| 92 | + <template v-slot:java> |
| 93 | + |
| 94 | + ```java |
| 95 | + import org.ldk.structs.FeeEstimator |
| 96 | + ``` |
| 97 | + |
| 98 | + </template> |
| 99 | + <template v-slot:kotlin> |
| 100 | + |
| 101 | + ```kotlin |
| 102 | + import org.ldk.structs.FeeEstimator |
| 103 | + ``` |
| 104 | + |
| 105 | + </template> |
| 106 | + <template v-slot:javascript> |
| 107 | + |
| 108 | + ```javascript |
| 109 | + import { FeeEstimator } from "lightningdevkit"; |
| 110 | + import * as fs from "fs"; |
| 111 | + import { strict as assert } from "assert"; |
| 112 | + |
| 113 | + const wasm_file = fs.readFileSync("node_modules/lightningdevkit/liblightningjs.wasm"); |
| 114 | + await ldk.initializeWasmFromBinary(wasm_file); |
| 115 | + ``` |
| 116 | + |
| 117 | + </template> |
| 118 | +</CodeSwitcher> |
0 commit comments