Git Product home page Git Product logo

trappist-extra's Introduction

Trappist Extra

Trappist Extra

Trappist Extra is a sample mobile decentralized app that demonstrates the integration of a light client node, which enables the app to connect, quickly sync and interact with any Substrate-based blockchains, including the Polkadot Network, in a fully trustless and decentralized way.

The app is built with Flutter, the multi-platform app development framework; smoldot, a cross-platform light client node implementation written in Rust; and the flutter_rust_bridge, a library and code generator which enable seamless integration of native rust code in a Flutter app.

Why "Trappist Extra" ?

This project is related to the Trappist project, a web3 developer playground built for experimenting with cross-chain applications and services built on the technologies spearheaded by the Polkadot Network.

The term Trappist refers to a style of beers brewed in Abbeys by Trappist monks, and is generally associated with authenticity, craftsmanship, integrity and tradition. Aside from any religious consideration, we like to think we put as much care in crafting Blockchain software as monks brewing high-quality beer ๐Ÿบ.

The added Extra term (also named Enkel, Single or Gold) is usually used by a brewery to describe its lightest beer. As this project is a showcase application for light clients, we found the name to be a natural fit.

As Trappist breweries are not intended to be profit-making ventures, this project is non-commercial, open-source software focused solely on experimentation and knowledge sharing with people interested in learning about decentralized technologies.

Getting Started

Rust Setup

First, complete the basic Rust setup instructions. Then, follow the detailed instructions below.

Platform setup

Depending on the device you want to deploy on either choose Linux & Android on Linux or macOS, iOS & Android on macOS.

Current limitations

This is an early stage sample application, with a number of known limitations:

  • Compilation of the smoldot-flutter library to x86_64-linux-android & x86_64-apple-ios targets currently fails. This prevents to run the app in an Android & IOS emulator. Investigation is ongoing to address this shortcoming (PR welcome).
  • Integration that has been tested with the Android app, Linux, MacOS and IOS. The last step would be to ensure it works on Windows as well. No effort will be put into the Web target though, as the Substrate Connect project is already addressing this use case by embedding a WASM light client into a web-based decentralized application.
  • The code of the embedded smoldot-flutter library is very rough, and currently contain some hard-coded parts (e.g. connection to the Polkadot network) which should be parameterized, and made more generic for reuse in other projects.

License

Trappist Extra is licensed under Apache 2.

trappist-extra's People

Contributors

evilrobot-01 avatar daanvdplas avatar rmaronn avatar

Stargazers

Muhammad Adeel Danish avatar Amar Singh avatar Andreea Eftene avatar Aditya Birangal avatar  avatar kirby avatar  avatar gupnik avatar Pedro Galveias avatar Viki Val avatar Luke Schoen avatar  avatar Paulo Martins avatar Squirrel avatar Remigio Bongulielmi avatar Dustin Brickwood avatar Will Pankiewicz avatar Tomasz Waszczyk avatar  avatar Andrew Jones avatar Jeru avatar Tony Riemer avatar robert avatar David Semakula avatar  avatar gabriel klawitter avatar Ankan avatar Phil Kwok avatar Daniel Bigos avatar Javier Viola avatar Leonardo Razovic avatar Hamid Alipour avatar BenWhiteJam avatar wigy avatar  avatar Alejandro Martinez Andres avatar Nuke ๐ŸŒ„ avatar Kian Paimani avatar

Watchers

Ayush Mishra avatar Hector Bulgarini avatar Artur Gontijo avatar Daniel Bigos avatar  avatar  avatar

trappist-extra's Issues

Extract app light client logic into separate component

The current implementation ties the subscription to current chain's JSON-RPC responses to the home page (see here).
We should extract the light client -related logic into a separate component, that could provide the light client data to multiple UI widgets.

Worth mentioning, on the Rust side, the listen_json_rpc_responses function is blocking, and can only be called by one consumer at a time, because it is mutating a data stream that is held in a static context.

Therefore, on the Flutter side, the JSON-RPC responses should probably be exposed as Broadcast stream, to allow multiple concurrent subscriptions from more than one UI widget.

And the component encapsulating the light client logic can be exposed to various parts of the app using simple app state management techniques (e.g. Provider package), or more complex ones (e.g. Redux, MVVM, etc).

Some useful links

Native mobile Polkadot app

Why not go native android or Kotlin Multiplatform instead of doing Flutter? Does this suggest it's possible to build a fully native decentralized app on Polkadot (not using Flutter/Dart)?

Use the new JSON-RPC API

When executing the app, Smoldot logs the following warning about the use of the legacy JSON-RPC API:

[WARN] The JSON-RPC client has just called a JSON-RPC function from the legacy JSON-RPC API (chain_subscribeNewHeads).
Legacy JSON-RPC functions have loose semantics and cannot be properly implemented on a light client.
You are encouraged to use the new JSON-RPC API <https://github.com/paritytech/json-rpc-interface-spec/> instead.
The legacy JSON-RPC API functions will be deprecated and removed in the distant future.

As recommended, we should use the new JSON-RPC API instead.
So, instead of the old chain_subscribeNewHeads API, use the new chainHead_unstable_follow API (see its usage in the spec).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.