Quickstart
This guide takes you from zero to a verified confidential computation against the live Robinhood Chain mainnet deployment. You'll encrypt a typed value, commission it on-chain, and decrypt the threshold-signed result.
Install
# the TypeScript client
bun add @glasel/client viem
# or: npm install @glasel/client viemThe SDK runs anywhere — Node, Bun, Deno, or the browser. Encryption is pure
TypeScript (@noble/curves, @noble/hashes); the only network dependency is a
viem PublicClient.
1. Create a client
Point the client at a Robinhood Chain mainnet RPC and the protocol addresses.
Robinhood Chain isn't in viem/chains, so define it inline with defineChain.
The Coordinator, ClusterManager, and MXEFactory addresses are on the
deployments page.
import { GlaselClient } from "@glasel/client";
import { createPublicClient, http, defineChain } from "viem";
const robinhoodMainnet = defineChain({
id: 4663,
name: "Robinhood Chain",
nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 },
rpcUrls: { default: { http: ["https://rpc.mainnet.chain.robinhood.com"] } },
});
export const glasel = new GlaselClient({
publicClient: createPublicClient({ chain: robinhoodMainnet, transport: http() }),
addresses: {
coordinator: "0xf90C73ad8D700115afd8175eB2C1953C80d45157",
clusterManager: "0xcfC7f9dc4C311207B0Aa6DaF7DaDc63f6DbFA79b",
mxeFactory: "0x0Ee8170F29D0590B08D879Baa5e4AEc27Ae7d0eD",
},
});2. Encrypt typed inputs
Read the cluster's X25519 public key from chain, then seal a typed value to it.
The encInputs blob is what goes on-chain — it reveals nothing.
import { ORDER_SCHEMA, generateKeyPair, publicKeyFromPrivate } from "@glasel/client";
import { glasel } from "./client";
const me = generateKeyPair(); // your result-decryption keypair
const clusterKey = await glasel.getClusterPublicKeyForMXE(mxeId);
const { encInputs } = glasel.encrypt({
schema: ORDER_SCHEMA,
clusterKey,
value: { price: 1000n, quantity: 7n, side: true, buyerKey: publicKeyFromPrivate(me.privateKey) },
});3. Commission the computation
Commissioning is a normal contract call — your app (or a thin wrapper around the
Coordinator) submits encInputs against an MXE and a computation definition.
The returned computationId is read from the ComputationRequested event.
// `commission(...)` is your contract call to the Coordinator; it returns the
// computationId emitted in the ComputationRequested event.
const computationId = await commission(mxeId, compDefId, encInputs);An operator deploys a circuit to the ComputationRegistry (compDefId) and
creates an MXE binding it to a cluster (mxeId). See
Core concepts and Circuits.
4. Wait, then decrypt
The MPC network picks up the job, computes over the ciphertext, re-seals the result to your key, and threshold-signs it. The SDK polls until it lands, then decrypts locally.
const { success, encResult } = await glasel.watchComputation({ computationId });
if (!success) throw new Error("computation failed or was slashed");
const result = glasel.decryptResult({
encResult,
privateKey: me.privateKey,
schema: ORDER_SCHEMA,
});
console.log(result); // { price: 1000n, quantity: 7n, side: true, ... }That's the whole loop: encrypt → commission → compute → verify → decrypt.
Next steps
- SDK reference — every method on
GlaselClient. - Computation lifecycle — what happens on-chain at each step.
- Run a node — operate a GlaselOS node and join a cluster.