Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
157 changes: 129 additions & 28 deletions .github/docs/Contributing.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,129 @@
Development
-----------
* Clone the project: git clone https://github.com/ElementsProject/cln-application.git
* Change directory: cd cln-application
* Install dependencies: Assuming that nodejs (v14 & above) and npm are already installed, run `npm install`.
* Setup environment variables: Assuming that bitcoind and core-lightning are already running, adjust environment variables listed in `./env.sh` file and execute the script with `'. env.sh'` to setup required environment variables to connect to the node.
* Setup Commando auth: Update `LIGHTNING_PUBKEY` and `LIGHTNING_RUNE` variables in `.commando` for successful backend authentication and connection via commando. Or run `entrypoint.sh` with correct lightningd path to do the same.
* Run backend server: Get backend server up by running `npm run backend:serve`.
* Watch backend server: Watch backend server for realtime changes with `npm run backend:watch`.
* React frontend server: React development server is set to serve on port 4300. Run `npm run frontend:dev` script to get it working.


Releasing and packaging on Github
----------------------------------
* Merge the `Release-<x.y.z>` branch into `main` branch.
* Set VERSION env `VERSION=v<x.y.z>`.
* Tag the commit with `git tag -a -s ${VERSION} -m ${VERSION} && git push --tags`.
* Go to repo's `Releases` page and draft a new release from above tag.
* Prepare release notes with the help of milestone, issues and PRs. Add them on the release page.
* Signing the release:
** `mkdir -p ./release & git archive --format zip --output ./release/cln-application-${VERSION}.zip main`
** `cd release`
** `sha256sum cln* > SHA256SUMS`
** `gpg -sb --armor -o SHA256SUMS.asc SHA256SUMS`
* Verify the release with `gpg --verify SHA256SUMS.asc`.
* Upload `cln-application-${VERSION}.zip`, `SHA256SUMS` and `SHA256SUMS.asc` files on release assets.
* Go to repo's `Actions` tab and confirm that actions have been triggered for `Artifact` and `Build and publish Github image`.
* Confirm that both actions finished successfully and the latest package is available at `https://github.com/orgs/ElementsProject/packages?repo_name=cln-application`.
Development Setup
------------------
### Prerequisites
- Node.js (v14 or higher)
- npm
- Running instances of bitcoind and core-lightning

### Installation
#### Clone the repository:

```sh
git clone https://github.com/ElementsProject/cln-application.git
cd cln-application
```

#### Install dependencies:

```sh
npm install
```

#### Configure environment:

```sh
cp env.sh env-local.sh
# Edit env-local.sh with your configuration
source env-local.sh
```

#### Set up Commando authentication:
- Manually update `LIGHTNING_PUBKEY` and `LIGHTNING_RUNE` in your `LIGHTNING_VARS_FILE`
- OR Run the setup script:

```sh
source entrypoint.sh
```

Running the Application
------------------------
### Backend server:

```sh
npm run backend:watch
npm run backend:serve
```

### Frontend development server (port 4300):
```sh
npm run frontend:dev
```

Creating a Pull Request
------------------------
- Fork the repository on GitHub
- Create a feature branch:

```sh
git checkout -b feat/your-feature-name
```
- Commit your changes:

```sh
git commit -m "feat: description of your changes"
```
- Push to your fork:

```sh
git push fork feat/your-feature-name
```
- Open a PR against the next-release branch
- Include clear description
- Add relevant labels
- Request reviews from maintainers

- Code Standards
- Include tests for new features
- Update documentation when adding/changing functionality
- Keep commits atomic and well-described

- Basic Git Workflow:
<p align="center">
<img src="./.github/images/basic-git-flow.jpg" alt="Basic Github Workflow">
</p>

Release Process
----------------

- Merge the release branch into main:

```sh
git checkout main
git merge Release-yy.mm.n
```
- Create versioned tag:

```sh
export VERSION=vyy.mm.n
git tag -a -s $VERSION -m "$VERSION"
git push --tags
```

- Creating the Release On GitHub:
- Go to Repository → Releases → Draft new release
- Select the tag you created
- Add release notes summarizing changes

- Package and sign the release:

```sh
mkdir -p ./release
git archive --format zip --output ./release/cln-application-${VERSION}.zip main
cd release
sha256sum cln* > SHA256SUMS
gpg -sb --armor -o SHA256SUMS.asc SHA256SUMS
```

- Verify the signature:

```sh
gpg --verify SHA256SUMS.asc
```

- Upload to GitHub:
- Add cln-application-${VERSION}.zip
- Add SHA256SUMS and SHA256SUMS.asc

- Post-Release Checks
- Verify CI/CD pipelines complete successfully
- Confirm package availability at: https://github.com/orgs/ElementsProject/packages?repo_name=cln-application
Binary file added .github/images/basic-git-flow.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,30 +52,33 @@
This application accepts & depends upon these variables to be passed through environment:

```
- BITCOIN_HOST: Hostname/IP address of bitcoin node container (configurable to run lightningd with `--bitcoin-rpcconnect`, default: `localhost`)
- BITCOIN_NETWORK: Bitcoin network type (for entrypoint.sh and lightningd with `--network`; valid values: bitcoin/signet/testnet/regtest; default: `bitcoin`)
# Required by entrypoint.sh script
- LIGHTNING_DATA_DIR: Path for core lightning (used by entrypoint.sh, default: ``)
- BITCOIN_NETWORK: Bitcoin network type (for entrypoint.sh; valid values: bitcoin/signet/testnet/regtest; default: `bitcoin`)

# cln-application Values
- APP_SINGLE_SIGN_ON: Flag to bypass application level authentication (valid values: true/false, default: false)
- APP_PROTOCOL: Protocol on which the application will be served (valid values: http/https, default: `http`)
- APP_HOST: Hostname/IP address of cln-application's container (default: `localhost`)
- APP_PORT: Port on which this application should be served (default: `2103`)

- APP_CONFIG_FILE: Path for cln-application's configuration file (default: `./config.json`)
- APP_LOG_FILE: Path for cln-application's log file (default: `./application-cln.log`)
- APP_MODE: Mode for logging and other settings (valid values: production/development/testing, default: `production`)
- APP_CONNECT: Choose how to connect to CLN (valid values: COMMANDO/REST/GRPC, default: `COMMANDO`)

- LIGHTNING_DATA_DIR: Path for core lightning (used by entrypoint.sh, default: ``)
# Core lightning Values
- LIGHTNING_HOST: IP address of Core lightning node container (used for `COMMANDO` APP_CONNECT, default: `localhost`)
- LIGHTNING_TOR_HOST: REST hidden service url (default: ``)

- LIGHTNING_VARS_FILE: Full Path including the file name for connection auth with LIGHTNING_PUBKEY & LIGHTNING_RUNE (defult: `./.commando-env`)

# CLN Commando (WS) Values
- LIGHTNING_WS_PROTOCOL: Core lightning's web socket is serving on ws or serving via WSSProxy (valid values: ws/wss, default: `ws`)
- LIGHTNING_WS_PORT: Core lightning's websocket port (used by `COMMANDO` APP_CONNECT; with `bind-addr=ws:`/`wss-bind-addr` in CLN config; default: `5001`)
- LIGHTNING_WS_CLIENT_KEY_FILE: Client key file path including file name for websocket TLS authentication (used by `COMMANDO` APP_CONNECT and `wss` LIGHTNING_WS_PROTOCOL; default: `./client-key.pem`)
- LIGHTNING_WS_CLIENT_CERT_FILE: Client certificate file path including file name for websocket TLS authentication (used by `COMMANDO` APP_CONNECT and `wss` LIGHTNING_WS_PROTOCOL; default: `./client.pem`)
- LIGHTNING_WS_CA_CERT_FILE: CA certificate file path including file name for websocket TLS authentication (default: `./ca.pem`)

# CLN REST Values
- LIGHTNING_REST_PROTOCOL: Protocol on which REST is served (valid values: http/https, default: `https`)
- LIGHTNING_REST_HOST: IP address/hostname of Core Lightning REST interface (used if APP_CONNECT is `REST`, default: `localhost`)
- LIGHTNING_REST_TOR_HOST: Tor hidden service URL for Core Lightning REST interface (default: ``)
Expand All @@ -84,6 +87,7 @@
- LIGHTNING_REST_CLIENT_CERT_FILE: Client certificate file path including file name for REST TLS authentication (default: `./client.pem`)
- LIGHTNING_REST_CA_CERT_FILE: CA certificate file path including file name for REST TLS authentication (used by `REST` APP_CONNECT and `https` LIGHTNING_REST_PROTOCOL; default: `./ca.pem`)

# CLN gRPC Values
- LIGHTNING_GRPC_HOST: IP address/hostname of Core Lightning GRPC interface (used if APP_CONNECT is `GRPC`, default: `localhost`)
- LIGHTNING_GRPC_TOR_HOST: Tor hidden service URL for Core Lightning GRPC interface (default: ``)
- LIGHTNING_GRPC_PORT: Core lightning's GRPC port (used if APP_CONNECT is `GRPC`; default: `9736`)
Expand Down
2 changes: 1 addition & 1 deletion apps/backend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cln-application-backend",
"version": "0.0.8",
"version": "25.07",
"description": "Core lightning application backend",
"private": true,
"license": "MIT",
Expand Down
2 changes: 0 additions & 2 deletions apps/backend/source/shared/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ export const SECRET_KEY = crypto.randomBytes(64).toString('hex');

export const DEFAULT_ENV_VALUES = {
APP_SINGLE_SIGN_ON: 'false',
BITCOIN_HOST: 'localhost',
BITCOIN_NETWORK: 'bitcoin',
APP_PROTOCOL: 'http',
APP_HOST: 'localhost',
Expand Down Expand Up @@ -72,7 +71,6 @@ export const DEFAULT_ENV_VALUES = {

export const APP_CONSTANTS = {
APP_SINGLE_SIGN_ON: process.env.APP_SINGLE_SIGN_ON || DEFAULT_ENV_VALUES.APP_SINGLE_SIGN_ON,
BITCOIN_HOST: process.env.BITCOIN_HOST || DEFAULT_ENV_VALUES.BITCOIN_HOST,
BITCOIN_NETWORK: process.env.BITCOIN_NETWORK || DEFAULT_ENV_VALUES.BITCOIN_NETWORK,
APP_PROTOCOL: process.env.APP_PROTOCOL || DEFAULT_ENV_VALUES.APP_PROTOCOL,
APP_HOST: process.env.APP_HOST || DEFAULT_ENV_VALUES.APP_HOST,
Expand Down
2 changes: 1 addition & 1 deletion apps/frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cln-application-frontend",
"version": "0.0.8",
"version": "25.07",
"description": "Core lightning application frontend",
"private": true,
"license": "MIT",
Expand Down
1 change: 0 additions & 1 deletion apps/frontend/src/types/root.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export type NodeInfo = {
export type WalletConnect = {
isLoading: boolean;
APP_SINGLE_SIGN_ON?: boolean;
BITCOIN_HOST?: string;
BITCOIN_NETWORK?: string;
APP_PROTOCOL?: string;
APP_HOST?: string;
Expand Down
3 changes: 1 addition & 2 deletions apps/frontend/src/utilities/test-utilities/mockData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,6 @@ export const mockShowToast = {
export const mockConnectWallet = {
isLoading: false,
APP_SINGLE_SIGN_ON: false,
BITCOIN_HOST: "localhost",
BITCOIN_NETWORK: "regtest",
APP_PROTOCOL: "http",
APP_HOST: "localhost",
Expand Down Expand Up @@ -258,7 +257,7 @@ export const mockConnectWallet = {
LIGHTNING_GRPC_CLIENT_KEY_FILE: "/home/network/regtest/grpc/client-key.pem",
LIGHTNING_GRPC_CLIENT_CERT_FILE: "/home/network/regtest/grpc/client.pem",
LIGHTNING_GRPC_CA_CERT_FILE: "/home/network/regtest/grpc/ca.pem",
APP_VERSION: "0.0.8",
APP_VERSION: "25.07",
NODE_PUBKEY: "nodepubkey123456nodepubkey123456nodepubkey123456nodepubkey123456",
ADMIN_RUNE: "adminrune==",
INVOICE_RUNE: mockInvoiceRune.rune,
Expand Down
Loading