Deployment & Operations
Deploying the Contract
The Verifier contract must inherit VerifierBase and implement the IVerifier interface:
contract MyVerifier is VerifierBase {
address public immutable SPEC;
constructor(address specAddress) VerifierBase("MyVerifier", "1") {
require(specAddress != address(0), "spec cannot be zero");
SPEC = specAddress;
}
function spec() external view override returns (address) { return SPEC; }
function description() external pure override returns (string memory) { return "..."; }
}
Registering on the Platform
Owner → get_nonce(contract_address)
Owner signs "SyncTx: <nonce>" with private key
Owner → register_verifier(contract_address, signature, chain_id)
# Platform validation:
# 1. Recover signer from signature
# 2. Call owner() on-chain to confirm signer == contract owner
# 3. Read spec().name() / version() / description() on-chain
# 4. Write to database → return auth_token (bound to contract_address)
- Each contract address is registered independently; the same owner can register multiple Verifiers
- The token is used for authentication when the off-chain service communicates with the platform
Off-Chain Service
The off-chain service needs to handle two types of messages pushed by the platform:
request_sign — Quote Request
Triggered when a Trader requests a quote from the Verifier. Upon receipt, decide whether to accept and return an EIP-712 signature as a commitment:
The following is pseudocode, not actual implementation code.
def handle_request_sign(msg):
params = msg["params"]
deadline = msg["deadline"]
# Decision: whether to accept this verification task
if not should_accept(params):
return {"accepted": False}
# Price and generate EIP-712 signature
fee = calculate_fee(params)
sig = sign_eip712(verifier_address, params, fee, deadline)
return {"accepted": True, "fee": fee, "sig": sig}
notify_verify — Verification Notification
After a Trader initiates requestVerification on-chain, the platform notifies the Verifier to execute verification:
The following is pseudocode, not actual implementation code.
def handle_notify_verify(msg):
deal_contract = msg["dealContract"]
deal_index = msg["dealIndex"]
verification_index = msg["verificationIndex"]
# Read verification params from chain (never trust off-chain data)
params = contract.getVerificationParams(deal_index, verification_index)
# Execute verification off-chain
result, reason = verify(params["specParams"])
# Submit result on-chain
contract.reportResult(
deal_contract, deal_index, verification_index,
result, reason, params["fee"]
)
# result > 0 → Verification passed
# result < 0 → Verification failed
# result = 0 → Inconclusive, enters Settling