As the Elastos ecosystem continues to come together on elastOS, Elastos Foundation breaks down one of its most powerful features which has been flying under the radar. As the flagship application of the Elastos ecosystem, elastOS is certainly the home and most direct access point to all things Elastos; but to the decentralized network of teams building out Elastos, versatility must remain paramount, and developers must be afforded every opportunity to build applications on their own terms. Trinity Native has been developed to fulfill this prerogative, and it is now fully available to developers ready to build on Elastos.
Trinity Native: In a Nutshell
Simply put, Trinity Native reduces development barriers by allowing elastOS dApp developers to run their dApps outside of elastOS. Trinity Native is composed of two main components:
- A package that includes a portion of elastOS’ (formerly: Trinity) source code and a third party dApp designed for elastOS.
- A tool that combines the above package and elastOS to produce a native dApp capable of running outside of elastOS.
Write Once, Run Everywhere:
Trinity Native enables the exact same code written for elastOS to both run inside elastOS and function as a native application, all without a single change in the third party dApp source code.
All dApps Depend on elastOS Runtime:
Just like other dApps running in elastOS, Trinity Native dApps depend on elastOS’ runtime for basic functionality. And of course, all dApps running in elastOS are decentralized by nature, and thus do not rely on application developers to store user accounts on a central server. Subsequently, users are responsible for their accounts, and must use existing applications dedicated to wallet functions, identity services, and data storage in the absence of centralized support. Fortunately, elastOS provides the decentralized tools to realize such a decentralized model, and it is for this reason that all Elastos dApps – not only Trinity Native variants – must rely on elastOS in order to carry out basic functions.
Differentiating between elastOS and Trinity Native
Both elastOS dApps and Trinity Native dApps share the same code base: the Trinity runtime, Trinity plugins, Trinity toolchain, and API references.
However, elastOS is packaged with its own main app referred to as the “Launcher,” which is the first dApp presented to users upon opening the application. The Launcher can also access all built-in dApps, such as the Identity Capsule, Wallet Capsule, Hive Manager Capsule, Password Manager Capsule, and Settings Capsule. elastOS can also handle external requests called “Intents” from other apps that are sent to the Identity Capsule, Wallet Capule, and Hive Manager Capsule.
Trinity Native dApps, on the other hand, act as the first and only dApp presented to users upon launch, and do not package any additional dApps.
After the initial releases of elastOS, some segments of the community expressed concern that in elastOS’ early stages, most developers and businesses are unlikely to write their dApps inside another application such as elastOS, thus increasing barriers to adoption. While elastOS draws a number of key advantages from its fully integrated ecosystem of decentralized services, community concerns were far from unfounded: requiring developers to build directly in elastOS is not conducive to scoring early adopters. As elastOS continues to grow and approaches the status of a robust ecosystem, more dApps and powerful services will populate the platform, and developers will be increasingly enticed to build and run their applications from within elastOS.
In the meantime, Trinity Native acts as an on-boarding developer tool of sorts, allowing elastOS dApp developers to package completed or in-development dApps as native Android or iOS applications. In this way, Trinity Native resolves the early-stage challenges involving developer flexibility and adoption, all the while allowing elastOS to do what it does best: leverage its decentralized ecosystem model to securely manage user accounts. Really, it is nothing short of a win-win.
dApp Development Flow
In the Elastos ecosystem, getting started as a developer is simple because the development process always begins in the same place, regardless of what is being developed. Whether a develop plans to initially publish as a dApp inside elastOS or as a native application, he or she will follow the same process:
- Use the same command line tool
- Use the same libraries
- Read the same guides and API references
From here, a developer can choose whether to:
- Run his or her dApp inside elastOS during development, or
- Run his or her dApp as a native application.
Independent of the objective, the work flow remains consistent throughout.
Of course, at the stage of publication, there are a couple minor deviations to be considered. To publish on elastOS, the elastOS Trinity command line tool is used and it’s quite straight forward. On the other hand, to publish on native app stores – namely, the Google Play Store and Apple App Store, a project must be opened using traditional tools such as Android Studio or Xcode, and developers must follow the established publication processes outlined by either Google or Apple.
Sorting it Out: elastOS Capsules, Trinity Native dApps, and Native Elastos dApps
First and foremost, it must be emphasized that Trinity Native dApps are native applications. By embedding Trinity’s runtime, Trinity Native dApps allow developers to communicate with elastOS more effectively. Nonetheless, the action and response flows are identical: the user signs in – without being prompted to import mnemonics, by the way – pays with his or her wallet, accesses a contact, runs a smart contract, and whatever else he or she may choose to do.
In the following diagram, elastOS is presented as the central point in all process flows because it is currently the only application providing Elastos identity management, wallet management, storage management, and other key services. In the future, process flows may be adjusted as further Account Management applications are developed.
Although Trinity Native offers a powerful toolset for developers, Trinity Native applications still operate under a couple of minor limitations which do not apply to other native applications. The following limitations should be noted:
- Trinity Native applications cannot replace or customize elastOS’ default title bar at the moment, although development efforts may allow for improved flexibility and customization in the future.
- For the time being, the only native features available are those provided by the Trinity runtime. For example, elastOS provides access to the camera through a camera plugin, but does not provide any feature related to Bluetooth. In this case, dApps are not able to use Bluetooth, or to extend current Trinity plugins, for that matter.
The good news is that Trinity Native is now ready, including the build tool and Trinity runtime. Both simple and complex dApps have been already developed and run successfully, including a DID demo, DPoS Voting application, and Feeds, among others. The Trinity Tech team is currently in the process of refining and finalizing various pieces of documentation. Overall, the ecosystem is beginning to come together, and a unified technological infrastructure is now within the horizon.
Thus, the next big leap for Trinity Native is Trinity Native: for Desktop, which will allow developers to build native applications for Mac, Windows, and Linux. Of course, while such a vision represents a very exciting milestone, it also requires development of elastOS: for Desktop to be completed first. Needless to say, we have a big year ahead of us for 2021!
For Developers looking to build in Trinity Native, please visit the dedicated link at our developer portal below:
Trinity Native Development
Meanwhile, the Trinity Tech team remains hard at work building tools and providing key support for a versatile developer experience. As Trinity Tech integrates new features to elastOS, prepares for upcoming releases, and hits major development milestones on the development of elastOS: for Desktop, continue to check in at the official Elastos Info Blog for all of Elastos’ latest technical developments.