Published on: 2022-01-24T15:33:32+00:00
On January 24th, 2022, Rusty Russell, Christian Decker, and William Casarin had a discussion about the potential for a common RPC definition with multiple bindings. While they acknowledged that there might not be a control standard, they agreed that having a common subset would be beneficial. William Casarin mentioned his use of json+commando for his prototype and expressed interest in developing an iOS app that could control all node implementations. He planned to test the functionality across multiple implementations before creating a specification. The link to his prototype can be found at [http://git.jb55.com/lnsocket/file/rpc.c.html](http://git.jb55.com/lnsocket/file/rpc.c.html).Christian Decker and Rusty Russell discussed the commando c-lightning plugin, which utilizes the JSON-RPC payload. They both recognized that JSON-RPC is not ideal for handling binary data and lacks streaming capabilities. Christian suggested using grpc as it offers a more compact and rpc-friendly solution. He highlighted its secure transport features, such as TLS, mutual authentication via mTLS, and the ability to add metadata to calls (which could potentially incorporate macaroons/runes in the future). Additionally, grpc supports streaming and provides a compact binary format. Rusty added that having an Interface Definition Language (IDL) to describe the interface would be useful, as it generates conversion code between JSON-RPC and grpc, enabling seamless mapping between the two. Rusty believes that either JSON-RPC or grpc could serve as a foundation for a common RPC definition with various bindings. He emphasized that changing the transport layer beneath grpc does not alter the semantics but unlocks numerous potential use cases. The ultimate goal of an RPC bolt would be to enable lnsocket to communicate with any lightning node. However, they concluded that although a control standard may not be achievable, having a common subset would be desirable.Christian, an iOS developer, has created a C library called lnsocket that allows him to send messages from iOS to control his lightning node. He is currently deliberating on the format for RPC commands. While JSON-RPC is commonly used, it presents issues with binary data and lacks streaming capabilities. Christian believes that grpc, which is more compact and rpc-friendly, would be a better option. Rusty is also working on a summer of bitcoin project aimed at exposing a websocket directly to browsers as an alternative communication channel with lightning nodes. Christian envisions an RPC bolt as a powerful tool that would enable lnsocket to communicate with any lightning node. He considers JSON-RPC and grpc as potential bases for a common RPC definition with multiple bindings since they facilitate conversion between the two formats. Christian has also included clightning/lightning-dev in his correspondence to gather input from others who may be working on or contemplating similar ideas. He welcomes suggestions, comments, and criticism. The cln-grpc crate and cln-plugin crate are both works in progress, with the former being reviewable in its current state and the latter containing the core functionality required for the cln-grpc-plugin. The cln-rpc crate currently lacks many RPC commands, but Christian plans to address this separately.Following this discussion, Will reached out to Christian regarding the use of RPC over lightning. Will has developed a C library called lnsocket, which enables him to send messages from iOS to control his lightning node. After reaching a milestone with lnsocket where he can send TLVs (Type-Length-Value), he is now considering the format for RPC commands. Will mentioned that although the c-lightning plugin employs the JSON-RPC payload, he believes that a more compact and rpc-friendly solution like grpc would be preferable. He expressed curiosity about the cln-grpc PR. Will is convinced that an RPC bolt would have tremendous long-term potential. In response to Will's message, Christian mentioned that the cln-grpc PR is the final one in the cln-* series. It exposes JSON-RPC over grpc with built-in mTLS authentication. The pull request can be viewed on GitHub.
Updated on: 2023-08-01T00:04:52.883028+00:00