Ptarmiganで送金などなど
Ptarmiganを起動する
$ bitcoind -daemon
code:home/user/ptarmigan/install/node
$ ../ptarmd --network==testnet
DB checking: open...done!
DB checking: version...done!
DB checking: announcement.....done!
=NODE=============================================
node_id: 035a747673de478c6f008becc521bbc54bbbf439f00789014a4aca7425e3161c55
alias= node_035a747673de
addr.type=0
port=9735
chain: bitcoin testnet
=============================================
listening...
{
"method": "started",
"date": "2019-06-05T06:31:40.540364916",
"short_channel_id": "0x0x0",
"node_id": "035a747673de478c6f008becc521bbc54bbbf439f00789014a4aca7425e3161c55"
}
↑これがでればOK
別のターミナルを起動
code:home/user/ptarmigan/install/node
$ ../ptarmcli --getinfo
{
"result": {
"node_id": "02755c6ac43eba81680c45283a80efaf5701ae64f69807133c9256e05f500fa848",
"node_port": 9735,
"total_local_msat": 0,
"block_count": 1519826,
"peers": []
}
}
ノードに接続する
$ ../ptarmcli -c node:id@IPaddr:port番号
code: ~/ptarmigan/install/node
$ ../ptarmcli -c 03f0345405a2b87a2f468dd6efdf82af3e05a449e4aa64547b5f74fafc1729cfb6@192.168.24.?:9735
{
"result": "OK"
}
チャネルを開く
$ ../ptarmcli -c node_id -f 金額(satoshi 500000=0.005BTC)
code:~ptarmigan/install/node
$ ../ptarmcli -c 03f0345405a2b87a2f468dd6efdf82af3e05a449e4aa64547b5f74fafc1729cfb6 -f 500000
cmdline: python3 /home/ubuntu/ptarmigan/install/pay_fundin.py 500000 0 fundtmp.conf
ReCalcvsize not same(167 --> 166) Address 2MtAnGG6U1eJiTYDfaqsy3sXb7rKidq5L6v TXID 42b21f683012bb7891356d8531a3ff87204b19b6c7b5a4cac1bea8105dd642e4 {
"result": {
"status": "Progressing"
}
}
チャネルの状態を確認する
$ ../ptarmcli --getinfo
code:~ptarmigan/install/node
$ ../ptarmcli --getinfo
{
"result": {
"node_id": "02755c6ac43eba81680c45283a80efaf5701ae64f69807133c9256e05f500fa848",
"node_port": 9735,
"total_local_msat": 500000000,
"peers": [{
"role": "client",
"status": "establishing",
"node_id": "03f0345405a2b87a2f468dd6efdf82af3e05a449e4aa64547b5f74fafc1729cfb6",
"channel_id": "e53cc8d8006c2df48c01878260e2740d53fd48a1425772f8d5ebe42ffcd34c7d",
"funding_tx": "7d4cd3fc2fe4ebd5f8725742a148fd530d74e2608287018cf42d6c00d8c83ce5",
"funding_vout": 0,
"minimum_depth": 1,
"feerate_per_kw": 253
}]
}
}
invoiceの作成
$ ../ptarmcli --createinvoice 金額(msatoshi)
code:~ptarmigan/install/node
$ ../ptarmcli --createinvoice 10000
{
"result": {
"hash": "24886fb99065ad487d643d6f03396174f6a242e2beb56bb18c8c35a1295a33a5",
"amount_msat": 10000,
"bolt11": "lntb100n1pw5xyhcnp4qf64c6ky86agz6qvg55r4q804atsrtny76vqwyeujftwqh6sp75yspp5yjyxlwvsvkk5slty84hsxwtpwnm2yshzh66khvvv3s66z226xwjsdq0wp6xzundd9nkzmsc3dwz0dcs6l2fuezmccffyfzt402ucf05ujw7avd99hr4tejau23gmeh7g6z3vuh9ky65afklqc3tnej9zsx3a64ugg0acjxenwalfqpmchhsy",
"note": "no payable-amount channel"
}
}
invoiceを確認する
$ ../ptarmcli --decodeinvoice=invoice
code:~ptarmigan/install/node
$ ../ptarmcli --decodeinvoice=lntb100n1pw5xyhcnp4qf64c6ky86agz6qvg55r4q804atsrtny76vqwyeujftwqh6sp75yspp5yjyxlwvsvkk5slty84hsxwtpwnm2yshzh66khvvv3s66z226xwjsdq0wp6xzundd9nkzmsc3dwz0dcs6l2fuezmccffyfzt402ucf05ujw7avd99hr4tejau23gmeh7g6z3vuh9ky65afklqc3tnej9zsx3a64ugg0acjxenwalfqpmchhsy
{
"result": {
"chain": "bitcoin testnet",
"amount_msat": 10000,
"timestamp": "2019-08-01T16:27:36Z",
"expiry": 3600,
"min_final_cltv_expiry": 9,
"pubkey": "02755c6ac43eba81680c45283a80efaf5701ae64f69807133c9256e05f500fa848",
"payment_hash": "24886fb99065ad487d643d6f03396174f6a242e2beb56bb18c8c35a1295a33a5",
"description_string": "ptarmigan"
}
}
送金する
$ ../ptarmcli --sendpayment invoice
code:~ptarmigan/install/node
$ ../ptarmcli --sendpayment lntb100n1pw5xy46np4q0crg4q952u85t6x3htwlhuz4ulqtfzfuj4xg4rmta604lqh988mvpp5fhlwpejapcv9hujlx5snypuhy5k7ez6wq7m7h5nua5ngj5rzsq5qdqqyeurvr9ylpkkcex238z8tjauzldz2egzphcpldcr3729h8jce4mq6p2gtq7cwgcf4kmkrzv2mrt67tc6c9en4pjhk8mgyp9ysswcneqpyxku2p
{
"result": {
"payment_id": 0
}
}
送金したものの状態を確認
$ ../ptarmcli --listpayment=payment_id
code:~ptarmigan/install/node
$ ../ptarmcli --listpayment=0
{
"result": [{
"payment_id": 0,
"payment_hash": "4dfee0e65d0e185bf25f3521320797252dec8b4e07b7ebd27ced268950628028",
"preimage": "585840c1b4e11d8d75c0f02a1a606df74ea814a027c6f32f25068146248951ab",
"additional_amount_msat": 0,
"block_count": 1571966,
"retry_count": 0,
"max_retry_count": 10,
"auto_remove": "false",
"state": "succeeded",
"invoice": "lntb100n1pw5xy46np4q0crg4q952u85t6x3htwlhuz4ulqtfzfuj4xg4rmta604lqh988mvpp5fhlwpejapcv9hujlx5snypuhy5k7ez6wq7m7h5nua5ngj5rzsq5qdqqyeurvr9ylpkkcex238z8tjauzldz2egzphcpldcr3729h8jce4mq6p2gtq7cwgcf4kmkrzv2mrt67tc6c9en4pjhk8mgyp9ysswcneqpyxku2p"
}]
}
チャネルの状態を確認
code:~ptarmigan/install/node
$ ../ptarmcli --getinfo
{
"result": {
"node_id": "02755c6ac43eba81680c45283a80efaf5701ae64f69807133c9256e05f500fa848",
"node_port": 9735,
"total_local_msat": 499990000,
"peers": [{
"role": "client",
"status": "normal operation",
"node_id": "03f0345405a2b87a2f468dd6efdf82af3e05a449e4aa64547b5f74fafc1729cfb6",
"channel_id": "e53cc8d8006c2df48c01878260e2740d53fd48a1425772f8d5ebe42ffcd34c7d",
"short_channel_id": "1571965x84x0",
"funding_tx": "7d4cd3fc2fe4ebd5f8725742a148fd530d74e2608287018cf42d6c00d8c83ce5",
"funding_vout": 0,
"confirmation": 3,
"feerate_per_kw": 253,
"local": {
"msatoshi": 499990000,
"commit_num": 2,
"num_htlc_outputs": 0
},
"remote": {
"msatoshi": 10000,
"commit_num": 2,
"num_htlc_outputs": 0
}
}]
}
}
送金した分が引かれているのを確認
チャネルのクローズ
$ ../ptarmcli -c node_id -x
code:~ptarmigan/install/node
$ ../ptarmcli -c 03f0345405a2b87a2f468dd6efdf82af3e05a449e4aa64547b5f74fafc1729cfb6 -x
lntb10u1pw5xfehpp53jc3n7032vruvyduhwccumgp9j54ac4yd2esa0e790k9h3749sfqdqqxqrp9srzjqfcxsh9gr28y6ngphmk90q05ejfydpq89tjjc5rl36lfmtcv424hk9lmhcqqq6cqqqqqqqlgqqqqqeqqjq7zdcpqedf8ajc0ls462dslppm6xhqqf75vcz3uzanxl9mjenpe3h38szd0d7t3j54wycasxgfuada40vq3y4txespstkvqc6vckxttgp653ys3
2N2ukqzKMS6crmBZAw8EXBLvAQhEGKs31vd