Skip to main content

GhostVault

The GhostVault is the main entry point for the Ghost Protocol. It orchestrates commits, reveals, and application callbacks.

Address: 0x9A8F98916d324153B61F1C4B6D7d85F52988b3b1

Functions

commit

Basic commit without application callback.

function commit(bytes32 commitment) external payable returns (uint256 leafIndex);
ParameterDescription
commitmentThe commitment hash
msg.valueMust be ≥ 0.001 ETH (MIN_COMMITMENT_FEE)

Returns: leafIndex - Position in the Merkle tree

commitWithCallback

Commit with application callback.

function commitWithCallback(
bytes32 commitment,
address application,
bytes calldata data
) external payable returns (uint256 leafIndex);
ParameterDescription
commitmentThe commitment hash
applicationIGhostApplication contract address
dataApplication-specific data
msg.valueMust be ≥ 0.001 ETH

Calls: application.onCommit(msg.sender, dataHash, data) before recording commitment.

verifyAndNullify

Basic reveal without application callback.

function verifyAndNullify(
Proof calldata proof,
bytes32 nullifier,
bytes32 root,
bytes32 dataHash,
address recipient
) external returns (bool valid);

revealWithCallback

Reveal with application callback.

function revealWithCallback(
Proof calldata proof,
bytes32 nullifier,
bytes32 root,
address application,
bytes calldata data,
address recipient
) external returns (bool valid);

Calls: application.onReveal(recipient, dataHash, data) after proof verification.

Events

event Committed(bytes32 indexed commitment, uint256 indexed leafIndex, uint256 timestamp);
event Revealed(bytes32 indexed nullifier, bytes32 indexed dataHash, address indexed recipient);

Proof Struct

struct Proof {
uint256[2] a; // G1 point
uint256[2][2] b; // G2 point
uint256[2] c; // G1 point
}

Constants

ConstantValueMeaning
MIN_COMMITMENT_FEE0.001 etherRequired commit fee

Next Steps