Guides

How to deploy a quantum program on a blockchain

Quip Network
·4 min read

On Quip Network's public test network, you deploy a quantum program by writing it as an Ising model, the problem format used by quantum annealers, and posting it as a job with a reward attached. Miners on CPUs, GPUs and quantum annealers compete to solve it, and the chain recomputes the energy of every answer before it pays anyone, as the submit-a-job guide describes.

Three meanings of "quantum program on a blockchain"

Approach Work done by the quantum hardware Role of the chain Status
Proof of quantum work (D-Wave, arXiv 2503.14462) Generates and validates the hashes used for mining Records blocks mined with quantum hashing Research prototype on four D-Wave annealers in Canada and the United States
Job mempool (Quip docs) Solves the optimization problem you post Holds your reward in escrow, checks each answer, pays the winners Running on the aglais test network, with D-Wave Advantage2 access through Leap (CoinDesk)
Algorithm contracts (Quip participants docs) Solves the job specifications written into each contract Algorithm developers will deploy smart contracts and charge a fee in any currency for each execution Planned

In the first approach, D-Wave's annealers do the mining, and there is no step for submitting your own problem. The steps below follow the second approach, since developers can post jobs to it now.

Step 1: write the problem as an Ising model

An Ising model is a graph. Every node gets a spin of minus one or plus one and can carry a bias, a number pulling the spin toward one of those values. Every edge carries a coupling, a number rewarding the two connected spins for agreeing or for disagreeing. Miners search for the assignment with the lowest total energy, so you choose biases and couplings to give a good outcome a low energy.

You can also write a binary model, with variables of 0 or 1, and the tools convert it to spins. According to the XQuad toolchain docs, traveling salesman, graph coloring, knapsack and portfolio problems all reduce to this form.

Coefficients travel as whole numbers in thousandths, so every machine computes the same energy for a given answer. The client rounds a value finer than a thousandth to the nearest thousandth and warns you. It refuses, before submitting, a value too large to fit, which for a spin model means more than 2,147,483 in magnitude.

Step 2: solve it on your own machine first

Install the tools with pip install "xquad[quip]", on Python 3.13 or newer. Prebuilt wheels exist for Linux only. On macOS, install a Rust toolchain first so pip can build two packages from source. On Windows, run everything inside WSL2.

The docs example builds a model with four binary variables, a bias of minus one on variable 0, and a coupling of 2 between variables 0 and 1. It then solves the model with the local CPU annealer, at no cost:

from xqffi.vm import XqmxModel
from xqsa import SolverCPU

model = XqmxModel.binary(4)
model.set_linear(0, -1)
model.set_quad(0, 1, 2)

result = SolverCPU().solve(model)
print(result.sample.values, result.energy)

You can check the answer by hand. The cost of this model is -x0 + 2*x0*x1. With x0 at 1 and x1 at 0, the cost is minus 1. The other three combinations of those two variables give 0, 0 and 1, so minus 1 is the lowest energy. Variables 2 and 3 carry no terms and can take either value.

Step 3: post it to the chain

To send the same model to the network, swap in the network solver:

from xqsa.quip import SolverQuip

solver = SolverQuip.for_network("aglais", keystore="~/.quip/keystore.json")
print(solver.create_order(model).quote())
result = solver.solve(model)

The quote() call asks the chain for the price and submits nothing. A job costs the chain's minimum reward of 1 AGLS plus a transaction fee, which grows with the size of the model. Test AGLS are free: if your balance is short, solve() draws 10 AGLS from the faucet before it submits. The keystore file is created on first use without a password, so keep it private.

What the chain does with the job

  1. It reserves your reward from your account and holds it in escrow.
  2. Miners pick up the open job. By default any registered solver can answer, or you can limit the job to named miners or hardware types.
  3. The chain checks every answer against your problem. It recomputes the energy from your coefficients and enforces any limits you set on answer count, energy and diversity.
  4. When the first valid answer arrives, the chain opens a competition window for other miners. The job closes when that window ends or at the hard deadline, whichever comes first.
  5. The chain pays the reward under the rule you chose: the single best answer by default, the top answers ranked by energy, or the top answers in equal shares.

If no miner answers, solve() tries to reclaim the reward and raises QuipJobFailedError. The transaction fee is not refunded.

Limits to plan around

  • By default the solver places your variables onto the chain's registered hardware graph. Dense models can fail placement, and in that case the solver raises PlacementError before it spends anything.
  • Native mode accepts any graph up to 5,000 nodes and 50,000 edges. A miner backed by a quantum processor cannot embed an arbitrary graph, so it cannot solve a native job.
  • The chain interfaces are pre-release, and the docs warn that chain metadata and economic parameters can change between releases.

Ising Topologies explains placement in more detail. QUBO solver marketplaces compared puts this job model next to buying solves from a single vendor.

Next step

Follow Submit your first compute job to install the tools, fund a test account and post the example model to aglais.

Share
Filed underGuides
Newsletter

Don't miss an update

Get new posts and project updates delivered to your inbox. No spam, unsubscribe anytime.