Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
LNDのgRPC/RESTインターフェース
Search
shigeyuki azuchi
December 24, 2021
Technology
150
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
LNDのgRPC/RESTインターフェース
GBECの解説動画の資料です。
https://goblockchain.network/2021/12/lnd_grpc-rest_interface/
shigeyuki azuchi
December 24, 2021
More Decks by shigeyuki azuchi
See All by shigeyuki azuchi
SLH-DSA (SPHINCS+)
azuchi
0
25
Hyper Tree
azuchi
0
23
FORS
azuchi
0
38
クラスターmempool
azuchi
0
49
W-OTS+
azuchi
0
55
Shorのアルゴリズム
azuchi
0
73
DahLIAS: Discrete Logarithm-Based Interactive Aggregate Signatures
azuchi
0
60
Fiat-Shamir変換と注意点
azuchi
0
270
AssumeUTXOを利用したブロックチェーンの同期
azuchi
0
75
Other Decks in Technology
See All in Technology
基本から分かる!AWSセキュリティ運用の考え方と任せ方
cmusudakeisuke
1
410
Sinatra on PicoRuby ローカルでセルフホスト
bash0c7
0
100
サボる子はいねぇがー!AgentCoreハーネスの脆弱性に学ぶ、エージェントの入力バリデーション
iwamot
PRO
4
240
あなたのDartコードは丸見えかもしれない ~reFlutterで暴くFlutterアプリの中身と多層防御~
zozotech
PRO
0
770
増え続けるプロダクトの品質をどう担保するか。ProductSpecとTypeScriptによる取り組み
joere
3
390
リアクションエンジニア ― 小さなリアクションから、話しかけやすい組織をつくる ―
ryuguyana
1
130
続・ソフトウェアアーキテクトのための意思決定術: Decision Readiness, Revisited — When AI Changes the Economics of Software Architecture
snoozer05
PRO
9
2.2k
バックオフィスに染み出すTypeScript ── clasp で安全に仕組みを作る
nealle
1
180
生き様としてのSRE
hokkai7go
1
170
You Have Agency(サンキュー、Ruby)
snoozer05
PRO
5
680
セキュリティ専任チームなしで攻撃を先回りするSREが実践したSIEM on Amazon OpenSearch Service
cscengineer
PRO
0
240
re:Invent2026 事前勉強会 歴史と愉しみ方10分LT編
toshi_atsumi
0
130
Featured
See All Featured
Building a A Zero-Code AI SEO Workflow
portentint
PRO
0
810
Everyday Curiosity
cassininazir
0
390
WCS-LA-2024
lcolladotor
0
970
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.4k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
6
1.3k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.4k
Docker and Python
trallard
47
4.3k
Game over? The fight for quality and originality in the time of robots
wayneb77
1
330
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
Thoughts on Productivity
jonyablonski
76
5.4k
Code Reviewing Like a Champion
maltzj
529
40k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
380
Transcript
LNDのgRPC/RESTインターフェース
1 LNDのgRPC/RESTインターフェース LNDではノード操作が可能なAPIが提供されている • gRPC API https://api.lightning.community/#lnd-grpc-api-reference •
REST API https://api.lightning.community/#lnd-rest-api-reference ※ gRPCを使うとLNDとアプリの双方向の通信が可能になり便利
2 macaroon LNDへの接続にあたって、アクセス権の認証をするための仕組みが macaroon • cookieみたいなもので、LNDはmacaroonが正しい鍵で署名されていることを検証 • cookieと同様、TLSなどの安全なチャネルを介して送信する必要がある
• macaroonの委譲や、より限定したバージョンの作成も可能 admin.macaroon readonly.macaroon invoice.macaroon すべてのgRPCの読み取り/書き込み権限を付与 (lncliで使われている) すべてのgRPCの読み取り専用のアクセス権を付与 (アプリのモニタリング用途など) インボイス関連のgRPCの読み取り/書き込み権限を付与
3 macaroonを使ったアクセス リクエストヘッダーにmacaroonをセットしてアクセス Grpc-Metadata-macaroon: <macaroonのHEX値> • curlで実行する場合
# curl --header "Grpc-Metadata-macaroon: $(xxd -ps -u -c 1000 <macaroonファイルのパス>)" https://umbrel.local:8080/v1/getinfo ※ xxdコマンドはファイルをHEXダンプするコマンド ◦ オレオレ証明書の場合は、--cacertオプションでLNDのtls.certを指定 --cacert <tls.certのパス>
4 gRPCインターフェース *.protoファイルをダウンロードして各言語用にコンパイルすればコードが生成され利用可能に。 https://github.com/lightningnetwork/lnd/tree/master/lnrpc 各言語でライブラリとして提供されているケースも:
LNDのHTLCイベントをキャプチャするツール: https://github.com/azuchi/lnd-tool require 'lnrpc' lnd = Lnrpc::Client.new({ credentials_path: '/path/to/tls.cert, macaroon_path: '/path/to/admin.macaroon', address: 'host:port' }) lnd.router.subscribe_htlc_events.each do |event| puts event end