<oembed><type>rich</type><version>1.0</version><title>Christian Decker [ARCHIVE] wrote</title><author_name>Christian Decker [ARCHIVE] (npub1wt…gtuyn)</author_name><author_url>https://yabu.me/npub1wtx5qvewc7pd6znlvwktq03mdld05mv3h5dkzfwd3dc30gdmsptsugtuyn</author_url><provider_name>njump</provider_name><provider_url>https://yabu.me</provider_url><html>📅 Original date posted:2022-01-19&#xA;📝 Original message:&#xA;Hi Will,&#xA;&#xA;&gt; I noticed you are doing RPC stuff... I&#39;m looking to do RPC over&#xA;&gt; lightning itself. I started a C library called lnsocket[1], scrounged&#xA;&gt; from clightning parts, so that I can send messages from iOS to control&#xA;&gt; my lightning node.&#xA;&#xA;Sounds interesting, and similar to commando&#39;s goals. Rusty also has a&#xA;summer of bitcoin project attempting to expose a websocket directly to&#xA;browsers in order to provide another way to communicate with your node,&#xA;and of course there&#39;s commando.&#xA;&#xA;&gt; I&#39;ve got to the point with lnsocket where I can send TLVs to my node,&#xA;&gt; and now I&#39;m starting to think about what format the RPC commands should&#xA;&gt; be.&#xA;&gt;&#xA;&gt; I noticed the commando c-lightning plugin just uses the JSON-RPC&#xA;&gt; payload, but perhaps something more compact and rpc-friendly like grpc&#xA;&gt; would be better... which is why this cln-grpc PR peaked my curiosity.&#xA;&#xA;Yep, JSON-RPC is rather bad with binary data, and doesn&#39;t have any&#xA;concept of streaming. I personally like grpc because it ticks a lot of&#xA;boxes: secure transport over TLS, mutual authentication via mTLS,&#xA;possibility to add metadata to calls (technically prohibited by the&#xA;JSON-RPC spec) which can help us use macaroons/runes in future,&#xA;streaming support and compact binary format.&#xA;&#xA;Having an IDL to describe the interface is also rather nice, even though&#xA;for cln-grpc we actually generate that from the JSON-RPC schemas, so&#xA;it&#39;s a bit less expressive than .proto files.&#xA;&#xA;&gt; I think the end goal of an RPC bolt would be super powerful, so that&#xA;&gt; lnsocket could talk to any lightning node, but that could be further&#xA;&gt; down the line. Choosing the right data format seemed like an important&#xA;&gt; step in that direction. Would love to hear your thoughts on this!&#xA;&#xA;I agree. Exchanging the transport layer underneath grpc doesn&#39;t change&#xA;semantics, but does unlock a number of potential use-cases. I think&#xA;either the JSON-RPC or grpc can serve as a basis for a common RPC&#xA;definition that can have any number of bindings, since we generate&#xA;conversion code to/from JSON-RPC and grpc we can transparently map them&#xA;back and forth.&#xA;&#xA;&gt; I&#39;ve cc&#39;d clightning/lightning-dev as well to see if anyone else is&#xA;&gt; working on this or thinking about this stuff right now.&#xA;&#xA;Definitely open to suggestions, comments and criticism: the cln-grpc [1]&#xA;crate is rather new, and will see a number of rebases and fixups, but&#xA;should be reviewable as is. The cln-plugin [2] crate is a bit less&#xA;well-fleshed-out, but has the core functionality needed for&#xA;cln-grpc-plugin which was the goal of this first exploration. The&#xA;cln-rpc [4] crate is also missing many RPC commands, but that&#39;s just&#xA;grunt work that I plan to tackle separately :-)&#xA;&#xA;Cheers,&#xA;Christian&#xA;&#xA;[1] https://github.com/ElementsProject/lightning/pull/5011&#xA;[2] https://github.com/ElementsProject/lightning/pull/5012&#xA;[3] https://github.com/ElementsProject/lightning/pull/5013&#xA;[4] https://github.com/ElementsProject/lightning/pull/5010</html></oembed>