Skip to content
This repository has been archived by the owner on Jan 25, 2022. It is now read-only.

Interoperable web3 plugins #65

Open
3esmit opened this issue Oct 17, 2019 · 4 comments
Open

Interoperable web3 plugins #65

3esmit opened this issue Oct 17, 2019 · 4 comments

Comments

@3esmit
Copy link

3esmit commented Oct 17, 2019

What problem are you trying to solve?

Currently there are several browsers, and each one of them have a different api for their "addons", some not even support.
Status.im also is working on extensions for web3, but currently developers have to write the DApp plugin for MetaMask and for Status.

Describe the solution you'd like

I want a universal API and binaries that work in any web3 browser that supports it.
Support of most web3 features should be plugins:

  • Tokens/badges/claims (ERC20, ERC721, ERC735)
  • Account contracts (MultisigWallet, GnosisSafe, ERC725, Universal Logins)
  • Hardware wallets (Nano Ledger, Keycard)
  • Gas abstraction (ERC1077)
  • Key derivation and access (ERC1581, ERC1775)
  • ENS stuff
  • contenthash
  • (...) what else, what not?

Lua as embedded scripting language for web3 plugins?

Currently Status extensions are written in clojure, not very user friendly (((((()))))), therefore I wanted a more user friendly scripting language, allowing more users to make their own extensions.
The first programming language I written in life was Lua, for modding a game when I was 10 years old, which made me think is a good option for web3 extensions.
The programming language Lua is interesting because:

  • Easy to non-programmers: dynamic typed and procedural syntax, array starts at 1
  • Popular: Interpreter available for many programming languages
  • Sandbox: plugins would only be able to access the API
  • Lightweight: C interpreter is ~100KB

Lua is popular specially in games, to separate engine programming from game scripts, so the whole history of the game, definition of models, even the user interface, can be defined directly by the game designers (not programming professionals), without them having to recompile the whole software and without having to learn a hard programing language.

I see that JavaScript itself would be suitable for universal addons, specially because MetaMask and Status already runs over JavaScript, and probably all web3 browsers will have a JS to execute it, and I think it would be also a good option, I mentioned Lua because it seems a better option for users in terms of easy-to-use. Let me know what you think about Lua and web3 plugins.

@danfinlay
Copy link
Collaborator

Oh hey, sorry for the slow reply, took a week off after Devcon.

We largely chose JS because:

  • Most of the libraries we want to support are already in JS.
  • We have an extremely lightweight containment strategy (SES).

Also, since JS is the native web environment, anything that can be done in the browser (including running a compiled Lua addon) can be done within JS, probably via a WASM compiled lua environment.
https://github.com/vvanders/wasm_lua

For that reason, supporting JS seems like a superset of supporting Lua to me.

It would be interesting to build a "Lua plugin plugin" that allowed plugins to be written in lua. Both this, and support for Status plugins, and support for AlphaWallet's TokenScript should be definable as plugins.

@3esmit
Copy link
Author

3esmit commented Oct 22, 2019

Hey, no problem, yeah I know how that trips wear us out!

Interoperability

Currently Status.im uses ClojoreJS for extensions, which compiles into JavaScipt, so would be easy for MetaMask supporting a compiled ClojureJS extension. However we need to solve the dependency problem.. Not all plugins that work in one browser might work in other because of some dependencies.

Status.im plugins can interact with Ethereum (wallet), Status Network (and Whisper), bind to chats, and this could be enabled by another plugin installed in MetaMask, built using status-js-api.

My suggestion is to abstract all possible as plugins, because this would render the most powerful plugin API.

Lua

I am really amazed by https://luakit.github.io/ and the idea of customizable browsers. Wasm Lua is interesting for embedding Lua in browser.
I think we should consider Lua for future, I can start as you suggested, as a plugin that enables Lua, and if it shown to be better we can bring this to the roots like luakit.

@danfinlay
Copy link
Collaborator

That Luakit browser looks very cool. I really do think taking browsers back to the root is a good direction long term, as the modern web just leaks too much authority, the user has very little control.

Wow, I hadn't seen status-js-client before, but it totally would make sense as a mm-plugin. It could likely enable users to sign into status chats from their browser?? Great library, this is exactly the kind of neat interface that makes a plugin easy to implement.

@danfinlay
Copy link
Collaborator

Does the js client need anything a browser environment doesn't have available? Our usual problem as a browser tool is that we can't use whisper b/c it uses tcp.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants