Skip to main content

Rust — raw HTTP

Call ZeqVM from Rust

Rust reaches ZeqVM through three surfaces: the terminal CLI (/cli/), raw HTTP (the wire format below — what every client wraps), and zeq.py (Python — a single file, fetched from any node). The snippet below wraps exactly this wire format.

Get the CLI (recommended first install)

Every node serves the terminal CLI with a sha256-pinned installer — the fastest way onto the framework:

curl -fsSL https://zeqstate.com/install.sh | sh # any node works as the origin
zeq tutorial # guided: account → machine → first compute → verify

Full install notes + the complete command reference: /cli/.

Compute over raw HTTP

Rust's standard library has no HTTP client, so use any HTTP crate you already trust — the example below uses ureq (blocking, minimal). Compile-ready:

# Cargo.toml
[dependencies]
ureq = { version = "2", features = ["json"] }
serde_json = "1"
use serde_json::{json, Value};

fn main() -> Result<(), Box<dyn std::error::Error>> {
let key = std::env::var("ZEQ_API_KEY").expect("set ZEQ_API_KEY");

let res: Value = ureq::post("https://zeqsdk.com/api/zeq/compute")
.set("Authorization", &format!("Bearer {key}"))
.send_json(json!({
"operators": ["KO42", "NM19"],
"domain": "Newtonian Mechanics",
"inputs": { "mass": 5, "acceleration": 9.81 }
}))?
.into_json()?;

println!("{} {} ± {}", res["value"], res["unit"], res["uncertainty"]);
println!("zeqProof: {}", res["zeqProof"]);
println!("explorer: {}", res["explorer_url"]);
Ok(())
}

The public pulse needs no key: GET https://zeqsdk.com/api/zeq/pulse.

The response's compliance field is the ZeqCompliance v1 envelope — the 13-standard regulatory record returned on every call. Every result also carries signed — an Ed25519-signed claim (claim + signature + public_key) verifiable offline by anyone, or by POSTing the block to any node's public /api/attest. Or pipe the whole envelope to the CLI: … | zeq verify -.

Why Rust here

  • Embedded firmware. The wire contract is plain JSON over HTTPS, so the same calls work from constrained targets that sit alongside the Embedded C observer agent.
  • Aerospace flight software. Strict typed parsing (serde) of the envelope means parse failures surface at the boundary — DO-178C tool-qualification audits get the same trace boolean as every other path.
  • Server-side throughput. Swap ureq for an async client and one process handles thousands of in-flight compute calls.

Compose with

Source