Skip to main content

Java — raw HTTP

Call ZeqVM from Java

Java 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 stdlib java.net.http 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 — stdlib only

JDK 11+ java.net.http.HttpClient, no third-party dependencies. Compile-ready:

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

public class ZeqCompute {
public static void main(String[] args) throws Exception {
String body = """
{ "operators": ["KO42", "NM19"],
"domain": "Newtonian Mechanics",
"inputs": { "mass": 5, "acceleration": 9.81 } }""";

HttpRequest req = HttpRequest.newBuilder()
.uri(URI.create("https://zeqsdk.com/api/zeq/compute"))
.header("Authorization", "Bearer " + System.getenv("ZEQ_API_KEY"))
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();

HttpResponse<String> res = HttpClient.newHttpClient()
.send(req, HttpResponse.BodyHandlers.ofString());

// Full envelope: value, unit, uncertainty, signed, compliance, zeqProof, explorer_url …
System.out.println(res.body());
}
}

Parse with Jackson, Gson, or jakarta.json — the envelope is plain JSON. 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 Java here

  • Enterprise services. Drop the call into a Spring Boot service; the JDK's HttpClient brings connection pooling for free.
  • Banking and insurance. A compute envelope is a SOC 2 / SOX-ready audit row; the JVM ecosystem's audit-log wiring snaps in directly.
  • Android. The same wire calls run on Android; pair with the Web JS observer for a hybrid mobile app.

Compose with

  • Kotlin — same wire calls, coroutine-friendly.
  • Hosted API reference — every route, body, response, error.
  • HTTP / curl — the full wire-format walkthrough (solve, multibody, attest).

Source