Soda Labs
Soda Labs Docs
User InterfaceHttp proxy

Is nullified

A copy-paste example that checks whether a token value has been nullified through the HTTP proxy.

This example checks if a Y value has been nullified by calling the /is-nullified HTTP proxy endpoint.

Quick start

  • Requirements: Node 18+, a Y value (128-bit) to check, default chain 84532 (Base Sepolia). Override the proxy with BUBBLE_PROXY_URL if needed.

  • Install dependencies:

    npm install soda-bubble-sdk ethers ethereumjs-util

Example script (is_nullified.mjs)

const Y_VALUE = process.env.Y_VALUE; // bigint as decimal or hex (e.g. 0xabc...)
if (!Y_VALUE) throw new Error("Set Y_VALUE env var (hex or decimal)");

const CHAIN_ID = Number(process.env.CHAIN_ID || 84532);
const PROXY_URL = process.env.BUBBLE_PROXY_URL || "https://proxy2.bubble.sodalabs.net";

const parseY = (value) => {
  const asString = String(value);
  return asString.startsWith("0x") ? BigInt(asString) : BigInt(asString);
};

const yToBase64 = (y) => {
  const hex = y.toString(16).padStart(32, "0"); // 16 bytes -> 32 hex chars
  const bytes = Buffer.from(hex, "hex");
  if (bytes.length !== 16) throw new Error("Y value must be exactly 16 bytes (128-bit)");
  return bytes.toString("base64");
};

const main = async () => {
  const y = parseY(Y_VALUE);
  const yBase64 = yToBase64(y);

  const res = await fetch(`${PROXY_URL}/is-nullified`, {
    method: "POST",
    headers: { "Content-Type": "application/json" },
    body: JSON.stringify({
      y_value: yBase64,
      chain_id: CHAIN_ID,
    }),
  });

  if (!res.ok) throw new Error(await res.text());
  const data = await res.json();

  console.log("Response:", data);
  console.log("Nullified?:", data.response === true);
};

main().catch(err => {
  console.error("is-nullified failed:", err);
  process.exit(1);
});

Run it:

Y_VALUE=0xabc123... CHAIN_ID=84532 node is_nullified.mjs

The script encodes the Y value to 16 bytes (base64), POSTs to /is-nullified, and prints whether it is nullified along with the raw response.***

On this page