Datasync

Documentation

Datasync v1 · contracts written, nothing deployed, 147 tests

The one thing to take away No model runs here, and nothing on chain can execute one. The contract holds commitments, stakes, posted scores and a slash. Evaluation happens off chain, by people, on data that was a hash until the moment scoring opened. The chain's only job is to make lying about the result expensive enough that it mostly does not happen.

1 — The phases of an epoch

An epoch is one task. It has six states and a submission inside it has eight. Every transition below is driven by a call anyone can make; there is no owner, no keeper and no privileged address anywhere in Datasync.sol.

Open

openEpoch(taskCommit, challengeCommit, submitEnd, scoreEnd). Both commitments are hashes and nothing else. In particular the challenge set — the held-out input/output pairs every submission will be scored against — exists on chain only as challengeCommit. Nobody can fit to data they cannot see.

submitEnd must be at least MIN_SUBMIT_WINDOW away and scoreEnd at least MIN_SCORE_WINDOW after that, so an epoch cannot be opened and closed inside one block. Anyone may fund(epochId) the pot with ether, at any time before it settles, and their contribution is recorded against their address.

Submit

submit(epochId, commitment) with exactly STAKE. The commitment binds the epoch, the submitter, the hash of the weights URI, and a salt. Because the submitter is inside the preimage, a commitment copied off the mempool cannot be claimed by whoever copied it.

Reveal

reveal(subId, weightsUri, salt). The contract recomputes the commitment and rejects anything that does not match. Revealing the model early is harmless — the thing that must stay sealed is the challenge set, not the model.

A submission that is never revealed cannot be scored, and at settlement its stake is forfeit to the pot. It occupied a slot and withheld the artefact; the pot is made whole for it.

Open scoring

openScoring(epochId, challengeUri, challengeSalt) publishes the preimage and checks it against the commitment. Anyone holding the preimage may call it. It must land between submitEnd and scoreEnd; if it never lands, the epoch is abandoned — every stake and every contribution is refunded and nobody is slashed. Withholding the data costs the withholder the task and costs everyone else only time.

Score, and contradict

attest(subId, score, evidenceHash) with exactly ATTEST_BOND. The score is a fraction of one in 18-decimal fixed point, at most MAX_SCORE. The evidence hash binds it to the challenge set and to the input/output pairs the scorer used.

One address, one attestation per submission, and at most MAX_ATTESTERS_PER_SUBMISSION in total, which is what bounds every loop in resolve.

Resolve

resolve(subId), once scoreEnd + DISPUTE_WINDOW has passed. Sides are weighed by bonded wei, not by headcount — a crowd of empty wallets cannot outvote conviction. Three outcomes:

outcomethe submissionthe bonds
the original score winsthaws, ranked at that scoremajority whole + a share of the slash; minority loses SLASH_BPS
a contradictor winsstays Frozen forever, never rankedsame, with the sides swapped
a tie by bonded weistays Frozenevery bond returned in full, nobody slashed

The tie case is deliberate. Two scores carrying identical bonded weight is a question the chain cannot answer honestly, so it does not pretend to — it refuses to rank and refuses to punish.

A dispute can also be resolved after the epoch has settled. The bonds still go home and the liar is still slashed, but the rank is gone: thawing into a settled epoch would leave a Scored submission nothing will ever pay. invariant_scoredCountMatchesReality is the test that caught that, and it is why the branch exists.

Settle

settle(epochId), once scoreEnd + DISPUTE_WINDOW has passed. Every submission reaches exactly one terminal state:

state at settlebecomeswhat the submitter gets
ScoredPaidstake + floor(net × score / Σscore)
Revealed, nobody scored itRefundedstake back — not a zero, not a rank
Frozenstays Frozenstake back; the scorer who lied is the one who paid
Committed, never revealedForfeitnothing; the stake goes to the pot

The sink takes SINK_FEE_BPS of the pot only when at least one submission settles with a verified score. If nothing was verified, the fee is zero, the pot is untouched, and its funders take it back through claimRefund.

claimRefund computes each funder's share against what is still in the pot and what is still unclaimed, so the last claimant takes the remainder exactly and the pot drains to the wei. That is not stylistic: dividing one total on two different partitions is how a contract ends up one wei short, with every test passing except the final withdrawal.

2 — The exact bytes that are hashed

Four hashes, all abi.encode and never abi.encodePacked. Every field is a fixed 32-byte word and every string is hashed before it is encoded, so no two distinct inputs can be made to collide by sliding a field boundary. Cells [2], [4] and [6] reproduce all four in your browser.

COMMIT_DOMAIN    = keccak256("DATASYNC_SUBMISSION_V1")
CHALLENGE_DOMAIN = keccak256("DATASYNC_CHALLENGE_V1")
EVIDENCE_DOMAIN  = keccak256("DATASYNC_EVIDENCE_V1")

commitment    = keccak256(abi.encode(
                  COMMIT_DOMAIN,          // bytes32
                  epochId,                // uint256
                  submitter,              // address
                  keccak256(bytes(weightsUri)),
                  salt                    // bytes32
                ))                        // 160 bytes of preimage

challengeHash = keccak256(abi.encode(
                  CHALLENGE_DOMAIN,
                  epochId,
                  keccak256(bytes(challengeUri)),
                  salt
                ))                        // 128 bytes

ioLeaf[i]     = keccak256(abi.encode(keccak256(input_i), keccak256(output_i)))
ioPairsHash   = keccak256(abi.encode(bytes32[] leaves))   // offset, length, then the leaves
evidenceHash  = keccak256(abi.encode(EVIDENCE_DOMAIN, challengeCommit, ioPairsHash))

The domain words differ so that a submission commitment can never be replayed as a challenge seal, and so that neither can be replayed as an evidence hash. test/Hashing.t.sol asserts the preimage lengths and the injectivity of each field, including a fuzz test that the Solidity and the hand-written encoding agree for arbitrary inputs.

3 — Every constant, with its value and its why

namevaluewhy that number
BPS10 000One basis-point denominator for the whole contract, so no split is ever expressed in two different units.
MAX_SCORE1e18A score is a fraction of one in 18-decimal fixed point. Rewards are pot × score / Σscore, so the unit only has to be consistent; 1e18 gives 18 digits of resolution and keeps the product far inside 2²⁵⁶ for any realistic pot.
STAKE0.01 etherThe price of occupying a submission slot. Low enough that a researcher can enter; high enough that squatting a hundred slots costs one ether.
ATTEST_BOND0.02 etherExactly 2 × STAKE. Contradicting a rival must cost strictly more than submitting against them, or the cheapest attack on the market is a lie.
SLASH_BPS7 00070 % of a losing bond. Deliberately not 10 000: a scorer who ran the model honestly and landed on a different number should be punished, not erased — a total slash turns scoring into a coin flip nobody takes.
SLASH_TO_MAJORITY_BPS6 000The majority did the work of catching the lie, so most of what is taken is theirs.
SLASH_TO_POT_BPS3 000The funders paid for a task a liar tried to corrupt.
SLASH_TO_SINK_BPS1 000The protocol's only revenue from a dispute. The three sum to BPS, checked in the constructor.
SINK_FEE_BPS2502.5 % of a settled pot, taken only when a pot really settles with at least one verified score. An abandoned or unscored epoch pays nothing.
DISPUTE_WINDOW3 daysAfter scoring closes, how long the quiet majority has to bond against a late contradiction. Three days so a weekend cannot be used as an attack window.
MIN_SUBMIT_WINDOW1 daysAn epoch cannot be opened and closed to submissions inside one block.
MIN_SCORE_WINDOW1 daysScorers need time to actually run the thing.
MAX_ATTESTERS_PER_SUBMISSION64Bounds every loop in resolve, which is O(n²) over attesters — at 64 that is 4 096 memory comparisons, after one pass copying storage to memory, so a frozen submission can always be resolved inside a block.
MAX_URI_BYTES512A weights URI is a pointer, not a payload.

And in FeeSink.sol: MAX_SLIPPAGE_BPS = 300, so a buyback may give up at most 3 % against the quoter's own number — which means a pool whose fee tier eats more than that simply cannot be traded into by this contract. EXPECTED_SUPPLY = 1e27, the supply every Stockereum launch mints, checked as a second independent signal alongside factory().

4 — The slash waterfall

Walk it with your own numbers in cell [10]. The arithmetic there is the contract's, division for division.

// per LOSING bond, floored once, on ONE partition
for each minority bond b:
    cut  = floor(b × SLASH_BPS / BPS)       // 70 %
    slashed += cut
    credit(attester, b - cut)               // the other 30 % goes home

// then the waterfall, on exactly that `slashed`
toMajority = floor(slashed × SLASH_TO_MAJORITY_BPS / BPS)   // 6000
toPot      = floor(slashed × SLASH_TO_POT_BPS      / BPS)    // 3000
toSink     = slashed - toMajority - toPot                    // takes both roundings

for each majority bond b:
    share   = floor(toMajority × b / majorityBonds)
    handed += share
    credit(attester, share)

toSink += toMajority - handed      // the pro-rata residue, named and sent somewhere real
pot    += toPot
credit(feeSink, toSink)
Why it is written that way floor(Σb × 7000 / 10000) and Σ floor(b × 7000 / 10000) are different numbers. A contract that uses the first for the accounting and the second for the payouts is short by a wei, and every test passes except the last withdrawal. So the slashed total here is never computed independently: it is accumulated from exactly the cuts that were actually taken. The same rule applies to the majority's pro-rata and to settle's reward split — one partition, one floor, and whatever falls out is named dust and credited to the sink in the same transaction.

5 — The ledger and its one invariant

Every wei inside Datasync is in exactly one of two aggregates: totalCredits, which is withdrawable by someone, and totalLocked, which is a stake, a bond or a pot. Every state transition moves wei between them and never creates or destroys any.

address(this).balance == totalCredits + totalLocked

That is asserted after every single action in the unit tests and as a fuzz invariant over 128 000 random calls, alongside balance ≥ totalCredits (never insolvent) and balance == everything in − everything out (ether never appears or vanishes).

Nothing in the contract ever pushes ether. withdraw() is the only way out, and a recipient that reverts on receive can therefore freeze nobody but itself — there is a test which settles a pot with a reverting contract as one of the winners and watches everyone else get paid.

6 — What is off chain

Everything that matters about a model, which is the honest shape of this:

What the chain does: it fixes the order of events so nobody can fit to the test, it makes every assertion cost money, and it pays out on arithmetic nobody can argue with. That is all, and it is written in the first comment of Datasync.sol in those words.

7 — Stockereum, and the fee sink that is unarmed

Stockereum is a real Ethereum launchpad that opens Uniswap v4 pools. Read live on the anchors page; everything below was read with eth_call on 3 December 2026 at block ≥ 26 552 110.

Verified

factvalue
STOCKER.factory()0x4C402AA92f166be2d3D9bA1b2879bD2b5616a26d
STOCKER.totalSupply()1e27
STOCKER.name() / symbol()"Stockereum.fun" / "STOCKER"
factory runtime size15 766 bytes
factory.launchCount()124
factory.creationFee()1e15
factory.openingFdvUsd()4000e18
factory.SUPPLY_WHOLE()1e9
factory.TICK_SPACING()200
factory.poolManager()0x0000…4444c5dc75cB358380D2e3dE08A90 — the real v4 PoolManager
factory.eip712Domain()"StockpadLaunchFactory", version "1", chainId 1
allLaunches(123)ETHERCAT, 0xD32D…8FFa — which names the same factory

The launch ABI, derived rather than guessed

There was no selector to look up and no event to follow: the factory had emitted nothing in 200 000 blocks. The reason is that all 124 launches sit between blocks 25 899 571 and 25 908 246 — 3 to 5 September 2026 — and a 200 000-block window ending today begins two months after the pad went quiet. There was nothing to find. So:

  1. A PUSH4 sweep of the 15 766-byte runtime gave 78 candidate words, resolved through api.openchain.xyz. Among them: createLaunch(...) = 0x74f65323 and createLaunchAndBuy(...,uint256) = 0x67309027.
  2. A real launch transaction was located by requesting a token's own logs (rpc.flashbots.net serves 2 000 blocks a call; most public endpoints refuse archive ranges entirely): 0x2426667ab3ee029f759ca3e7cd7cac9a1dc465e067eaa811f990b9d14d351e74, block 25 908 246, status 1, gasUsed 1 632 117, 24 logs, 0.003 ETH of value, selector 0x67309027.
  3. Decoding its 804 bytes with the candidate struct produces the exact JSON string that ETHERCAT.metadataUri() still returns, byte for byte. That is the proof.
struct LaunchParams {
    string  name;          // "ETHERCAT"
    string  symbol;        // "ETHERCAT"
    string  metadataUri;   // {"description":…,"web":…,"x":…,"tg":…,"image":…}
    address quote;         // 0xf6b1117e…103f  →  TSLAon, "Tesla (Ondo Tokenized)"
    uint256 usdPrice;      // 354080000000000000000  →  $354.08 a share
    uint256 deadline;      // 1788577128
    bytes   priceSig;      // 65 bytes, EIP-712
}
createLaunchAndBuy(LaunchParams, uint256 devBuy)   // devBuy was 0

So Stockereum pairs against tokenized equities. That is why the opening valuation is in dollars, and why the quote's price must be attested rather than read from a pool. The signature scheme was closed by brute-forcing the typehash preimage:

PRICE_TYPEHASH    = keccak256("QuotePrice(address quote,uint256 usdPrice,uint256 deadline)")
                  = 0x604e38e7b41a84289b02fd4a501d954c6ed2a9dd30640b2c990ffb15d9f98721
domainSeparator   = 0xd484562e043b2b2e1ae7c3850b5291c0c14b7e963f51211f5fc842b041c5a088
digest (that tx)  = 0xe23312071ba0a8f0a8a5ab521fe1908f9123b2a185accd4292684c6b43ca2ca4
ecrecover(digest) = 0x9296698ab7dCDe04D0E4B05d0d87cB21b6bC5CA2     ← the pad's price signer

A wrong encoding anywhere in that chain recovers a random address. Recovering one clean checksummed address is what makes the ABI certain. Cell [12] re-checks the typehash against the live chain in your browser.

Not verified, and the consequence Stockereum is not permissionless. A launch needs a fresh QuotePrice signed by that signer, with a deadline roughly 1 000 seconds out. Nobody outside the pad can produce it. Replaying the real calldata on a mainnet fork reverts PriceExpired(); signing a fresh one with any other key reverts BadPriceSignature() (0xb5cbb5a2) — and that error was not in the PUSH4 sweep at all. It was found by trying it on a fork, which means the sweep is incomplete, and fifteen of the 78 words are still unresolved and are not used.

The pool key, the fee tier, the liquidity lock and the creator fee were not read off chain, so none of those numbers appear anywhere on this site.

Consequence: src/IStockereum.sol carries the verified getters in one interface and the launch entry points in a second one marked UNVERIFIED FOR OUR USE — correct ABI, unusable without the pad's signature. Datasync never calls it.

The fee sink

Fees accrue in ether and nothing happens, on purpose.

8 — The tests

filenwhat it pins
Hashing.t.sol14the four preimages, their lengths, the injectivity of every field, and a fuzz test that Solidity and a hand-written encoding agree
Lifecycle.t.sol21windows, exact stake, reveal checking, and that scoring cannot start before the challenge preimage is published
Scoring.t.sol25standing score, agreement, contradiction, freeze, resolve by bonded wei, the tie, the attester limit, bond release
Settle.t.sol16pro rata with three uneven scores, refund-not-zero, forfeit, abandonment, two funders draining a pot to the wei, a reverting receiver freezing nobody
Preview.t.sol10that the two previews this website runs match what settle and resolve actually pay, plus two conservation fuzz tests
Sink.t.sol22every way arm() refuses, and every way buyback() refuses
Invariant.t.sol8the ledger partition, solvency, conservation of ether, and that scoredCount never drifts from the submissions it counts — 128 000 calls each
ForkStockereum.t.sol31every anchor against real mainnet, the typehash, the domain separator, the signer recovery, the calldata replay, and the sink's gate on real tokens

The invariant suite earned its keep: invariant_scoredCountMatchesReality failed on the first run and found that settle moved a submission from Scored to Paid without decrementing the counter, which also meant a dispute resolved after settlement could thaw a submission into an epoch that would never pay it. Both are fixed; the branch and the comment that explain them exist because a fuzz run found them.

Nothing is deployed. The only chain interaction anywhere in this repository is vm.createSelectFork("https://ethereum-rpc.publicnode.com"), which reads.

9 — What is not done