Skip to main content

Ruby — raw HTTP

Call ZeqVM from Ruby

Ruby 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 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

Ruby 3.x Net::HTTP + JSON, no external runtime dependencies. Runs as-is:

require "net/http"
require "json"
require "uri"

uri = URI("https://zeqsdk.com/api/zeq/compute")
req = Net::HTTP::Post.new(
uri,
"Content-Type" => "application/json",
"Authorization" => "Bearer #{ENV.fetch("ZEQ_API_KEY")}"
)
req.body = {
operators: %w[KO42 NM19],
domain: "Newtonian Mechanics",
inputs: { mass: 5, acceleration: 9.81 }
}.to_json

res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(req)
end

out = JSON.parse(res.body)
puts "#{out["value"]} #{out["unit"]} ± #{out["uncertainty"]}"
puts "zeqProof: #{out["zeqProof"]}"
puts "explorer: #{out["explorer_url"]}"

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 Ruby here

  • Rails apps. Wrap the call in a Rails service object; the entangled-state row that comes back is a tamper-evident record next to your ActiveRecord rows.
  • DevOps tooling. Single-file Ruby scripts that hit /api/zeq/compute from a Capistrano task, a Sidekiq worker, or a CI job — same envelope, same receipts.
  • Educational notebooks. IRB + Pry feels at home with the framework's interactive proof model.

Compose with

  • Hosted API reference — every route, body, response, error.
  • HTTP / curl — the full wire-format walkthrough (solve, multibody, attest).
  • Python — same wire envelope; mix and match in a polyglot data pipeline.

Source