Lightning Network (BOLT)
ptarmd
. Use ptarmcli
to operate ptarmd
.bitcoind
completely synchroninzed with testnet is running on the same local host on which ptarmd
is running. It is necessary to have testnet bitcoin.ptarmcli
is not easy understandable. It is improving.
Specify command option by mixture of file and commandline.
i.e. “run option file generation program -> use ptarmcli with commandline option and that file”ptarmigan / install / node
is the directory where the node information is stored and ptarmigan / install / node / db
is the database directory.
Even if you exit ptarmd
software, re-running ptarmd
in the ptarmigan / install / node
directory will start up as the same Lightning Network node.
If re-startup is not successful, remove the db
directory and run it as a new node.rm -rf db
).bitcoind
bitcoind
with testnet. Get some bitcoin from testnet faucetptarmd
ptarmd
with other testnet Lightning Network nodebitcoind
Preparebitcoin.conf
filesudo add-apt-repository ppa:bitcoin/bitcoin
sudo apt-get update
sudo apt-get install bitcoind
~/.bitcoin/bitcoin.conf
rpcuser=bitcoinuser
rpcpassword=bitcoinpassword
server=1
txindex=1
testnet=1
rpcuser
and rpcpassword
must be specified.
bitcoind
bitcoid -daemon
Wait untill fully synchronized with bitcoin testnet blockchain (it may take a few hours)
Generate bitcoin address by bitcoind
. Get testnet bitcoin from bitcoin faucet WEB
bitcoin-cli getnewaddress
Example of faucet WEB
ptarmigan
sudo apt install -y git autoconf pkg-config libcurl4-openssl-dev libjansson-dev libev-dev libboost-all-dev build-essential libtool jq bc
git clone https://github.com/nayutaco/ptarmigan.git
cd ptarmigan
make full
ptarmd
cd install
./new_nodedir.sh
cd node
../ptarmd --network=testnet&
Default mode is private node in which mode node does not announce IP address.
Open another Ubuntu window and control ptarmd
from such window, because ptarmd
is daemon.
ptarmd
../ptarmcli -c [peer node_id]@[peer IP address]:[peer port]
When ptarmd successfully connect other node, you receive the large amount of node information from peer node.
You should wait untill finishing log output.
ptarmd
and peer../ptarmcli -l | jq
ptarmcli
shows current connection information.
Connected node status
is "connected"
in the log.
First, send testnet bitcoin to segwit address, then send testnet bitcoinn payment channnel.
../pay_fundin.py 1000000 500000
These command generate a file fund_yyyymmddhhmmss.conf
.
File contents means the following:
Note that unit is satoshi.
../ptarmcli -c [peer node_id] -f fund_yyyymmddhhmmss.conf
../ptarmcli -l | jq
Number of comfirmation is depend on peer node(c-lightning
default value is 1. lnd
default value is 3).
Display node status.
When channel is established, status change from "wait_minimum_depth"
to "established"
.
You should wait 6 confirmation, because broadcasting of channel start after 6 confirmation.
You can check current number of confirmationn by command ptarmcli -l
.
The following are famous Lightning Network(testnet) payment DEMO WEB site.
Here, we explain how to pay starblocks.
Push “Add to Cart” button, and push checkout button.
Then, invoice number is displayed.
Long strings like lntb********************.....
is invoice text.
../ptarmcli -l | jq
Display the node status.
../ptarmcli -r [invoice text]
Execute payment from ptarmigan.
When payment starts, ptarmigan show message “Progressing”.
If payment for starblocks successfuly executed, starblocks WEB changes status.
Because Lightning Network is P2P payment, payment does not complete if even one node on the path doesn’t correspond correctly.
When payment is not completed, ptarmigan execute path re-serach.
ptarmcli -r
internally until ptarmigan finish paymenntIt may take time.
When ptarmigan is retrying payment, ptarmcli -l
shows “paying” message.
When ptarmigan can not find route finally, it output “fail routing” error message.
This mean that ptarmigan can not find route from current local channel network view.