- A development environment for Alloy's lightning wallet
- Currently in Testnet mode
- Docker installed
- docker-compose installed
- python3 installed
- pip installed:
sudo apt-get install python3-pip
on Linux - vitualenv installed:
sudo pip3 install virtualenv
on Linux - libsecp256k1 (
sudo apt-get install libsecp256k1-0
or https://github.com/cuber/homebrew-libsecp256k1 on mac)
./build-docker-images.sh
sudo docker-compose up
- go to
localhost
to see lightningd helper apps
- It is recommended to run the Flask app in a virtual environment
virtualenv venv
source venv/bin/activate
python3.8 -m pip install -r requirements.txt
python app.py
- ctrl-c to stop Flask then
deactivate
to deactivate the venv
/new_address
returns an html page showing a generated bitcoin address/ln_invoice
returns an html page for creating LN invoices/send
returns an html page for sending onchain/pay_invoice
returns an html page for paying LN invoices/pay/<bolt11>
pays a bolt11 invoice and returns an html page of the result/list_txs
returns an html page of of all onchain history/invoices
returns an html page of the status of all paid bolt11 invoices/status/<bolt11>
returns an html page of the status of a specific bolt11 invoice payment/channel_opener
returns an html page for opening LN channels/open_channel/<node_id>/<amount>
opens a LN channel with node_id/list_peers
html page that shows the status of a channel, connection to peer, and short channel id. Close connection/node_connector
connecting to another node for syncing the channel graph. Needs to be done before opening channel
mainnet node 1ml.com
: 0217890e3aad8d35bc054f43acc00084b25229ecff0ab68debd82883ad65ee8266@23.237.77.11:9735
testnet node 1ml.com
: 02312627fdf07fbdd7e5ddb136611bdde9b00d26821d14d94891395452f67af248@23.237.77.12:9735
Any new plugins must be added to the Dockerfile.
ie. COPY ./rebalance.py /etc/bundledplugins/
The above will automatically enable the plugin.
To delete the plugin, comment the COPY line in the Dockerfile.
To add the channels, you need to connect to node. I've added 1ml.com node. This is triggered by visiting the index.html page for the app.
To put some bitcoin to the on-chain wallet: I've had some troubles with this. I could send bitcoin to the on-chain wallet address generated by the following:
- lightning-cli
- webgui(Generate address)
- spark wallet None of the above would receive the bitcoin. Bitcoin explorer shows that its been sent and received but its not showing in the app.
The only way I could make this appear is to first do the following
bitcoind container:
- create a new wallet and make sure it loads up on restart via cli. bitcoin-cli -testnet -rpcuser=rpcuser -rpcpassword=rpcpass help createwallet bitcoin-cli -testnet -rpcuser=rpcuser -rpcpassword=rpcpass createwallet node_wallet false false "password" false false true
- create a new address with the new wallet via cli. bitcoin-cli -testnet -rpcuser=rpcuser -rpcpassword=rpcpass -rpcwallet=node_wallet getnewaddress
- send a very small amount to the new address. ### not entirely sure if this one is needed. This will not appear in index.html
clightning_bitcoin container:
- generate a new wallet via cli. lightning-cli --testnet --conf=/root/.lightning/config --rpc-file=/root/.lightning/lightning-rpc newaddr
- send very small amount to test to make sure that it would show up in the index.html after its confirmed. lightning-cli --testnet --conf=/root/.lightning/config --rpc-file=/root/.lightning/lightning-rpc listfunds When this shows as confirmed, it would then appear in the balance(app).
- Browserify + Node.js is being used to package a node script for decoding PSBT amounts to be shown on SweetAlert notfications for PSBT endpoints
- The browserified script is kept in static/assets/js/psbt-amount-browserified.js
- To update the script, first, if the node_modules/ folder is not present, run
npm i
in the base directory of the project, then runbrowserify psbt-amount.js --s getUnsignedPSBTAmount -o static/assets/js/psbt-amount-browserified.js
after making changes togetUnsignedPSBTAmount
inpsbt-amount.js
- After importing the script
psbt-amount-browserified.js
using the<script>
tag in your chosen jinja template, the function can be called by invokinggetUnsignedPSBTAmount.getUnsignedPSBTAmount(psbtString);