Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 4552063

Browse files
authored
Merge pull request #441 from lightninglabs/rpc
Rpc
2 parents 8017441 + eaf62c7 commit 4552063

File tree

3 files changed

+37
-8
lines changed

3 files changed

+37
-8
lines changed

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ To build the UI style guide
2323
npm run storybook
2424
```
2525

26-
To start start the app:
26+
To start start the app in development mode (simnet):
2727
```
2828
npm run electron-dev
2929
```
@@ -32,13 +32,34 @@ Running in development mode can allow you to run in full node mode instead of th
3232

3333
### Building the Packaged App
3434

35-
To build the packaged version of the app for your current platform, run:
35+
To build the packaged version of the app e.g. for macOS run:
3636
```
37+
cp $GOPATH/bin/lnd ./assets/bin/darwin
3738
npm run electron-pack
3839
```
3940

4041
The packaged app will then be available in the lightning-app/dist directory. The packaged version of the app will run on Bitcoin testnet. To debug a packaged app, go to localhost:9997 in your browser.
4142

43+
### Starting the Packaged App (light client)
44+
45+
To run the packaged version of the app e.g. for macOS run:
46+
```
47+
./dist/mac/Lightning.app/Contents/MacOS/Lightning
48+
```
49+
50+
### Starting the Packaged App (full node)
51+
52+
Start btcd in a seperate terminal session and wait until it's fully synced (can take over a day)
53+
```
54+
mkdir $HOME/Library/Application\ Support/Btcd && touch $HOME/Library/Application\ Support/Btcd/btcd.conf
55+
btcd --testnet --txindex --rpcuser=kek --rpcpass=kek
56+
```
57+
58+
To run the packaged version of the app e.g. for macOS run:
59+
```
60+
./dist/mac/Lightning.app/Contents/MacOS/Lightning --rpcuser=kek --rpcpass=kek
61+
```
62+
4263

4364
### Logs
4465
Logs are written to the following locations:

public/electron.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ ipcMain.on('log-error', (event, arg) => log.error(...arg));
4646
let logQueue = [];
4747
let logsReady = false;
4848

49+
const getArgv = arg =>
50+
(process.argv.find(a => a.includes(`--${arg}=`)) || '').split('=')[1];
51+
4952
const sendLog = log => {
5053
if (win && logsReady) {
5154
win.webContents.send('logs', log);
@@ -131,6 +134,8 @@ const startLnd = async () => {
131134
});
132135
lndProcess = await startLndProcess({
133136
isDev,
137+
rpcUser: getArgv('rpcuser'),
138+
rpcPass: getArgv('rpcpass'),
134139
lndSettingsDir,
135140
macaroonsEnabled: MACAROONS_ENABLED,
136141
lndPort: LND_PORT,

public/lnd-child-process.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ function startBlockingProcess(name, args, logger) {
4747

4848
module.exports.startLndProcess = async function({
4949
isDev,
50+
rpcUser,
51+
rpcPass,
5052
macaroonsEnabled,
5153
lndSettingsDir,
5254
lndPort,
@@ -55,16 +57,17 @@ module.exports.startLndProcess = async function({
5557
lndRestPort,
5658
}) {
5759
if (!lndSettingsDir) throw new Error('lndSettingsDir not set!');
60+
const rpc = !!rpcUser;
5861
const processName = 'lnd';
5962
const args = [
6063
'--bitcoin.active',
6164
isDev ? '--bitcoin.simnet' : '--bitcoin.testnet',
62-
isDev ? '--btcd.rpcuser=kek' : '',
63-
isDev ? '--btcd.rpcpass=kek' : '',
64-
isDev ? '--bitcoin.node=btcd' : '--bitcoin.node=neutrino',
65-
isDev ? '' : `--configfile=${path.join(lndSettingsDir, 'lnd.conf')}`,
66-
isDev ? '' : '--neutrino.connect=btcd0.lightning.engineering',
67-
isDev ? '' : '--neutrino.connect=127.0.0.1:18333',
65+
isDev || rpc ? `--btcd.rpcuser=${rpcUser || 'kek'}` : '',
66+
isDev || rpc ? `--btcd.rpcpass=${rpcPass || 'kek'}` : '',
67+
isDev || rpc ? '--bitcoin.node=btcd' : '--bitcoin.node=neutrino',
68+
isDev || rpc ? '' : `--configfile=${path.join(lndSettingsDir, 'lnd.conf')}`,
69+
isDev || rpc ? '' : '--neutrino.connect=btcd0.lightning.engineering',
70+
isDev || rpc ? '' : '--neutrino.connect=127.0.0.1:18333',
6871
isDev ? '' : '--autopilot.active',
6972

7073
macaroonsEnabled ? '' : '--no-macaroons',

0 commit comments

Comments
 (0)