On windows, you will have to install Bash first. We recommend installing Git Bash which is packed in the Git installer from git-scm.
Then you'll have to install jq:
- Get the latest windows version from https://stedolan.github.io/jq/download/
- Rename the
jq-win64.exe
file tojq.exe
and move it toC:/Users/your_name/bin
- Download the eclair-cli file from our sources
- (optional) Move the file to
~/bin
- Enable the JSON API in your
eclair.conf
settings.
Run this command to list the available calls:
./eclair-cli -p <api_password> help
ℹ️ Protip: you can edit the eclair-cli
file and save the API password/url so you don't have to set them every time. We will omit them in the examples below.
Note that you may have to install jq first if it's not already installed on your machine:
sudo apt-get install jq
Your node listens on 8081. You want to open a 140 mBTC channel with endurance.acinq.co
on Testnet.
First connect to the endurance node:
eclair-cli connect --uri=03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134@endurance.acinq.co:9735
Then open a channel with endurance:
eclair-cli open --nodeId=03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134 --fundingSatoshis=14000000
This will broadcast a funding transaction to the bitcoin blockchain. Once that transaction is confirmed, your lightning channel will be ready for off-chain payments.
eclair-cli payinvoice --invoice=lntb17u1pdthhsdpp5z5am8.......
eclair-cli createinvoice --amountMsat=100000000 --description="my first invoice" | jq .serialized
This command will return a lightning payment request, such as:
lntb1m1pdthhh0pp5063r8hu6f6hk7tpauhgvl3nnf4ur3xntcnhujcz5w82yq7nhjuysdq6d4ujqenfwfehggrfdemx76trv5xqrrss6uxhewtmjkumpr7w6prkgttku76azfq7l8cx9v74pcv85hzyvs9n23dhu9u354xcqpnzey45ua3g2m4dywuw7udrt2sdsvjf3rawdqcpas9mah
You can check this invoice with the parseinvoice
command:
eclair-cli parseinvoice --invoice=lntb1m1pdthhh0pp5063r8hu6f6hk7tpauhgvl3nnf4ur3xntcnhujcz5w82yq7nhjuysdq6d4ujqenfwfehggrfdemx76trv5xqrrss6uxhewtmjkumpr7w6prkgttku76azfq7l8cx9v74pcv85hzyvs9n23dhu9u354xcqpnzey45ua3g2m4dywuw7udrt2sdsvjf3rawdqcpas9mah
Which will breakdown the invoice in human readable data.
eclair-cli channels | jq '.[] | select(.state == "NORMAL")'
We divide by 1000
because we want satoshis, not millisatoshis.
eclair-cli usablebalances | jq 'map(.canSend / 1000) | add'