Advertisment

Qtum is on the move with the announcement of a partnership with Baofeng to begin running 50,000 full Qtum nodes and an upcoming x86 VM to support multiple languages for smart contracts.

Qtum is a hybrid of Bitcoin and Ethereum that is based on proof-of-stake consensus instead of proof of work, and is compatible with existing Ethereum contracts as well as Bitcoin gateways. Supporting the Ethereum Virtual Machine (EVM) wasn’t enough for Qtum co-founder Jordan Earls, who has been working on an x86 Virtual Machine for the Qtum system.

Earls comments that a great reason to build a x86 VM is to add more programming language support for smart contracts, his favorite being Rust. The overall list of objectives is much bigger though:

  • Programming Language Support
  • Standard Library
  • Optimized Gas Model
  • Unlock the full power of the Account Abstraction Layer (AAL)
  • New possibilities for smart contracts
  • First-Class Oracles
  • Blockchain Analysis
  • Alternative Data Storage
  • Explicit Dependency Trees

Bitcoin Magazine spoke with Earls with some more in depth questions about some of those items:


Bitcoin Magazine: What proof of concept or scalability testing have you done for the VM?

Jordan Earls: We have a very rough proof of concept we completed a few months ago where we integrated a prototype x86 VM into the Qtum network. This success is what led us to pursue this plan. We are confident that the x86 VM will be more scalable than the EVM, but we are thus far unsure how much. We are designing the VM and all of its APIs and other aspects to be scalable. We are making a big shift in the smart contract world where we actually reward smart-contract developers (in the form of cheaper gas costs) for limiting the features their smart contract has access to, and we are confident it will be faster than current EVM technology.  

Bitcoin Magazine: What are you doing to address the problem with x86 programming in general, where they assume near infinite memory and CPU time being available?

Jordan Earls: We think smart contract development crossed with this x86 paradigm will resemble something similar to real-time or embedded programming, where there are various constraints that developers must always be optimizing for.  

We foresee the same kind of design optimizations happening in the smart contract world as happen in the embedded world, and, for the first time, Qtum’s blockchain will allow for these small optimizations to be directly rewarded for all users of the smart contract.

We know these optimizations are not cheap for smart contract developers to spend their time on, so we need to reward developers for taking such steps to keep the Qtum blockchain running smoothly and efficiently.

Bitcoin Magazine: What are some of the advantages with the Standard Library that will help keep smart contract code tight?

Jordan Earls: Currently in Ethereum, if you want to do a simple operation, like testing if two pieces of text are equal, you need to write your own code to do it.

This is a problem for a number of reasons: Developers in a secure context should rely on existing code that’s been tested and verified, if possible. A naive implementation of this function will be slow, but a more complex and optimized implementation could have security problems. Deploying this code with your contract means another 100 bytes or so of wasted code that every node in the ecosystem now has to worry about.

Qtum will provide a standard library of functions that contract developers can rely on to have reasonable gas costs, secure and validated implementation and an easy to use interface. This means less bloat on the blockchain, easier to write and understand smart contracts and even a faster blockchain (since these functions can be optimized with native code).

Bitcoin Magazine: What about executable size? These x86 programs tend to be quite large.

Jordan Earls: This is true but also misleading. If I write a C program that just prints “hello world,” about 8kB of that is going to just be the number “0.” This is because x86 processors (as well as many others including ARM) benefit from a thing called “alignment.” The important thing for Qtum is that the wasted bytes doing alignment can be discarded without performance impact. This immediately brings down that C program build to ~1-2kB.

We can reduce even more because we don’t need all the baggage required by a standard program for Windows: We have our own “operating system” for smart contracts, so only a dozen or so bytes of actual setup code is wasted.

We have done some actual physical tests with these configurations to compare what an x86 smart contract might look like compared to an EVM smart contract. Our findings indicate that x86 programs are around 10–20 percent smaller than their EVM equivalent and, in many cases, significantly more so. And this was done without the standard library concept that was discussed above. We are not worried about getting usable executable sizes from x86 programs.

Bitcoin Magazine: So the language compiler has to be modified to support the VM? What kinds of modifications?

Jordan Earls: Only minor modifications need to be made. The language compilers do support our x86 VM already, but the Qtum smart contract environment is different from a traditional operating system like Windows or Linux. So, basically, the only big modification we have to make is to tell the language how to communicate with our smart-contract operating system.

Bitcoin Magazine: Is QTUM going to provide language packages or libraries to support the VM so people can just use those?

Jordan Earls: C and C++ will be the first languages we support “out of the box” because they tend to be the easiest due to the way they are designed. We also plan to support Rust. Go should easily be possible. For interpreted languages like Python and Perl, it becomes more complex and we must do research to ensure that they can be supported in an efficient and secure manner.

Bitcoin Magazine: Is this going to impact the development of your eSML smart contract language?

Jordan Earls: We are continuing to research the eSML approach and will decide at a later point if it is still a requirement to achieve our goals. We prefer to not do more work if it won’t have a tangible benefit to our ecosystem.


Helping to support all this growth is the partnership announced on January 4, 2018, with Chinese video portal giant, Baofeng. With the help of Baofeng, the Qtum network will be boosted to 50,000 full network nodes, making it the most decentralized blockchain platform with the largest number of nodes with more than Bitcoin and Ethereum combined. The increased size of the Qtum system should provide for improved security, stability and speed, all of which will provide a solid base for the upcoming x86 VM later this year.

Earls projects that the x86 will be integrated into the Qtum main network in Q3 of 2018 but hopes to have a prototype to test with before Q2.


This article originally appeared on Bitcoin Magazine.

Get the latest Bitcoin News on The Bitcoin News
Our Social Networks:
Facebook Instagram Pinterest Reddit Telegram Twitter Youtube