February 9, 2026

Virtual Machine Upgrade — QIP-7

Virtual Machine Upgrade — QIP-7

QIP-7 integrates the latest features from the Ethereum Virtual Machine, introducing a comprehensive set of improvements that modernizes the virtual machine within Qtum’s ecosystem. This update includes a wide range of improvements: cheaper cryptography builtins, new mathematical operators, gas cost optimizations for storage, as well as new ways to deploy and interact with smart contracts.

As a result of these updates, we expect that smart contract developers on the Qtum platform will be able to create new types of applications that enable better privacy, trust, security, and usability within our decentralized ecosystem.

In this update, several new instructions were added to the virtual machine to improve functionality and decrease gas costs. QIP-7 brings to Qtum the smart contract-relevant upgrades from Ethereum’s Byzantium and Constantinople updates, including the following EIPs: Byzantium: 140, 196, 197, 198, 211, 214, 658, and Constantinople: 145, 1014, 1052, 1283.

  • The bitwise shift operators SHL (shift left), SHR (logical shift right) and SAR (arithmetic shift right) are added for faster, more efficient low-level mathematical operations.
  • extcodehash is added to make it cheaper to verify whether an address has the expected smart contract code.
  • The revert instruction is added, to report error messages to users, and refund any unused gas.
  • staticcall instruction is added, to make it possible to call another contract in “read-only” mode.
  • Provide a way for smart contract methods to return multiple values.
  • create2 is added, so it’s possible to deploy a smart contract to a pre-determined address.

In particular, the addition of the create2 instruction opens up the fascinating possibilities of creating “counterfactual contract.” Previously, the address of a smart contract is partially determined by the nonce of its creator, therefore it is unpredictable. With create2, a developer can predetermine the address of a smart contract, without actually deploying the code. This is useful, because the details of some smart contract logic may now be hidden from the public until they are needed by the parties involved. It is like a fair arbitrator who will follow the instructions in a sealed envelope should disputes arise.

Counterfactual smart contracts enable generalized state channel to be implemented on Qtum, which could empower off-chain privacy solutions.

The Virtual Machine within Qtum is a general computation platform. While developers can implement any cryptographic algorithms directly in a smart contract, doing so is often too expensive for practical use. Cryptographic algorithms often require special optimizations to run efficiently.

This update introduces highly-optimized implementations of mathematical functions to drastically lower the gas costs for some interesting algorithms, making them practical for actual use cases.

Big Integer Arithmetic

The virtual machine is optimized for 256-bit integers, which are suitable for implementing modern elliptical curve cryptography algorithms. However, older cryptographic algorithms like RSA rely on different mathematical entities, which in turn require a much higher number of bits to achieve equivalent security. Modern guidelines for using RSA recommends 4028-bit public keys to be as safe as 256-bit ECC public keys.

To support these algorithms, this update introduces efficient and cheaper ways to do the math on numbers larger than 256 bits. This is accomplished by adding precompiled contracts that support the following operations (as well as their associated gas costs):

GADDSUBBASE: 15
GMULDIVBASE: 30
GMODEXPBASE: 45
GARITHWORD: 6
GQUADDIVISOR: 32

ZK-SNARKs Support

Zero-Knowledge proof systems open up exciting new possibilities for enabling privacy applications on the Qtum blockchain. However, these systems depend on a different type of elliptical curve than the native elliptical curve used by Qtum.

This update adds support for the alt_bn128 curve, which many zk-SNARKs systems rely on. In particular, this is the same curve chosen by the ZCash cryptocurrency.

Storage Gas Cost Optimization

Storing data on the blockchain is expensive since each stored item is stored by every node of the network, and forever! However, the way the storage instruction sstore is implemented is actually optimized to make some cases cheaper, but the system charges the same amount of gas anyway. This update decreases the gas cost for special cases where sstore could be optimized.

Consider the following series of instructions in a smart contract call, setting the position 0x0 to different numbers:

sstore 0x00 0x1
sstore 0x00 0x2
sstore 0x00 0x3

In this sequence, only the final sstore matters in terms of cost, because that’s the number being written onto the blockchain. Previously all these are expensive in gas costs. With the new update, only the last one is expensive, and preceding instructions made as cheap as possible.

Published at Thu, 26 Sep 2019 12:53:32 +0000

{flickr|100|campaign}

Previous Article

SETL launches sandbox for its blockchain settlement infrastructure

Next Article

Coinbase Brings Stellar Lumens (XLM) to New York State Customers

You might be interested in …