AlarmAll pages

Docs · Contracts

Alarm

Three bounties on small elliptic curves and one flag. Claiming a bounty means solving a discrete logarithm, and the contract checks the answer itself.

The idea

Nobody will announce that they can break elliptic curve keys. The Alarm gives them a reason to show it: ETH that can only be collected by revealing a private key nobody was ever given. Smaller curves need fewer qubits, so they fall before the 256-bit curve that protects wallets. That gap is the warning.

Tiers

TierCurveSizeRole by default
0secp160r1160-bitEarly warning
1secp192r1192-bitThreshold: a claim here trips the alarm
2secp224r1224-bitAbove the threshold, also trips

The threshold tier and the reveal delay are constructor arguments and cannot change after deployment. The deploy script defaults to tier 1 and 20 blocks.

fund(uint8 tier) payable

Adds ETH to a tier's bounty. Anyone can call it. Reverts if the tier is already broken or no value is sent.

Challenge points

Each tier publishes a point Q. A claimant must find k such that k·G = Q. For that to mean anything, nobody may know k in advance, so Q is derived from a public seed by hashing onto the curve:

notation
x = keccak256(seed ‖ uint8 tier ‖ uint32 counter) mod p
counter starts at 0 and increases until x³ + ax + b is a square mod p
y = the smaller of the two square roots

The constructor repeats this derivation. It checks that every skipped counter really missed the curve, that the point is on the curve and that the smaller root was chosen, and it reverts otherwise. The deployer cannot substitute a point with a known key.

Claiming a bounty

Claims are commit and reveal, so an answer cannot be copied out of the mempool.

commitClaim(bytes32 h)

Records the block at which the hash was committed.

solidity
// The claimer's own address is part of the hash
bytes32 h = keccak256(abi.encodePacked(uint256 k, address claimer, bytes32 salt));
revealClaim(uint8 tier, uint256 k, bytes32 salt)

Accepted once revealDelay blocks have passed since the commit. The contract computes k·G on the tier's curve and compares it with Q. On a match the tier is marked broken and the bounty is paid to the caller.

The delay is counted in Ethereum blocks, because that is what block.number returns inside a contract on Robinhood Chain. Twenty blocks is about four minutes. Do not time a reveal against eth_blockNumber, which counts Robinhood Chain's own much faster blocks.

The curve arithmetic runs in the EVM with the modexp precompile. A reveal on secp224r1 measured about 583k gas.

Tripping

The alarm trips the first time a tier at or above thresholdTier is broken. It records the block number and never resets.

guardianTrip()

Lets one address, set at deployment, trip the alarm early. It can be called once. The guardian cannot untrip, cannot move bounties and has no other function.

Why a guardian exists at all.

A real break may be demonstrated somewhere other than this contract. The guardian lets the system react to that. The cost of a wrong early trip is higher gas for Vault accounts, not lost funds.

Once tripped, the Registry refuses writes and anyone may flip accounts in the Vault validator.

Views

FunctionReturns
tripped()True once the alarm has tripped.
trippedAtBlock()The block it tripped at, or 0.
getTier(uint8)Q, the bounty, the hash counter and the broken state for one tier.
tiers()All three tiers.
tierInfo(uint8)The curve name and bit size.
claimHash(k, claimer, salt)The commit hash, for building a claim offchain.
seed()The seed the points were derived from.

Events and errors

solidity
event Funded(uint8 indexed tier, address indexed from, uint256 amount, uint256 newBounty);
event ClaimCommitted(bytes32 indexed commitHash, address indexed claimer, uint256 blockNumber);
event TierBroken(uint8 indexed tier, address indexed claimer, uint256 k, uint256 bounty, uint256 blockNumber);
event Tripped(uint256 blockNumber, uint8 tier, bool byGuardian);
ErrorWhen
RevealTooEarly(revealableAt)The reveal delay has not passed.
NoCommit()No matching commit for this k, caller and salt.
WrongKey()k·G is not the tier's point.
InvalidScalar()k is zero or not below the curve order.
TierAlreadyBroken()The tier was claimed already.
NotGuardian()guardianTrip from any other address.
AlreadyTripped()guardianTrip after a trip.