House rounds and the launch model
ZK-Sniper is not deployed on any network and has had no external audit. This page describes the launch model the code supports. It is not a promise that a deployment will exist, that any particular address will be approved, or that House rounds are safe to play.
The short version
The chain cannot tell a hider's second address from a real sniper. A hider who controls a second address can fire from it, and the contract treats that shot like anybody else's. That is an accepted property of a game with no identity (see the hider shooting their own round), but it means a sniper in a round run by a stranger is exposed to the stranger.
So the contract has a creation gate, and the intended launch is House-only: only addresses the platform has approved can host rounds. A round hosted by an approved address is a House round. A round hosted by any other address (possible only if the owner opens creation) is a community round, and carries lower trust.
The gate changes who the hider is. It does not make the game fair, and it does not remove the known limitations.
How the gate works
| Item | Value |
|---|---|
| State | bool public openCreation, mapping(address => bool) public approvedHider |
| Rule | createRound reverts with HiderNotApproved(hider) unless openCreation is true or approvedHider[msg.sender] is true |
| Owner functions | setOpenCreation(bool), setApprovedHider(address, bool) (the second reverts ZeroAddress for the zero address). Both are onlyOwner and work while the contract is paused |
| Events | OpenCreationSet(bool open) (also emitted by the constructor), ApprovedHiderSet(address indexed hider, bool approved) |
| Constructor | Takes the initial openCreation_ as its last argument |
| Order of checks | The pause check comes first (EnforcedPause), then the gate, then the commitment, fee-bound and collateral checks |
The gate is entry-only, like pause. It is read by createRound and by nothing else.
fireShot, answerShot, claimTimeout, initiateExtraction, claimEscape, sponsorRound,
withdraw and withdrawTo never look at it, so closing the gate, opening it, or removing an
approval cannot change a running round: not its clocks, not its shots, not its pool. A hider
whose approval is removed can still answer, extract and escape.
The gate decides who may open a round, nothing more. It gives the owner no path to any pool or
credit, and a hider cannot approve itself (setApprovedHider is owner-only).
Deployment configuration
The deploy configuration for the game is the optional games.zkSniper block of
contracts/config/<chainId>.json:
| Key | Meaning | Default |
|---|---|---|
openCreation | Initial value of the gate | true on chains 31337 (local) and 97 (BSC testnet). Required, with no default, on every other chain including 56 (BSC mainnet): a games.zkSniper block without it fails to parse, and a deployment with no block at all is refused, so the choice between House-only and open rounds is never made implicitly |
approvedHiders | List of addresses to approve (no zero address, no duplicates) | empty. The deployer applies them with setApprovedHider before starting the ownership hand-over, because the deployer is the owner until the new owner accepts. Afterwards the new owner manages the list |
openCreation = false with an empty list is allowed (the owner can approve the House address after
the hand-over) but the script warns, because nobody can create a round until then. A non-empty list
with openCreation = true has no effect while creation is open (the list is still recorded and
applied). The deployment record in contracts/deployments/<chainId>.json stores the values as
games.zkSniperOpenCreation and games.zkSniperApprovedHiders.
The other keys (treasury, minBaseFee, maxBaseFee, answerWindowBlocks,
extractionWindowBlocks) are described in the contract reference.
What the app shows
The web app reads openCreation() and approvedHider(hider) and labels each round House round
or Community round (lower trust). In House-only mode the create-round page explains that
creation is restricted and disables the button for a wallet that is not approved. This is a label
and a courtesy: the contract is what enforces the gate, and a label that cannot be read shows
nothing rather than a guess.
What a House round does and does not give you
| Does | Removes the case where the hider is an anonymous stranger who can fire at its own round from a second address. The hider is an address the platform approved |
| Does | Keeps every proof, deadline, payout and exit rule the same. A House round is the same contract with the same ZK answers |
| Does not | Prove anything on chain about who owns the shooter addresses. fireShot only blocks msg.sender == hider. A House hider could still shoot its own round from another address, and nothing on chain would show it. "The House does not shoot its own rounds" is a policy, not a property the contract enforces |
| Does not | Remove the burst sweep, the first claimer picks the winner race, or the fact that a hider whose answerer is down for a whole answer window loses by timeout |
| Does | Gives rounds hosted by the House's own address an automatic answerer: the House's responders (below). Such a round never depends on a person being at a screen |
| Does not | Make the House responder trustworthy by itself. It holds every hit square of every round it serves, so one compromised operator exposes every live round (the responder) |
House rounds are exposed to the sweep
A sniper bot does not need to know the hidden square. It can fire every unshot square and so always
holds the winning shot. For a fresh round the profit is pool(0) - 10% of the final pool, which is
+0.0289 BNB on a base fee of 0.01 BNB (collateral 0.64 BNB), a return of 0.5% on about 5.47 BNB
of capital, before gas. That margin is thin, and the same percentage applies at every base fee;
only the size changes. The hider side of a swept round loses its whole collateral (0.64 BNB). Of
the 6.1112 BNB final pool, 0.6111 BNB goes to the treasury as rake and 5.5001 BNB to the bot. If
the treasury address is also the House's, the House's net loss per swept round equals the bot's
profit, about 0.045 x C (0.0289 BNB); if it is a different party, the hider side bears the full
collateral. Either way, organic players never get to play if a bot does this to every House round
as it appears. The numbers and the limits are on the
economics page. A lower base
fee shrinks the loss per round; it does not change the bot's return.
This is a cost the House carries, and it is a reason to read House launch guidance as conservative, not as a sign that House rounds are a safe place to put money.
What the rake pays the treasury
Every settlement sends 10% to the treasury address: 10% of the whole pool when a round ends by a
hit or a timeout, and 10% of the fees and sponsorships (never the collateral) when the hider
escapes. The rate is a compile-time constant of the contract, so it cannot be changed after
deployment, and the treasury is whatever address the owner configured (the default is the team fee
recipient, and setTreasury can move it). Per resolved round the rake is larger than at the
earlier 5% setting; this page makes no estimate of how many rounds will resolve or how, and the
size of a round (its base fee) sets the size of the rake.
How House rounds are answered
A round hosted by the House's own hider address is answered by the House's responders, always. The 64 proofs are built by the House (natively, about 5 seconds for all 64 on the development machine, so there is no browser step), and they are held by the responders from the block in which the round is created. Two instances run redundantly: the primary answers at once, and a backup instance on separate infrastructure waits a short, configurable delay (1.5 s by default) and skips squares already answered. The latency target is the same as for any round (Answer times): typically 1 to 3 seconds, nothing over 10 seconds in the test, and the answer window of 267 blocks (about 2 minutes) as the failure backstop. The outage risk, and who bears it (here, the House), is under the responder and economics.
Rounds whose hider is one of the House's own addresses (the responder's SNIPER_HOUSE_HIDERS list, by
default the House hider service's address) are exempt from the responder's cost rules that
protect it from strangers (the check that the base fee covers the gas, the per-hider and global
budgets). Another approved address that creates a round through the app is subject to the normal rules
and the normal choice of answerer. A refused answer in the House's
own round would simply be a House loss, and the default House base fee of 0.001 BNB would be refused
by the community rule. Only "the responder wallet is empty" can still stop an answer.
The House hider service
Creating House rounds needs something to hold the House's hider key, pick squares, build proofs and
create rounds. The relayer has an optional House hider service for this. It is off unless
SNIPER_HOUSE_ENABLED=true, uses a dedicated key (SNIPER_HOUSE_HIDER_PRIVATE_KEY, an address the
owner has set approvedHider, never the responder key or the relayer key), and keeps a small number
of rounds live (3 by default) within a collateral cap (0.5 BNB by default). For each round it draws a
random square and salt, builds all 64 proofs natively before sending createRound, and arms them in
the same block the round appears. After a configurable idle time it calls initiateExtraction and
claimEscape. It never fires shots (a policy the contract cannot enforce).
It is new surface with real risk. The key is hot and can create rounds with up to the collateral cap;
the secret (x, y, salt) of every live round sits on its disk (mode 0600, never logged or served) so
proofs can be rebuilt; compromise means loss of live collateral and exposure of live squares. Keep it
a separate key and wallet with a small cap. Whether a deployment runs it is the operator's choice, and
this repository does not decide it.
Launch guidance (not enforced by the contract)
The design review of this game recommended the following for a House launch. None of it is a contract rule; it is operating practice that would have to be followed and checked:
- a small base fee, 0.002 BNB or less, so that one swept round costs the House little;
- two independent responders on separate infrastructure, keys and RPC providers, with alerts on the health endpoint, so one outage or one compromise does not time out every round (this is now how the responder is built to run; see the outage risk in security);
- a cap on the House's aggregate collateral across live rounds (the House hider service has one).
The review also recommended an answer window above the contract minimum, 7,200 blocks (about 54 minutes). That was made for a game in which the hider answered by hand and no longer applies: answers are automatic and the 267-block default (about 2 minutes) is a failure backstop. The window is an owner setting for new rounds; the House can lengthen it for more margin while the redundancy is unproven, at the price of a sniper's money waiting longer in a failure, but a longer window is not a substitute for the redundancy.
Opening to community rounds later
The owner can call setOpenCreation(true) at any time. Anyone can then host a round, and every
such round is a community round:
- The hider may be shooting at its own round from a second address. The two ways to do it, and what
they cost, are in the second-wallet section.
Both cost the hider about 10% of the collateral (
0.1 x (C + F), 0.065 BNB at C = 0.64 BNB and a 0.01 BNB fee) plus gas. - No on-chain rule that ignores identity can close this. Paying the earliest expired shot, the latest, a split, or waiting for every shot to expire can each be beaten by a hider who places shots before or after the real one. Fixing it needs to know who the hider is.
- The one design reviewed that makes the timeout variant unprofitable is a hider bond that is
burned (sent to a dead address, never to the treasury) together with a timeout prize of the
collateral only and refunded fees. It is deferred, not built. It would need a bond of
roughly 1.5 to 2 times the collateral (at a bond equal to the collateral the cheat still costs
only 0.065 BNB), a change of the timeout rule, about 150 lines, a new accounting invariant and
relayer changes. (These sizes come from the design review, which was done at the earlier 5% rake and has not been redone for 10%.) It would not close the self-hit exit, which stays at the same
0.1 x (C + F), because a bond is refunded on a hit. So community rounds would still be a lower-trust tier even with it. The review rejected a variant that pays the treasury when a hider fails, because that gives the operator an incentive to let hiders fail.
The honest reading: House-only is a way to start with a hider the platform vouches for. It is not a claim that the problem is solved. When creation is opened, the app labels those rounds so a sniper can see which kind it is joining.
Not built
- There is no seeded or verifiable square derivation (a published seed hash revealed after an epoch, say). A House hider chooses its squares like anyone else, from a random source.
- There is no on-chain way to check that a House responder wallet does not shoot.
- There is no automatic circuit breaker that pauses shots when the responders fail.
Related
- Security model and known limitations
- Economics and fairness
- Contract reference: admin powers
- Threat model: section 3.6 of
docs/THREAT_MODEL.mdin the repository