Commit graph

46 commits

Author SHA1 Message Date
ChuckNorrison
2d05f20fab has no attribute 'decode' fix for redis db
This will only try to decode if it is needed
2022-10-18 18:06:53 +02:00
ChuckNorrison
169da2598e
feat: stop log spam for missing tor_web_addr (#154)
* Stop log spam for missing tor_web_addr

In case tor is not used, we can not find a tor_web_addr key in redis db. This will prevent from spamming the journal.

* log Redis DB missing Keys as Info

* log level Redis DB 

only tor as info
2022-10-16 09:40:24 +02:00
fusion44
2941d6132b
fix: raise error when cert file path doesn't exist 2022-10-03 10:51:17 +02:00
fusion44
6098c70eee
refactor: send_sse_message to broadcast_sse_msg 2022-09-10 15:52:11 +02:00
fusion44
69d8032900
refactor: sse code into dedicated SSEManager class 2022-09-10 15:48:03 +02:00
fusion44
49bdbab66d
refactor: use a Queue instead of Redis for SSE
refs #60
2022-09-10 13:53:09 +02:00
fusion44
3865d89fd5
feat: configure node acces via file paths
closes #146
2022-09-10 07:43:16 +02:00
fusion44
92ed1832f8
Implement unlock CLN wallet for RaspiBlitz only (#135)
* feat: implement SSH CLN wallet unlock on the Blitz
* feat: implement API CLN wallet unlock on the Blitz
* feat: return error when wallet is already unlocked
* docs: update unlock-wallet docs
* fix: add more safety checks
    * return 423 error on API calls if wallet locked
    * check if unlock script exits with 1
* fix: call_script deprecation warning crash

closes #133
2022-07-13 07:08:00 +02:00
openoms
9203e0c031
feat: call_script with sudo where needed (#127)
* call_script with sudo

* add call_sudo_script and use where needed

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-06-26 13:13:50 +02:00
fusion44
95ed6e812e
refactor: improve startup procedure for CLN too
refs #97
2022-06-08 19:25:45 +02:00
fusion44
41cc8208e7
refactor: move bitcoin config the bitcoin repo 2022-06-06 20:21:19 +02:00
fusion44
493d8039fa
refactor: improve startup procedure
During startup the API will try to connect to Bitcoin Core and the
Lightning Node. If it can't connect it will check every "n" seconds
(currently 2s) and connect when available. A new SSE event
called "system_startup_info" is introduced. This event contains
all startup status information during the startup procedure.

The old wallet_locked event is obsolete.

Sample:
--------------------------
event: system_startup_info
data: {"bitcoin": "offline", "bitcoin_msg": "", "lightning": "offline", "lightning_msg": "Unable to connect to LND daemon, waiting..."}
--------------------------
event: system_startup_info
data: {"bitcoin": "done", "bitcoin_msg": "", "lightning": "offline", "lightning_msg": "Unable to connect to LND daemon, waiting..."}
--------------------------
event: system_startup_info
data: {"bitcoin": "done", "bitcoin_msg": "", "lightning": "locked", "lightning_msg": "Wallet locked, unlock it to enable full RPC access"}
--------------------------
event: system_startup_info
data: {"bitcoin": "done", "bitcoin_msg": "", "lightning": "done", "lightning_msg": ""}
--------------------------
event: system_startup_info
data: {"bitcoin": "done", "bitcoin_msg": "", "lightning": "bootstraping", "lightning_msg": "RPC not yet available"}
--------------------------

refs #97
2022-06-06 19:29:21 +02:00
fusion44
887d44be44
chores: remove unused health messages; Fix typos
closes remove confusing "health" message in system_info #95
2022-06-04 14:46:03 +02:00
fusion44
762b79fde2
refactor: make running without LN explicit in .env 2022-06-04 14:16:19 +02:00
fusion44
de9a96e621
feat: implement Core Lightning gRPC backend (#98)
Some remaining issues with current implementation:

Some remaining issues with current implementation:

* Some calls require shell access to lightning-cli as some gRPC calls are not yet implemented
* Getting on-chain fund flows is not as nice as it is with LND and required access to the Core Lightning SQlite database
* With current API you can only get current outputs
* High probability of bugs arising

closes #45
2022-06-04 14:10:44 +02:00
fusion44
a34dd7954c
chore: apply pre_commit, fix typos, update deps 2022-05-18 18:20:13 +02:00
/rootzoll
5f9bdf4a45
merge: add connection info endpoint (#86) 2022-05-12 19:49:01 +02:00
/rootzoll
ce7f82c106
Installapps (#78)
Adding functionallity for setup & installing additional apps ... run with the latest raspiblitz dev scripts.
2022-05-05 13:27:59 +02:00
fusion44
7d452be179
feat: implement "rawblock" zmq sub as a fallback
Lightning Polar only exposes "rawblock" and not "hashblock
=> make it configurable which one to use
2022-04-05 16:40:18 +02:00
fusion44
efdb1c1057
feat: add shutdown/reboot SSE events on initiation
plus:
* add some more documentation
* add error handling when the script fails to run
* a bit of refactoring

refs #70
2022-03-24 20:17:56 +01:00
rootzoll
aa4435656b start also with blitz without lightning 2022-03-21 13:03:15 +01:00
fusion44
028cfc866e
feat: improve error messages on startup failures 2022-03-20 10:04:00 +01:00
/rootzoll
d466d3ab47
Add TODO for system redis channel 2022-03-16 09:46:58 +01:00
Stefan Stammberger
233a41eb96
feat: implement forward success SSE notifications
refs #64
2022-01-15 14:27:08 +01:00
Stefan Stammberger
4157058a54
feat: implement get-system-info backends
Raspiblitz and native-python implementations should work.
Only feature still missing is system health related stuff.

refs #47
2021-12-25 16:53:42 +01:00
Stefan Stammberger
20e0457a73
feat: send a wallet_locked_status SSE message
When someone connects to the SSE endpoint and the wallet is
locked a message with event name `wallet_lock_status` type is sent:
```js
// only sent when a new SSE connection is established and the wallet is
//  locked at the same time
event: wallet_lock_status
data: {"locked": true}
```
When the wallet is unlocked either through SSH or the API, another
event is sent:
```js
// sent always when a new connection is established when the wallet
// is unlocked, or it is sent when the wallet was unlocked after
// connection was established
event: wallet_lock_status
data: {"locked": false}
```

It is always the first thing the client receives. After the unlock
event, the usual warmup data is sent.

refs #34
2021-11-30 19:57:17 +01:00
Stefan Stammberger
ba4aa25c01
chore: update grpc files and add WalletUnlocker 2021-11-23 20:19:03 +01:00
Stefan Stammberger
3f8860999b
fix: sse message composition 2021-10-27 19:23:21 +02:00
Stefan Stammberger
6ad707e3ea
fix: SSE message JSON encoding
fixes #23, #24, #25
2021-10-12 21:36:15 +02:00
Stefan Stammberger
2d18e5a33f
refactor: Rename poorly named classes and events 2021-10-05 19:34:06 +02:00
Stefan Stammberger
a8355687d4
feat: implement send coins (on-chain) endpoint
closes #15
2021-10-03 20:55:28 +02:00
Stefan Stammberger
9dfd95032a
refactor: move code from lnd impl to repository
This avoids duplicated code with other ln implementations later on.

This also pushes LightningStatus object to the SSE channel
instead of the full LnInfo object.

refs #11
2021-09-07 20:59:23 +02:00
Stefan Stammberger
f482c441cc
chore: format all files using black 2021-09-05 08:56:53 +02:00
Stefan Stammberger
0c90450bea
feat: improve how to fetch wallet balances
* /lightning/getbalance now returns onchain funds and channel
balances as one object
* changes to the wallet balance are now pushed through the SSE channel
2021-08-03 21:20:24 +02:00
Stefan Stammberger
e65c5bfc3f
feat: implement LN info endpoint / SSE messages 2021-08-02 20:30:18 +02:00
Stefan Stammberger
38c93f6b58
feat: implement sendpayment endpoint for LND 2021-07-27 21:10:25 +02:00
Stefan Stammberger
da5d97a550
feat: watch for invoice changes and push via SSE
Currently only LND is implemented.
2021-07-25 18:15:26 +02:00
Stefan Stammberger
bba02d03e3
feat: create gRPC channel in async mode
Previously any subscriptions blocked the whole app when
listening to events and all other calls are async now too.
2021-07-25 16:52:34 +02:00
Stefan Stammberger
a44717547f
feat: LND loading adapted
- the .env file should contain the cert in HEX format
- gRPC channel is now created during load within the LND utils class

closes #3
2021-07-21 18:58:35 +02:00
Stefan Stammberger
47d654c9db
fix: more python3.7 incompatibilities 2021-07-18 07:59:19 +02:00
Stefan Stammberger
0eab9f6371
refactor: clarify .env entry names 2021-07-11 21:07:34 +02:00
Stefan Stammberger
7ff3392a0b
feat: add lnd connectivity and first gRPC call 2021-07-10 17:15:02 +02:00
Stefan Stammberger
bd38a5ecc2
feat: implement more bitcoin endpoints
- getnetworkinfo
- getbitcoininfo
- gather bitcoin info on change and push via SSE sub
2021-07-09 19:45:29 +02:00
Stefan Stammberger
97458fb3f8
feat: implement bitcoin core block hash zmq sub
Block data will be published to sse/subscribe SSE endpoint
2021-06-25 18:40:27 +02:00
Stefan Stammberger
aec4a3515b
feat: add async bitcoin RPC func; refactor config
refactor: generalize the way the .env file is read and accessed
2021-06-19 16:20:47 +02:00
Stefan Stammberger
5eeedd755e
feat: implement first bitcoin core REST calls 2021-06-13 10:16:54 +02:00