aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/doom/config.org39
-rw-r--r--config/shepherd/init.d/bitcoin.scm27
-rw-r--r--home-dots/dot-bashrc6
3 files changed, 48 insertions, 24 deletions
diff --git a/config/doom/config.org b/config/doom/config.org
index e373589..fcb6979 100644
--- a/config/doom/config.org
+++ b/config/doom/config.org
@@ -61,9 +61,11 @@ Doom manages packages separately. Keep that file separate
(defun on/fetch-password (&rest params)
(if-let* ((match (car (apply #'auth-source-search params)))
(secret (plist-get match :secret)))
- (if (functionp secret)
- (funcall secret)
- secret)
+ (values
+ (if (functionp secret)
+ (funcall secret)
+ secret)
+ match)
(user-error "Password not found for %S" params))))
#+end_src
** Keybindings
@@ -807,21 +809,24 @@ skills:
(use-package json-rpc)
(defun on/bitcoin-rpc-connect ()
(interactive)
- (let* ((networks '(:mainnet 8332
- :mainnet-r 8335
- :testnet 18332
- :testnet-r 18335
- :regtest 18443))
- (host "localhost")
- (user "crazy")
- (port (plist-get networks
- (intern (completing-read "Pick network: " networks))))
- (secret (on/fetch-password :host host)))
+ (let* ((networks '(mainnet 8332
+ mainnet-r 8335
+ testnet 18332
+ testnet-r 18335
+ regtest 18443
+ ))
+ (pick (completing-read "Pick network: " networks))
+ (host (thread-first pick (split-string "-") car))
+ (port (plist-get networks pick #'string-equal))
+ (user "rpc-emacs"))
(when (and btc-explorer-bitcoind
(json-rpc-live-p btc-explorer-bitcoind))
(json-rpc-close btc-explorer-bitcoind))
(setq btc-explorer-bitcoind
- (json-rpc-connect host port user secret)))))
+ (cl-multiple-value-bind
+ (secret match) (on/fetch-password :host host :user user)
+ (json-rpc-connect
+ "localhost" port (plist-get match :user) secret))))))
(use-package! lnd
:load-path "~/dev/emacs-lisp/btc-explorer/"
@@ -829,6 +834,12 @@ skills:
:config
(setq lnd-nodes '(("local" "https://localhost:8480/v1/"
"/run/media/titan/ext_backup/personal/bitcoin/lnd/data/chain/bitcoin/testnet/admin.macaroon")
+ ("reg-ali" "https://localhost:8001/v1/"
+ "/scratch/titan/lnd/reg-ali/data/chain/bitcoin/regtest/admin.macaroon")
+ ("reg-carl" "https://localhost:8002/v1/"
+ "/scratch/titan/lnd/reg-carl/data/chain/bitcoin/regtest/admin.macaroon")
+ ("reg-bob" "https://localhost:8003/v1/"
+ "/scratch/titan/lnd/reg-bob/data/chain/bitcoin/regtest/admin.macaroon")
("remote" "https://localhost:8481/v1/"
"~/dev/emacs-lisp/btc-explorer/admin.macaroon"))))
diff --git a/config/shepherd/init.d/bitcoin.scm b/config/shepherd/init.d/bitcoin.scm
index a010bb4..2fb834d 100644
--- a/config/shepherd/init.d/bitcoin.scm
+++ b/config/shepherd/init.d/bitcoin.scm
@@ -25,16 +25,19 @@
#:stop (make-kill-destructor 2) ;; 2 is SIGINT - interupt process stream, ctrl-C
#:respawn? #t))
-(register-services
- (service
- '(lnd-testnet)
- #:documentation "Bitcoin testnet lnd lightning"
- #:start (make-forkexec-constructor
- (list "/home/titan/.local/bin/lnd"
- "--lnddir=/run/media/titan/ext_backup/personal/bitcoin/lnd/"
- "--noseedbackup"))
- #:stop (make-kill-destructor 2) ;; 2 is SIGINT - interupt process stream, ctrl-C
- #:respawn? #t))
+(let ((nodes '(ali bob carl)))
+ (register-services
+ (map
+ (lambda (name)
+ (service
+ (list (string->symbol (format #f "lnd-reg-~a" name)))
+ #:documentation (format #f "Bitcoin regtest LND lightning wallet ~:@(~a~)" name)
+ #:start (make-forkexec-constructor
+ (list "/home/titan/.local/bin/lnd"
+ (format #f "--lnddir=/scratch/titan/lnd/reg-~a/" name)))
+ #:stop (make-kill-destructor 2) ;; 2 is SIGINT - interupt process stream, ctrl-C
+ #:respawn? #t))
+ nodes)))
;; ssh
(register-services
@@ -49,6 +52,10 @@
"-L" "8335:localhost:8332" ;; btcm
"-L" "18335:localhost:18332" ;; btct
"-L" "8481:localhost:8480" ;; LNDT
+ "-L" "18443:localhost:18443" ;; regbtc
+ "-L" "15005:localhost:15005" ;; regbtczmq
+ "-L" "15006:localhost:15006" ;; regbtczmq
+ "-L" "50004:localhost:50004" ;; regelectrs
;; "-L" "/tmp/nina-mn.socket:/run/cardano-node-mainnet/socket"
;; "-L" "/tmp/nina-pr.socket:/run/cardano-node-preview/socket"
;; "-L" "54320:localhost:5432"
diff --git a/home-dots/dot-bashrc b/home-dots/dot-bashrc
index 5488946..edfc360 100644
--- a/home-dots/dot-bashrc
+++ b/home-dots/dot-bashrc
@@ -85,3 +85,9 @@ alias lar='ls -lahrt'
alias ssh='TERM=xterm-256color ssh'
alias emacs='TERM=xterm-direct emacs'
alias mykeys='setxkbmap -I$HOME/.config/xkb/ oscar -option caps:escape -print | xkbcomp -I$HOME/.config/xkb/ - $DISPLAY'
+
+# For local lightning network
+REGLNDIR="/scratch/titan/lnd/reg"
+alias lnali='lncli --lnddir="${REGLNDIR}-ali" --rpcserver=localhost:10001 -n regtest'
+alias lncarl='lncli --lnddir="${REGLNDIR}-carl" --rpcserver=localhost:10002 -n regtest'
+alias lnbob='lncli --lnddir="${REGLNDIR}-bob" --rpcserver=localhost:10003 -n regtest'