Skip to main content

CommitRevealVault

The central orchestrator for all Ghost Protocol operations. All commits and reveals flow through this contract.

Address: 0x443434113980Ab9d5Eef0Ace7d1A29AB68Af6c70

Interface

interface ICommitRevealVault {
// Commit native GHOST
function commitNative(bytes32 commitment, bytes32 quantumCommitment) external payable;

// Commit ERC20 tokens
function commit(address token, uint256 amount, bytes32 commitment, bytes32 quantumCommitment) external;

// Commit with policy
function commitNativeWithPolicy(
bytes32 commitment, bytes32 quantumCommitment,
address policy, bytes32 policyParamsHash
) external payable;

function commitWithPolicy(
address token, uint256 amount, bytes32 commitment,
bytes32 quantumCommitment, address policy, bytes32 policyParamsHash
) external;

// Reveal tokens
function reveal(
address token, uint256[8] calldata proof,
uint256[] calldata publicInputs, bytes32 commitment,
bytes calldata quantumProof, bytes32 changeQuantumCommitment,
bytes calldata policyParams
) external;

// View functions
function commitmentTree() external view returns (address);
function nullifierRegistry() external view returns (address);
function proofVerifier() external view returns (address);
function assetGuard() external view returns (address);
function nativeHandler() external view returns (address);
function paused() external view returns (bool);
function totalCommitted(address token) external view returns (uint256);
function tokenIdHashes(address token) external view returns (bytes32);
function commitmentPolicies(bytes32 commitment) external view returns (address);

// Events
event Committed(bytes32 indexed commitment, address indexed token, uint256 amount);
event Revealed(bytes32 indexed commitment, address indexed token, uint256 amount, address recipient);
event CommittedWithPolicy(bytes32 indexed commitment, address indexed token, uint256 amount, address policy);
}

Constants

ConstantValueDescription
DEFAULT_COMMIT_COOLDOWN5 secondsMinimum time between commits from same address
PUBLIC_INPUT_COUNT8Number of public inputs for the ZK circuit

Usage examples

Query total committed

cast call 0x443434113980Ab9d5Eef0Ace7d1A29AB68Af6c70 \
"totalCommitted(address)(uint256)" 0x0000000000000000000000000000000000000000 \
--rpc-url https://testnet.specterchain.com

Check if vault is paused

cast call 0x443434113980Ab9d5Eef0Ace7d1A29AB68Af6c70 \
"paused()(bool)" \
--rpc-url https://testnet.specterchain.com

Get token ID hash

cast call 0x443434113980Ab9d5Eef0Ace7d1A29AB68Af6c70 \
"tokenIdHashes(address)(bytes32)" $TOKEN_ADDRESS \
--rpc-url https://testnet.specterchain.com

Security model

  • ReentrancyGuard — all state-changing functions are non-reentrant
  • Ownable — admin functions restricted to owner (deployer)
  • Pausable — owner can pause all operations in emergencies
  • AssetGuard — only whitelisted tokens can be committed/revealed
  • Rate limiting — cooldown between commits from the same address