Lightning Network (BOLT)
ptarmd
(ptarmigan daemon)bitcoind
before starting ptarmd
.rpcuser=bitcoinuser
rpcpassword=bitcoinpassword
server=1
txindex=1
testnet=1
# create work folder
cd ptarmigan/install
./new_nodedir.sh [NODE_NAME]
cd [NODE_NAME]
# start with testnet!
../ptarmd --network=testnet
ptarmcli
(ptarmigan client)ptarmd
with JSON-RPC or ptarmcli
.
ptarmcli
send/receive JSON-RPC TCP socket internal.ptarmcli
rpcport option if..
ptarmd
uses port 9735 and JRON-RPC port 9736.ptarmd
working directory.Show my node information.
../ptarmcli --getinfo
Connecting known lightning node, use -c
command.
If you have channels, ptarmd
try connect the peers automatically.
# two connection method
# a. Only connect peer(not request peer's routing information)
../ptarmcli -c NODE_ID@IPv4_ADDRESS:PORT
# b. Get peer's all routing information by `--initroutesync`.
# Routing information is used for payment.
# (If you have already connected, disconnect and connect with `--initroutesync`.)
../ptarmcli -c NODE_ID@IPv4_ADDRESS:PORT --initroutesync
After connecting, you can open channel with connection node.
# create funding file
../pay_fundin.py AMOUNT_SAT
(create fund_xxxx.conf)
../ptarmcli -c NODE_ID -f fund_xxxx.conf
Establishing channel need some blocks.
You can check channel status with ptarmcli --getinfo
.
pay_fundin.py
only support P2PKH / native P2WPKH / P2WPKH nested in BIP16 P2SH.
If using “regtest”, you send to bitcoin-cli getnewaddress
.
bitcoin-cli sendtoaddress `bitcoin-cli getnewaddress` 0.1
msat
(1/1000 satoshi)# request 1000msat
../ptarmcli --createinvoice 1000
(print BOLT11 invoice)
sendpayment
command.../ptarmcli --sendpayment [BOLT11 INVOICE]
(print PAYMENT_ID)
ptarmcli --listpayment
.# all payment list
../ptarmcli --listpayment
# specify PAYMENT_ID
../ptarmcli --listpayment=PAYMENT_ID
Closing a channel uses ptarmcli -x
command.
Amount in channel will pay to bitcoind after some blocks.
../ptarmcli -c NODE_ID -x
ptarmcli --getinfo
.ptarmcli -xforce
.
ptarmd
will keep it.
ptarmcli --paytowallet
create and send currently payable transaction.# check payable transaction
# if no input found or too less to use input, outputs "no input".
../ptarmcli --paytowallet
# from internal wallet to bitcoind
../ptarmcli --paytowallet=1
fail: no rpcuser or rpcpassword[xxx/.bitcoin/bitcoin.conf]
fail: wrong conf file.
rpcuser
or rpcpassword
in conf file.fail: initialize btcrpc
DB checking: open...done!
DB checking: version...fail: version mismatch : X(require Y)
invalid version
fail: node init
ptarmd
’s DB file version not same
ptarmcli --sendpayment
always failptarmcli --getinfo
and check status “normal operation”.--initroutesync
for getting route information.