-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8ee5f62
commit cc5efd9
Showing
17 changed files
with
456 additions
and
17 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
[package] | ||
name = "cdk-phoenixd" | ||
version = { workspace = true } | ||
edition = "2021" | ||
authors = ["CDK Developers"] | ||
homepage.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true # MSRV | ||
license.workspace = true | ||
description = "CDK ln backend for phoenixd" | ||
|
||
[dependencies] | ||
async-trait.workspace = true | ||
anyhow.workspace = true | ||
axum.workspace = true | ||
bitcoin.workspace = true | ||
cdk = { workspace = true, default-features = false, features = ["mint"] } | ||
futures.workspace = true | ||
tokio.workspace = true | ||
tracing.workspace = true | ||
thiserror.workspace = true | ||
phoenixd-rs = "0.2.0" | ||
# phoenixd-rs = { path = "../../../../phoenixd-rs" } | ||
uuid.workspace = true |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# cdk-phoenixd | ||
|
||
## Run phoenixd | ||
|
||
The `phoenixd` node is included in the cdk and needs to be run separately. | ||
Get started here: [Phoenixd Server Documentation](https://phoenix.acinq.co/server/get-started) | ||
|
||
## Start Phoenixd | ||
|
||
By default, `phoenixd` will run with auto-liquidity enabled. While this simplifies channel management, it makes fees non-deterministic, which is not recommended for most scenarios. However, it is necessary to start with auto-liquidity enabled in order to open a channel and get started. | ||
|
||
Start the node with auto-liquidity enabled as documented by [Phoenixd](https://phoenix.acinq.co/server/get-started): | ||
```sh | ||
./phoenixd | ||
``` | ||
|
||
> **Note:** By default the `auto-liquidity` will open a channel of 2m sats depending on the size of mint you plan to run you may want to increase this by setting the `--auto-liquidity` flag to `5m` or `10m`. | ||
## Open Channel | ||
|
||
Once the node is running, create an invoice using the phoenixd-cli to fund your node. A portion of this deposit will go to ACINQ as a fee for the provided liquidity, and a portion will cover the mining fee. These two fees cannot be refunded or withdrawn from the node. More on fees can be found [here](https://phoenix.acinq.co/server/auto-liquidity#fees). The remainder will stay as the node balance and can be withdrawn later. | ||
```sh | ||
./phoenix-cli createinvoice \ | ||
--description "Fund Node" \ | ||
--amountSat xxxxx | ||
``` | ||
|
||
> **Note:** The amount above should be set depending on the size of the mint you would like to run as it will determine the size of the channel and amount of liquidity. | ||
## Check Channel state | ||
|
||
After paying the invoice view that a channal has been opened. | ||
```sh | ||
./phoenix-cli listchannels | ||
``` | ||
|
||
## Restart Phoenixd without `auto-liquidity` | ||
|
||
Now that the node has a channel, it is recommended to stop the node and restart it without auto-liquidity. This will prevent phoenixd from opening new channels and incurring additional fees. | ||
```sh | ||
./phoenixd --auto-liquidity off | ||
``` | ||
|
||
## Start cashu-mintd | ||
|
||
Once the node is running following the [cashu-mintd](../cdk-mintd/README.md) to start the mint. by default the `api_url` will be `http://127.0.0.1:9740` and the `api_password` can be found in `~/.phoenix/phoenix.conf` these will need to be set in the `cdk-mintd` config file. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
//! Error for phoenixd ln backend | ||
use thiserror::Error; | ||
|
||
/// Phoenixd Error | ||
#[derive(Debug, Error)] | ||
pub enum Error { | ||
/// Invoice amount not defined | ||
#[error("Unknown invoice amount")] | ||
UnknownInvoiceAmount, | ||
/// Unknown invoice | ||
#[error("Unknown invoice")] | ||
UnknownInvoice, | ||
/// Unsupported unit | ||
#[error("Unit Unsupported")] | ||
UnsupportedUnit, | ||
/// Anyhow error | ||
#[error(transparent)] | ||
Anyhow(#[from] anyhow::Error), | ||
} | ||
|
||
impl From<Error> for cdk::cdk_lightning::Error { | ||
fn from(e: Error) -> Self { | ||
Self::Lightning(Box::new(e)) | ||
} | ||
} |
Oops, something went wrong.