Community Writer Series

Elastos Runtime: A window into a new world of DApps

— by Kiran Pachhai

https://www.youtube.com/watch?v=BnsjGJPMVqo&t=13s

Elastos Runtime is one of the core projects from Elastos that’s open source at https://github.com/elastos/Elastos.RT. It is first and foremost a development framework. Component Assembly Runtime(CAR) technology is heavily used in Elastos projects as it runs through the entire technology system implementation, including Elastos Runtime. Without going into too much technical details, CAR is a component-oriented programming model and also a programming idea where components from different sources(different programming languages) can interoperate. So, you could write code in Java. And then, interact with the code in Javascript from within Java directly using the CAR technology. Hence, the Elastos SDK can be in the form of many different programming languages and because of this agnostic nature, you could develop your DApps without switching to a new language. That’s a little intro to what a CAR does.

Let’s talk about Elastos Runtime itself. Elastos runtime is a C++ Virtual Machine that can run on top of android, ios, linux, windows, etc. So, in the future, you will have an app called “Elastos”(As an example. The name of the app might be different) that you can download from apple store or google store onto your phone. This is just like any other app. However, when you open up this Elastos app, this acts as a gateway/window to the Elastos DApps world. The first thing you will likely see is your home screen that will have all the dapps you have downloaded in the past. There will also be a DApp store where you can go and search for other DApps that you would like to download. This is where you will likely search for the upcoming Dapps built on top of elastos like the dapps released by Viewchain, RIGG, etc. Take a look at the following diagram to get a sense of how elastos runtime will work on an android based device.

Now, let’s talk about the technical sides to Elastos Runtime. You might be wondering why Elastos decided to run their DApps on a C++ Virtual machine? Well, there are a couple of reasons.

  1. Let’s first talk about how Java apps work on your windows or how your android apps work on your phone. Every Java code runs inside a Java Virtual Machine hence, in any device that has Java installed, you can run Java apps easily and this Java Virtual Machine(JVM) acts like a sandbox. However, this is not completely isolated at all. The problem arises when you are developing a game and you need a game engine or a multimedia codec or if you need maximum security. This is where JVM falls short. Because, even if the actual Java code runs inside the Java Virtual Machine, in order to talk to the underlying hardware to utilize the resources the hardware provides, the code needs to talk to the kernel first because kernel is the interface that can talk to the hardware. With that said, you cannot talk to the kernel directly from within this so called “sandbox” in Java Virtual machine. It has to use a bridge called Java Native Interface(JNI). This is the main problem with Java. In order to do this, the code execution has to completely leave the VM first using the JNI which then helps you interact with the hardware. This is the main reason that leads to man in the middle attacks and many virus attacks are based on this vulnerability. This is where Elastos VM(C++ VM) shines. If we run everything in elastos runtime, the code never has to leave this sandbox because you can directly interact with the kernel using C programming language without ever leaving the VM. This prevents the man in the middle attacks and many other viruses.
  2. Another reason Elastos decided to have a C based VM has to do with the fact that you can run this VM in any devices out there because unlike java, you don’t have to install anything on the underlying OS. The kernel in almost every single universal device is written in C so you can run this VM in multitude of devices such an linux, android, ios, windows, etc. This opens the door to couple of things: being able to run elastos runtime on top of any existing OS(like windows, ios, android, etc) and also being able to develop any kind of decentralized apps(DApps) as these apps have the full resources of the underlying hardware to their disposal. At the moment, you’re unable to build any resource intensive apps(such as gives, movies apps, etc) using blockchain via ethereum or NEO or any other platforms that are available right now because all of their DApps will run using their main chain. I’ll talk about the mainchain and sidechain solutions that elastos provides in another article but for now, let’s just say that because you can now run elastos DApps on top of any device out there and because it runs everything in a C++ VM, it has the entire hardware resource to its disposal. So, with elastos, you’re free to make any sort of apps and they will not face scalibility issues whatsoever. This is the main selling point of Elastos.

I hope you all gained a deeper understanding of what Elastos runtime is designed to solve. Stay tuned for more articles in the future.