During the Basel meeting, the idea of moving the communication protocol to status-go was brought up again. Weither some code should be on go or clojurescript side is a recurring topic of discussion at Status. Historically the rule of thumb was that status-go should only contain patches required to work on mobile and everything else should be on status-react side. The idea was that it should be easy to swap ethereum implementation.
This post is a proposal for the definition of a stable, documented interface exposing Status primitives for managing accounts, wallets, settings, chatting, etc. intented to be used by status-react and third party developers to easily build on top of ethereum protocols.
Design principles
Stable, Growing API
The API, past the initial experimentation phase, should remain stable so that developers can confidently build on top of it (cf Rich Hickey talk on accretion https://www.youtube.com/watch?v=oyLBGkS5ICk). For instance, even if the underlying implementation of the chat protocol is changed, the API does not and third party developers only have to update the implementation of the status API to be compatible with the status network.
Extend web3
Whenever possible, the API will be exposed by extending web3.status object
We would have for instance: web3.status.chat
with chat primitives such as addContact
, sendMessage
…
Implement as a library
status-api
, written in go, would be included in status-go.
Client/Server analogy
status-react
is the UI, anything that would be done server-side in a web application should be done in status-go/status-api. This also mean our implementation of the status API would be the goto requirement for someone who would want to develop a CLI or alternative UI for status that would be fully compatible with the status network.
Goals
Improve testing
Both sides of the API can be mocked to test them independently, with reproducible test to evaluate the impact of changes on performance, battery, and network consumption. This could make @lukasz job much easier.
Possible objective: have automated battery test for each commit of status-react and status-go
Improve performance
web3.status calls being higher level, this will reduce the interactions between status-go and status-react. We shouldn’t have cascades of callback anymore as it will happen on go side.
Many computations will be moved away from JS thread, enabling multithreading capabilities.
We would remove realm, which was a bottleneck for status-react, and rely on status-api for persistence.
@jan.herich could elaborate on that point.
Possible objective: no more lags in the application for chats with huge amount of messages
Reduce security risks
We would further reduce the amount of js dependencies, reducing the threat that they represent.
With the client/server approach, we could also minimize the attack surface of the remaining dependencies.
Make codebase more accessible
Such a change would make the codebase more accessible for both go and clojure developpers
Go is an easier language with more developers and traction for doing the kind of things that happen in the backend compared to clojurescript on react-native
Status-react will have less domain specific code and less backend-like
code. React-native being already a niche in clojurescript world this will lower the barrier of entry for wannabe contributors.
Possible objective: reach X contributors for status-api and Y contributors for status-go by the end of Q3
Portability
We don’t know what mobileOS might come out tomorrow, with better security guarentees. With a well defined API, we make it easier for ourselves to develop for new plateforms.
Risk analysis/Feasability
Integrate status-api as a library for status-go
This was mentionned as the preferable way to do it by @adam
Extend web3 (Low risk)
This was already done for our whisper extensions
Replace Realm (High risk)
This should be clarified and tested as early as possible.
- Can we do everything we need with leveldb ?
- Can we encrypt the database for each account ?
Future work
Project management
- create swarm
Status-go
I suppose status-sdk could be use as a starting point ?
@adriacidre @pedro @adam
Status-react
- mock status-api for use in status-react
- create re-frame library for status-api
- trim status-react of functionnality now handled by status-api
- build status-react with mock of status-api