Skip to content

Instantly share code, notes, and snippets.

Clone dougvk repository to ~

git clone https://github.com/dougvk/lightning-node.git

Build the bitcoind docker image

cd lightning-node
docker build . -t dougvk/bitcoind

Run the bitcoind node (you may need to create symbolic link to map volume)

Create a bitcoin-cli shortcut to interface with the node

cat /usr/local/bin/bitcoin-cli
#!/usr/bin/env bash
docker run --rm --network container:bitcoind_testnet -v /scratch/bitcoin/testnet/bitcoind:/data dougvk/bitcoind:latest bitcoin-cli -testnet "$@"

Grant permission to shortcut

chmod +x /usr/local/bin/bitcoin-cli

Run the lightningd node on testnet

mkdir -p /scratch/bitcoin/testnet/clightning
docker run --rm --name lightning_testnet --network container:bitcoind_testnet -v /scratch/bitcoin/testnet/bitcoind:/root/.bitcoin -v /scratch/bitcoin/testnet/clightning:/root/.lightning --entrypoint /usr/bin/lightningd cdecker/lightningd:latest --network=testnet --rgb=0066cc --alias=yourname --ipaddr=yourip --log-level=debug --ignore-fee-limits=true --override-fee-rates=53760/13200/254

Create a lightning-cli shortcut to interface with the node

#!/usr/bin/env bash
docker run --rm -v /scratch/bitcoin/testnet/clightning:/root/.lightning --entrypoint /usr/bin/lightning-cli cdecker/lightningd:latest "$@"

Grant permission to shortcut

chmod +x /usr/local/bin/lightning-cli

Test

Generate lightning wallet address

lightning-cli newaddr
{ "address" : "2MtVFxPtk7EgHDPR8k7CMXFamaq3o1JHTZJ" }

Check balance

lightning-cli listfunds

Connect to node (ex. endurance)

lightning-cli connect 03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134 34.250.234.192 9735

Set tx fee (in BTC/kB) for your bitcoin node (if not set, the transaction will get slow confirmation due to low fee)

bitcoin-cli settxfee 0.005

Pay invoice

lightning-cli pay <<lightning invoice>>

Pay invoice with ignore max fee

percent=0.5 mean 50%

lightning-cli pay -k bolt11=<<BOLT11>> maxfeepercent=<<percent>>
@apemon
apemon / ndid-smart-contract.md
Last active August 5, 2018 13:19
ndid-smart-contract.md

Clone smart-contract repo

git clone https://github.com/ndidplatform/smart-contract.git

Build the smart-contract docker image (use v0.5.0 version)

cd smart-contract
git checkout tags/v0.5.0 -b v0.5.0
cd docker
docker-compose -f docker-compose.build.yml build --no-cache

Clone api repo

git clone https://github.com/ndidplatform/api.git

Build the api docker image (use v0.5.2 version)

cd api
git checkout tags/v0.5.2 -b v0.5.2
cd docker
docker-compose -f docker-compose.build.yml build --no-cache