$GAUSSCA at launchStatus: concept

Developers

gaussia-match

TypeScript: node assignment, commit-reveal blind matching and third-node tiebreak.

github.com/gaussialabs/gaussia-matchTypeScriptApache-2.0v0.4.0

Every Gaussia job runs on two nodes, and a result only counts when both agree. A node first commits a hash of its result and reveals it only after the other node has committed, so neither can copy the other. gaussia-match is that commit-reveal step, in TypeScript, with the same encoding a Solidity contract would use.

  • Result commitments: keccak256(abi.encode(jobId, resultHash, wallet, salt)), bound to the node’s wallet, with a 32-byte random salt.
  • Reveal check: verifyReveal tells you if a reveal opens a commitment.
  • Canonical result hash: sorted keys, every number rounded half-even to 6 decimal places, sha256. Two honest runs whose floats differ only in the last bits hash the same.
  • Job state machine: two assigned nodes, both commit before either can reveal, commit and reveal deadlines, no-show replacement before anything is revealed, then verified or a third-node tiebreak.
  • Third-node tiebreak: on a mismatch a third node runs the job; its result decides by 2-of-3 majority and the node in the minority is flagged as the outlier. Three different hashes end as no_majority: nobody is paid, nobody is flagged.
  • Deterministic assignment: keccak256(abi.encode(seed, jobId, wallet)) per wallet, lowest scores win, duplicate wallets counted once. Anyone can recompute who should have got a job.
  • CLI: gaussia-match commit | verify | result-hash | assign, offline, --json everywhere.

Install

sh
git clone https://github.com/gaussialabs/gaussia-match && cd gaussia-match
pnpm install                      # also builds dist/
alias gaussia-match="node $PWD/dist/cli.js"

The library is ESM and CJS with types, and has no Node built-ins (salts use Web Crypto), so it also runs in browsers and edge runtimes. The CLI needs Node 20+.

CLI

1. Hash a result

console
$ gaussia-match result-hash examples/result.node-a.json

The repo’s examples/ holds two illustrative results for the same job, written in a different key order and with float noise in the last digits. Both produce the same result_hash. The result fields in those examples are made up: the real result format belongs to the node software.

2. Commit to it

console
$ gaussia-match commit --job-label planet-hunt/example-0001 \
    --result examples/result.node-a.json \
    --wallet 0x1111111111111111111111111111111111111111

Without --salt, a fresh salt comes from the system CSPRNG. Keep it secret and keep it: you need it to reveal.

3. Check a reveal

console
$ gaussia-match verify --commit 0x<commit> \
    --job-label planet-hunt/example-0001 --result examples/result.node-a.json \
    --wallet 0x1111111111111111111111111111111111111111 --salt 0x<salt>
PASS  the reveal opens commitment 0x<commit>

Change any field (another wallet, another salt, another result) and it prints FAIL and exits 1.

4. Who runs a job?

console
$ gaussia-match assign --seed 0x<seed> \
    --job-label planet-hunt/example-0001 --nodes examples/nodes.json

Prints every eligible wallet ranked by score and marks the two selected. If those two disagree, the tiebreak node is the next one in the ranking: run it again with --count 1 --exclude <A> --exclude <B>. The seed would in practice be, for example, a block hash.

Exit codeMeaning
0ok, or the check passed
1a check failed
2usage or input error

Library

ts
import { makeCommit, verifyReveal, resultHash, idFromLabel } from "gaussia-match";

const jobId = idFromLabel("planet-hunt/example-0001");
const hash = resultHash(result);                            // 64 hex chars
const c = makeCommit({ jobId, resultHash: hash, wallet });  // { commit, salt, ... }
// publish c.commit, keep c.salt
verifyReveal(c.commit, { jobId, resultHash: hash, wallet, salt: c.salt }); // true

Drive one job through commit and reveal (times come from whatever clock you use, here seconds):

ts
import { MatchJob } from "gaussia-match";

const job = new MatchJob({ jobId, nodes: [walletA, walletB], start: 0, commitWindow: 600, revealWindow: 300 });
job.commit(walletA, commitA, 10);
job.reveal(walletA, { resultHash, salt }, 20); // throws MatchError "early_reveal": B has not committed
job.commit(walletB, commitB, 30);              // reveals open, deadline 330
job.reveal(walletA, revealA, 40);
job.reveal(walletB, revealB, 50);
job.outcome(); // { status: "verified", resultHash, agreed: [walletA, walletB], noShows: [] }

// if the pair disagrees:
job.status;                      // "needs_tiebreak"
job.assignTiebreak(walletC, 60);
job.commit(walletC, commitC, 70);
job.reveal(walletC, revealC, 80);
job.outcome(); // { status: "verified", agreed: [walletA, walletC], outliers: [walletB], ... }

Spec

SPEC.md (draft v0) defines every hash and rule so it can be recomputed without this code: canonical JSON, result commitment, job state machine, third-node tiebreak, node assignment and the event log.

Canonical JSON v0

  • Objects: keys sorted ascending by UTF-16 code units, as in RFC 8785. No whitespace.
  • Strings: escaped as ECMAScript JSON.stringify does.
  • Numbers: rounded to 6 decimal places, half to even, then written with the fewest digits (no exponent, no trailing zeros, -0 is 0).
  • result_hash = sha256(utf8(canonical)), 64 lowercase hex characters.

Result commitment

solidity
bytes32 commit = keccak256(abi.encode(jobId, resultHash, wallet, salt));

Binding the wallet means a node that copies another node’s commitment cannot reveal it as its own. The salt stops a node from hashing likely results and testing them against the other node’s commitment.

Honest limits

  • It is a library and a CLI. It does not run a network, a job queue or a contract. At launch the Gaussia team runs the job coordinator, which uses this code.
  • Assignment is only as fair as its seed. At launch the coordinator picks the seed and runs the selection; anyone can recheck it from the published seed and node list.
  • In a tiebreak the pair has already revealed. The operator must keep those two hashes from the third node until it commits.
  • Sealed review votes and the candidate seal hash are not part of gaussia-match yet (planned).
  • The on-chain verifier contract is planned, not deployed. The encoding is plain abi.encode so it can verify these commitments without changes.
  • Rounding to 6 decimal places absorbs most float noise, not all: two values on either side of a rounding boundary still hash differently.
  • Specs are draft v0 and may change before v1.