Skip to main content

Quickstart

Get your development environment set up and make your first commitment in 5 minutes.

Prerequisites

  • Node.js 18+
  • Foundry (for contract interaction)
  • A wallet with testnet GHOST

1. Configure Your Wallet

Add Umbraline Testnet to MetaMask:

SettingValue
Network NameUmbraline Testnet
RPC URLhttps://testnet-rpc.umbraline.com
Chain ID47474
SymbolGHOST
Explorerhttps://umbrascan.com

Or use the Add Network button on the Wallet Setup page.

2. Get Testnet GHOST

Visit portal.ghostcoin.com/faucet to receive 100 GHOST.

3. Install Dependencies

npm install circomlibjs ethers

4. Generate Secrets & Commitment

import { buildPoseidon } from 'circomlibjs';

const FIELD_SIZE = 21888242871839275222246405745257275088548364400416034343698204186575808495617n;

async function generateCommitment(dataHash) {
const poseidon = await buildPoseidon();

// Generate random secrets
const randomField = () => {
const bytes = crypto.getRandomValues(new Uint8Array(32));
return BigInt('0x' + Buffer.from(bytes).toString('hex')) % FIELD_SIZE;
};

const secret = randomField();
const nullifierSecret = randomField();
const blinding = randomField();

// Compute commitment
const F = poseidon.F;
const left = poseidon([secret, nullifierSecret]);
const right = poseidon([dataHash, blinding]);
const commitment = poseidon([F.toObject(left), F.toObject(right)]);

return {
secret,
nullifierSecret,
blinding,
commitment: '0x' + F.toObject(commitment).toString(16).padStart(64, '0'),
};
}

5. Make a Commitment

# Using cast (Foundry)
cast send 0x9A8F98916d324153B61F1C4B6D7d85F52988b3b1 \
"commit(bytes32)" <your-commitment> \
--value 0.001ether \
--private-key <your-key> \
--rpc-url https://testnet-rpc.umbraline.com \
--legacy

6. Verify Commitment

# Check leaf count increased
cast call 0xe382a7C7a5CE3B9250D73aE6ab97931E5798e6F7 "leafCount()(uint256)" \
--rpc-url https://testnet-rpc.umbraline.com

Next Steps

Save Your Secrets

Store secret, nullifierSecret, and blinding securely. If you lose them before revealing, your commitment is permanently unrecoverable.