QVM - Quantum Virtual Machine

QSN native virtual machine with built-in DeFi primitives, post-quantum cryptography, and native .q language. 75,000+ TPS, 94 opcodes, Solidity, FunC, and Tact support.

QVM Performance

75,000+
Sustained TPS
2-5s
Finality
94
Opcodes
50-60%
Gas Reduction

.q Language - Native Smart Contract Language

.q is the native QVM language with first-class DeFi support, automatic overflow protection, and built-in post-quantum cryptographic primitives

First-class DeFi support
Automatic overflow protection
Native AMM and lending functions
Post-quantum cryptography built-in
Zero-knowledge proof integration

Example: QRC20 Token in .q

contract MyToken : QRC20 {
  string public name = "My Token";
  string public symbol = "MTK";
  uint256 public totalSupply = 1000000;

  // Автоматическая защита от переполнения
  function transfer(address to, uint256 amount) public returns (bool) {
    require(balances[msg.sender] >= amount, "Insufficient balance");

    balances[msg.sender] -= amount;  // Safe math встроен
    balances[to] += amount;

    emit Transfer(msg.sender, to, amount);
    return true;
  }

  // Нативная поддержка постквантовых подписей
  function transferPQ(address to, uint256 amount, bytes pqSignature) public {
    require(PQ_VERIFY_DILITHIUM(msg.sender, pqSignature), "Invalid PQ signature");
    transfer(to, amount);
  }
}

Example: DEX Contract with Native Primitives

contract SimpleDEX {
  mapping(address => uint256) public liquidityETH;
  mapping(address => uint256) public liquidityToken;

  // Использование нативного опкода DEFI_SWAP (0xE0)
  function swap(address tokenIn, uint256 amountIn) public returns (uint256) {
    // AMM формула x*y=k встроена в опкод
    uint256 amountOut = DEFI_SWAP(tokenIn, amountIn);

    emit Swap(msg.sender, tokenIn, amountIn, amountOut);
    return amountOut;
  }

  // Использование ADD_LIQUIDITY (0xE1)
  function addLiquidity(uint256 amountETH, uint256 amountToken) public {
    uint256 lpTokens = ADD_LIQUIDITY(amountETH, amountToken);

    liquidityETH[msg.sender] += amountETH;
    liquidityToken[msg.sender] += amountToken;

    emit LiquidityAdded(msg.sender, lpTokens);
  }

  // Использование ORACLE_PRICE (0xE6) для получения цены
  function getPrice(address token) public view returns (uint256) {
    return ORACLE_PRICE(token);
  }

  // Flash loan с нативным опкодом FLASH_LOAN (0xE3)
  function flashLoan(uint256 amount) public {
    FLASH_LOAN(amount, address(this));
    // Логика flash loan
    // Автоматически проверяется возврат + 0.3% комиссии
  }
}

Programming Language Support

.q

NATIVE

Native QVM language with first-class DeFi and post-quantum crypto support

Standards:
QRC20QRC721QRC1155QRC4626

Solidity

COMPATIBLE

Full compatibility with Ethereum Solidity contracts. dApp migration without code changes.

  • Hardhat, Truffle, Remix
  • OpenZeppelin libraries
  • MetaMask integration

FunC

SUPPORTED

TON blockchain FunC language for high-performance contracts

Tact

SUPPORTED

Modern TON language with improved security and readability

Native DeFi Primitives

QVM has 8 built-in opcodes for DeFi operations (0xE0-0xE7), enabling DEX, liquidity pools, and lending protocols without external dependencies

0xE0 DEFI_SWAP
Native AMM token swap
5000 gas

Uses constant product formula (x*y=k) for trustless token swaps. Automatic price and slippage calculation.

0xE1 ADD_LIQUIDITY
Add liquidity to pool
10000 gas

Adds liquidity to pool with automatic share calculation and LP token minting. Impermanent loss protection.

0xE3 FLASH_LOAN
Uncollateralized flash loan
1000+ gas

Instant loans without collateral with automatic rollback on non-repayment. 0.3% fee built-in at protocol level.

0xE6 ORACLE_PRICE
Decentralized price oracle
1000 gas

Get real-time asset prices from decentralized oracle network. Manipulation protection with median values.

Additional DeFi Opcodes

0xE2 REMOVE_LIQUIDITY - Remove liquidity
0xE4 COMPOUND - Compound interest
0xE5 CALC_APY - Calculate APY
0xE7 SQRT - Square root for AMM

Post-Quantum Cryptography in QVM

12 built-in opcodes (0xC0-0xCB) for post-quantum signatures and encryption. NIST-standard Dilithium3, Falcon-512, SPHINCS+, Kyber1024.

Dilithium3

0xC0, 0xC1
NIST Standard

Sign/Verify
5000-10000 gas

Falcon-512

0xC2, 0xC3
Fast

Fast signatures
3000-6000 gas

SPHINCS+

0xC4, 0xC5
Max Security

Max security
50000-100000 gas

Kyber1024

0xC6, 0xC7
Encryption

KEM Encryption
2000-3000 gas

Zero-Knowledge Proofs

3 native opcodes (0xD0-0xD2) for zk-STARK proofs and Merkle tree verification

0xD0 ZK_PROVE

Generate zk-STARK proof for private transactions. Prove knowledge without revealing the secret.

50000+ gas
0xD1 ZK_VERIFY

Verify zk-STARK proof. Fast verification without access to original data.

100000+ gas
0xD2 MERKLE_VERIFY

Verify Merkle proof for efficient data inclusion verification.

500 gas

Cross-Chain Compatibility

The Only VM with 100% Ethereum AND Bitcoin Compatibility

QVM supports native opcodes for both major blockchains, enabling seamless integration through bridges

Ethereum

100% compatible
0x01 ECRECOVER

Recover address from ECDSA signature (secp256k1). Uses k256 cryptographic library for full Ethereum compatibility.

Use cases:
  • Ethereum signature verification
  • Ethereum ↔ QSN bridges
  • MetaMask integration
  • Cross-chain swaps with ERC20

Bitcoin

100% compatible
RIPEMD-160

RIPEMD-160 hash function used in Bitcoin for address creation. Implemented via ripemd library for full compatibility.

Use cases:
  • Bitcoin address generation
  • Bitcoin ↔ QSN bridges
  • Wrapped BTC tokens
  • Cross-chain BTC swaps

Dual Compatibility Benefits

  • Seamless bridges between Ethereum, Bitcoin, and QSN without trusted intermediaries
  • Native signature verification for both networks at VM level without external libraries
  • Ability to create DeFi protocols with liquidity from 3 major networks
  • Low fees for cross-chain transactions thanks to native support

All 94 QVM Opcodes

Complete Opcodes Reference

View all 94 QVM opcodes in terminal format: 71 EVM-compatible + 23 exclusive for DeFi, post-quantum crypto, and zero-knowledge

71
EVM Compatible
23
QVM Exclusive
8
DeFi Opcodes
12
Post-Quantum

QVM Token Standards

QRC20

Fungible token standard, ERC20-compatible. Extended functionality with post-quantum signatures.

QRC721

NFT standard for unique tokens. Metadata and royalty support.

QRC1155

Multi-token standard for games and collections. Batch operations for gas savings.

QRC4626

Tokenized vault standard for DeFi. Compatible with lending protocols.

Featured Opcodes

DEFI_SWAP5000 gas

Native AMM token swap using constant product formula (x*y=k). Zero external dependencies.

ADD_LIQUIDITY10000 gas

Add liquidity to decentralized pools with automatic LP token minting.

FLASH_LOAN1000+ gas

Uncollateralized flash loans with atomic rollback. 0.3% protocol fee.

PQ_SIGN_DILITHIUM5000 gas

Post-quantum digital signatures using NIST-approved Dilithium3 algorithm.

ZK_PROVE50000+ gas

Generate zero-knowledge proofs (zk-STARKs) for private transactions.

ORACLE_PRICE1000 gas

Get real-time asset prices from decentralized oracle network.

Start Building on QVM

Use .q language or Solidity to build DeFi applications with native primitives and post-quantum security