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"
}
| Field | Type | Required | Description |
|---|---|---|---|
secret | string | Yes | User's private key (as decimal string) |
nullifierSecret | string | Yes | Nullifier secret (as decimal string) |
blinding | string | Yes | Random blinding factor (as decimal string) |
tokenIdHash | string | Yes | Token ID hash ("0" for native GHOST) |
amount | string | Yes | Amount in aghost (as decimal string) |
policyId | string | No | Policy contract address ("0" if none) |
policyParamsHash | string | No | Policy 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]);