Skip to content
LearnBitcoin

ResearchBitcoin Dev Archive lightning-dev list

Lightning JavaScript implementation that conforms BOLT

3 messages, Apr 12 to 23, 2018. Started by Быхун, Алексей Викторович.

Быхун, Алексей Викторович, Igor Cota, Tyler H

Permalink First message in the Wayback Machine

Быхун, Алексей Викторович permalink original

Hi everyone!

I am looking for a way to run a LN node inside the browser. One way would be to implement BOLT protocol from scratch in JS, but I am thinking of a more easy way.

Has anyone succeed in compiling, for example, c-lightning project ( https://github.com/ElementsProject/lightning) under WebAssembly ( http://webassembly.org/getting-started/developers-guide/).

WebAssembly is a C/C++ compiler into browser-compatible byte-code. It can use JS-API, but can also work with low-level C functions.

There are some things c-lighting does (e.g. sockets), that should stop it from compiling easily. However, there are wrappers for many C-functions by Emscripten lib: https://github.com/kripken/emscripten.

My question is what should I look for when trying to run that? And also, I want to hear your general feedback on the idea.

Aleksey Bykhun.

Igor Cota in reply to Быхун, Алексей Викторович permalink original

Hi Aleksey,

Your biggest obstacle is probably the fact that c-lightning spawns several processes (subdaemons) and depends on the bitcoin-cli binary for bitcoind RPC. If WebAssembly supports multiple processes (not just threads) that's a good start I guess.

There is a c-lightning specific mailing list on https://lists.ozlabs.org/listinfo/c-lightning

Cheers, Igor

On 12 April 2018 at 16:39, Быхун, Алексей Викторович < aleksey.bykhun at phystech.edu> wrote:

Quoted text (28 lines)
> Hi everyone!
>
> I am looking for a way to run a LN node inside the browser. One way would
> be to implement BOLT protocol from scratch in JS, but I am thinking of a
> more easy way.
>
> Has anyone succeed in compiling, for example, c-lightning project (
> https://github.com/ElementsProject/lightning) under WebAssembly (
> http://webassembly.org/getting-started/developers-guide/).
>
> WebAssembly is a C/C++ compiler into browser-compatible byte-code. It can
> use JS-API, but can also work with low-level C functions.
>
> There are some things c-lighting does (e.g. sockets), that should stop it
> from compiling easily. However, there are wrappers for many C-functions by
> Emscripten lib: https://github.com/kripken/emscripten.
>
> My question is what should I look for when trying to run that? And also, I
> want to hear your general feedback on the idea.
>
> Aleksey Bykhun.
>
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>
>
Tyler H in reply to Igor Cota permalink original

Aleksey,

Considering the security situation with browsers, I think a better approach would be to write an extension that interfaces with a daemon already running on the system thrlugh REST or similar.

Lightning Charge would help here for c-lightning, or lnd has REST and gRPC built in.

The key difference here is key msterial isn't accessed by the browser and secured by the browser's pitiful security, but instead live in the usual directory and the daemon handles it normally.

You could even do something like the Tor Browser Bundle and bundle the daemon with the browser in a neat package.

Thanks, Tyler

On Mon, Apr 23, 2018, 02:27 Igor Cota <igor at codexapertus.com> wrote:

Quoted text (54 lines)
> Hi Aleksey,
>
> Your biggest obstacle is probably the fact that c-lightning spawns several
> processes (subdaemons) and depends on the bitcoin-cli binary for bitcoind
> RPC. If WebAssembly supports multiple processes (not just threads) that's a
> good start I guess.
>
> There is a c-lightning specific mailing list on
> https://lists.ozlabs.org/listinfo/c-lightning
>
> Cheers,
> Igor
>
> On 12 April 2018 at 16:39, Быхун, Алексей Викторович <
> aleksey.bykhun at phystech.edu> wrote:
>
>> Hi everyone!
>>
>> I am looking for a way to run a LN node inside the browser. One way would
>> be to implement BOLT protocol from scratch in JS, but I am thinking of a
>> more easy way.
>>
>> Has anyone succeed in compiling, for example, c-lightning project (
>> https://github.com/ElementsProject/lightning) under WebAssembly (
>> http://webassembly.org/getting-started/developers-guide/).
>>
>> WebAssembly is a C/C++ compiler into browser-compatible byte-code. It can
>> use JS-API, but can also work with low-level C functions.
>>
>> There are some things c-lighting does (e.g. sockets), that should stop it
>> from compiling easily. However, there are wrappers for many C-functions by
>> Emscripten lib: https://github.com/kripken/emscripten.
>>
>> My question is what should I look for when trying to run that? And also,
>> I want to hear your general feedback on the idea.
>>
>> Aleksey Bykhun.
>>
>> _______________________________________________
>> Lightning-dev mailing list
>> Lightning-dev at lists.linuxfoundation.org
>> https://www.learnbitcoin.com/archive/lists/lightning-dev
>>
>>
>
>
> --
> *Igor Cota*
> Codex Apertus Ltd
> _______________________________________________
> Lightning-dev mailing list
> Lightning-dev at lists.linuxfoundation.org
> https://www.learnbitcoin.com/archive/lists/lightning-dev
>