Personnal projet as playground to discover and improve skill on :
Stack :
- Golang
- gRPC (use & extend gRPC API)
- Lnd
- HTMX
- SSE
- Makefile
- dockerfile
- docker compose / bake
- CI
- Kubernetes / HELM
- monitoring : Prometheus + Grafana (dashboard/panel for metrics)
TODO :
- Warehouse + ELT : Stack identified : DuckDB + dbt + Perfect (Airflow in a second time ?)
- archi hexagonal to complete TI for test cover
- monitoring (alerts)
- monitoring (logs)
- SSE with Deployement Backend broken -> need to put a broker (ex: Redis)
- Wallet creation/unlock is handled by the backend via gRPC
WalletUnlockerservice). - Define NetworkPolicies to restrict communication paths (frontend ↔ backend ↔ LND ↔ btcd) ?
- infra as code (Terraform + kubernetes with Kind) ?
- LLM
Be able to do a little web application to interract with and a lightning serveur running on simnet
make check-depsThe application can be launch with docker compose or Kubernetes (kind)
# Docker compose
docker buildx bake
docker compose up -d
# Kubernetes
make allGo to : http://localhost:3000/ (docker compose)
Go to : http://lightning-playground.local/ (Kubernetes)
Grafana (Kubernetes) :
| Clé | Valeur |
|---|---|
| URL | https://grafana.lightning-playground.local/d/admzlxj/lightning-playground-backend-dashboard?orgId=1&from=now-30m&to=now&timezone=browser&refresh=5s |
| Login | admin |
| Password | kubectl get secret -n monitoring monitoring-grafana -o jsonpath="{.data.admin-password}" | base64 --decode |
To use the lnd fonctionalities, you will need at least 2 lnd nodes with a wallet :
# Docker compose
docker exec -it lightning-playground-lnd1-1 lncli --network=simnet create
docker exec -it lightning-playground-lnd2-1 lncli --network=simnet create
# Kubernetes
kubectl exec -it lnd-0 -n lightning-playground -- lncli --network=simnet create
kubectl exec -it lnd-1 -n lightning-playground -- lncli --network=simnet create
kubectl exec -it lnd-2 -n lightning-playground -- lncli --network=simnet createTo mine with one of these address do :
# Docker compose
docker exec -it lightning-playground-lnd1-1 lncli --network=simnet newaddress np2wkh
# Kubernetes
kubectl exec -it lnd-0 -n lightning-playground -- lncli --network=simnet newaddress np2wkhCopy the address then replace the value of miningaddr in the service btcd of docker-compose.yml or kubernetes/manifests/btcd/btcd-statefulset.yaml.
And reload the containers
# Docker compose
docker compose up -d
# Kubernetes
kubectl apply -f btcd-statefulset.yaml -n lightning-playground
kubectl delete pod btcd-0 -n lightning-playgroundMine enough block to activate taproot
# Docker compose
docker exec -it lightning-playground-btcd-1 btcctl --simnet generate 1500
# Kubernetes
kubectl exec -it btcd-0 -n lightning-playground -- btcctl --simnet generate 1500After each up of the lnd containers, the wallet must be unlock
# Docker compose
docker exec -it lightning-playground-lnd1-1 lncli --network=simnet unlock
docker exec -it lightning-playground-lnd2-1 lncli --network=simnet unlock
# Kubernetes
kubectl exec -it lnd-0 -n lightning-playground -- lncli --network=simnet unlock
kubectl exec -it lnd-1 -n lightning-playground -- lncli --network=simnet unlock
kubectl exec -it lnd-2 -n lightning-playground -- lncli --network=simnet unlockIn the simnet network the news blocks must to be mine manually. Run this cmd (every 10 minutes) to keep the lnd node synchronised with the btcd node
# Docker compose
docker exec -it lightning-playground-btcd-1 btcctl --simnet generate 1
# Kubernetes
kubectl exec -it btcd-0 -n lightning-playground -- btcctl --simnet generate 1# Docker compose
docker-compose down
# Kubernetes
docker stop lightning-playground-control-planeSteps :
- Add new pair with the URI of other nodes
- Create channels between pairs.
After creating the channel to pass it in
activestate, generate some blocs with :
# Docker compose
docker exec -it lightning-playground-btcd-1 btcctl --simnet generate 10
# Kubernetes
kubectl exec -it btcd-0 -n lightning-playground -- btcctl --simnet generate 1- Generate an invoice
- Import the invoice on another node and pay-it
kubectl scale statefulset lnd --replicas=5The app works with a LND customised LMare/lnd. This version allow to modify the alias and the color of the node LND by gRPC call.
