Skip to main content

Commitment Relayer

Computes Poseidon commitment hashes server-side for clients that cannot run the Poseidon hash function locally.

Endpoint

POST /api/commitment/compute

Port: 3002
Public URL: https://relayer.specterchain.com/api/commitment/compute

Request

{
"secret": "123456789",
"nullifierSecret": "987654321",
"blinding": "111222333",
"tokenIdHash": "0",
"amount": "1000000000000000000",
"policyId": "0",
"policyParamsHash": "0"
}
FieldTypeRequiredDescription
secretstringYesUser's private key (as decimal string)
nullifierSecretstringYesNullifier secret (as decimal string)
blindingstringYesRandom blinding factor (as decimal string)
tokenIdHashstringYesToken ID hash ("0" for native GHOST)
amountstringYesAmount in aghost (as decimal string)
policyIdstringNoPolicy contract address ("0" if none)
policyParamsHashstringNoPolicy params hash ("0" if none)

Response

{
"commitment": "0x1a2b3c4d..."
}

Authentication

Requires HMAC signature in the request header:

X-HMAC-Signature: <computed-hmac>

Rate limit

10 requests/minute/IP

Health check

GET /health

Security note

warning

The commitment relayer receives your secret and nullifierSecret in plaintext. If you're concerned about the relayer operator seeing these values, compute the Poseidon hash client-side using circomlibjs instead.

import { buildPoseidon } from 'circomlibjs';
const poseidon = await buildPoseidon();
const commitment = poseidon([secret, nullifierSecret, tokenIdHash, amount, blinding]);