Skip to content

Documentation

Everything about Primacy in one place: how a bounty works, how decisions are made, and how to use this website with your wallet.

What Primacy is

Primacy is a first-finder bounty board that runs as a GenLayer Intelligent Contract. A sponsor funds a bounty and writes what counts as a valid finding. Hunters submit findings. The first finding of each distinct defect earns the reward, and later reports of the same defect earn nothing, however they are worded.

Three things make that fair, and each one is enforced by the contract instead of by trust:

  • Order is fixed by the chain. A hunter commits a hash of the finding first. Commit order is the priority order, and the text stays hidden until it is revealed, so nobody can read it and race in.
  • Duplicates are judged by meaning. Validators powered by language models compare a new finding with the accepted ones and decide whether it reports the same underlying defect.
  • Money follows fixed rules. The model fills in a small structured form. Contract code turns that form into an outcome and moves the funds. The model never picks an amount or a recipient.
Who does what.

Sponsors create bounties. Hunters commit and reveal findings. Anyone can trigger a review, void a finding that was never revealed, or close a finished bounty, so the process never waits on the sponsor.

Quick start

As a sponsor

  1. Press Connect wallet and approve the switch to GenLayer Studionet when your wallet asks.
  2. Open My credit. If you have no test GEN, use Get 1 test GEN, then deposit what you want to lock.
  3. Open Create. Write the scope, set the reward, slots, bond and deadlines, then create the bounty. The reward for every slot is locked immediately.
  4. Share the bounty link with hunters.
  5. After the reveals, press Review finding on the bounty page, or let anyone else do it. Validators decide each finding in order.
  6. When the work is done, close the bounty. Unused reward returns to your credit and you can withdraw it.

As a hunter

  1. Connect your wallet and keep at least the bond in your Primacy credit.
  2. Open the bounty and read the scope carefully. It is what validators will judge against.
  3. Go to Hunt, write the title and details, and press Commit finding. The site generates the salt and saves everything in your vault.
  4. Export a vault backup from the Hunt page.
  5. Before the reveal deadline, press Reveal now in the vault. Missing it forfeits the bond.
  6. Wait for the review. If you were first and in scope you receive the reward plus your bond back. Then withdraw from My credit.

Wallet and network

Primacy runs on GenLayer Studionet. This site prompts your wallet to add and switch to it automatically. To add it by hand, use these values:

Network nameGenLayer Studionet
Chain ID61999 (hex 0xf22f)
RPC URLhttps://studio.genlayer.com/api
Currency symbolGEN (18 decimals)
Block explorerhttps://explorer-studio.genlayer.com
Test network.

Studionet uses test funds with no real value. Treat it as a place to try things. Do not put an undisclosed security vulnerability into a public bounty, because revealed findings are permanently public.

Core concepts

Credit
Your balance inside Primacy. You deposit GEN to get credit and withdraw it back. Rewards, bonds and refunds all move through credit, and only you can withdraw yours.
Bounty
Identified by its sponsor address and an id the sponsor chooses, such as docs-v1. Holds a scope, a reward per slot, a number of slots, a bond, and three deadlines.
Slot
One payable defect. A bounty with 3 slots pays at most 3 distinct findings. When every slot is paid, the bounty closes by itself.
Finding
A report committed by a hunter. It has a title and body once revealed, and moves through the statuses below.
Queue
Findings in commit order. They are decided strictly one at a time from the front, which is how priority is guaranteed.
Bond
A deposit locked with every commit. It is returned for honest findings and goes to the sponsor for invalid or abandoned ones.
Accepted finding
A finding judged distinct. New findings are compared with these when checking for duplicates.

Lifecycle and statuses

Open

Commits accepted until the commit deadline or until all slots are paid.

Reviewing

Revealed findings are decided in order until the review deadline.

Closed

Unused reward returns to the sponsor. Pending bonds are settled.

A bounty is open, then closed. A sponsor can instead cancel it, but only while nobody has committed. A bounty closes when all slots are paid, when the review deadline passes, or when the commit window has ended and nothing is pending.

Finding statuses

StatusMeaningBondReward
committedHash is on chain, text is hidden.LockedNo
revealedText is public, waiting its turn.LockedNo
distinctIn scope, actionable, and the first report of its defect.RefundedPaid
duplicateSame defect as an accepted finding.RefundedNo
invalidOut of scope or not actionable, with enough confidence.To the sponsorNo
unresolvedValidators could not decide within the retry budget, or the bounty closed first.RefundedNo
voidNot revealed in time.To the sponsorNo
lateThe bounty filled its slots while this finding was still waiting.RefundedNo

Commit and reveal

Committing publishes only a SHA-256 fingerprint. Revealing publishes the text, and the contract recomputes the fingerprint. If it does not match what you committed, the reveal is rejected. Because the fingerprint includes your address, nobody else can reveal your commitment, and because it includes the bounty, it cannot be reused elsewhere.

What is hashed

Six fields, each written as <byte length>:<UTF-8 bytes>; and concatenated, then hashed with SHA-256:

  1. The domain string primacy/v1
  2. The bounty key: the sponsor address in lowercase, a colon, and the bounty id
  3. Your address in lowercase
  4. Your salt
  5. The title
  6. The body
// JavaScript (this is what the website runs)
const enc = new TextEncoder();
const field = (s) => { const b = enc.encode(s); return [enc.encode(b.length + ":"), b, enc.encode(";")]; };
async function commitment(sponsor, bountyId, hunter, salt, title, body) {
  const parts = ["primacy/v1", sponsor.toLowerCase() + ":" + bountyId, hunter.toLowerCase(), salt, title, body];
  const chunks = parts.flatMap(field);
  const buf = new Uint8Array(chunks.reduce((n, c) => n + c.length, 0));
  let at = 0; for (const c of chunks) { buf.set(c, at); at += c.length; }
  const h = new Uint8Array(await crypto.subtle.digest("SHA-256", buf));
  return "0x" + Array.from(h, (x) => x.toString(16).padStart(2, "0")).join("");
}
# Python (scripts/primacy_commit.py in the repository)
def field(text): raw = text.encode("utf-8"); return str(len(raw)).encode() + b":" + raw + b";"
payload = b"".join(field(p) for p in ("primacy/v1", sponsor.lower() + ":" + bounty_id, hunter.lower(), salt, title, body))
digest = "0x" + hashlib.sha256(payload).hexdigest()
Verified.

The website's JavaScript was checked against the Python helper on mixed-case addresses and non-ASCII text, and produces identical digests.

Rules for the text

  • Title: 1 to 120 characters, one line. Body: 1 to 1200 characters, line breaks allowed.
  • No leading or trailing whitespace. Revealed text is validated, never silently trimmed, because it is bound to the hash.
  • No control characters or invisible characters such as zero-width spaces or bidirectional overrides.
  • Salt: 16 to 64 characters from A-Z a-z 0-9 _ -. The site generates 32 random hex characters.
Keep the salt.

Without the exact title, body and salt you cannot reveal, and an unrevealed commitment forfeits its bond. The Hunt page stores them in your browser and can export a backup file.

How findings are judged

When someone presses Review, the contract takes the earliest finding that has been revealed and decides it against the accepted findings so far. Review is strictly in queue order. If the earliest finding has not been revealed yet, the line waits until it is revealed or voided.

Step 1: the copy guard

Before any model is asked, a deterministic check compares the candidate with each accepted finding using three-word shingles. If both texts have at least 12 words and the Jaccard similarity is 90 percent or higher, the finding is marked a duplicate immediately. Pasting someone else's report with a few words changed does not get through.

Step 2: validators fill in a form

Otherwise the leader validator sends a prompt containing the scope, the accepted findings (labelled H1, H2 and so on) and the candidate. The reply must be one JSON object:

{
  "in_scope": "yes | no | unclear",
  "actionable": "yes | no | unclear",
  "duplicate_of": "none | unclear | H1 | H2 ...",
  "confidence": 0-100,
  "rationale": "up to 300 characters"
}

All of the quoted text is wrapped in a fence made from a hash of that text itself, so a report cannot contain the closing marker, and the prompt tells the model that nothing inside the fence is an instruction.

Step 3: the decision table

Contract code, not the model, turns the form into an outcome:

If the form saysThe outcome is
confidence below 80inconclusive
in_scope is no, or actionable is noinvalid
in_scope or actionable is unclearinconclusive
duplicate_of is unclearinconclusive
duplicate_of is nonedistinct
duplicate_of names H1, H2 and so onduplicate of that accepted finding

Step 4: consensus on what matters

Other validators run the same prompt independently. Language models never produce identical text, so the contract compares only what decides money:

  • The outcome must be the same.
  • For a duplicate, both must name the same accepted finding, because that decides who was first.
  • For an invalid finding, both must name at least one common defect (out of scope or not actionable), because a bond is forfeited.
  • Rationales and confidence values may differ.

If validators cannot agree, the call produces no decision and nothing is paid.

Inconclusive answers and retries

An inconclusive answer or an operational failure records an attempt and starts a cooldown of 5 minutes that doubles each time, up to 2 hours. After 3 inconclusive answers or 6 failures the finding becomes unresolved, its bond is refunded, and the queue moves on. The bounty page shows the cooldown timer.

The sponsor writes the scope.

Validators judge against the sponsor's text, and there is no appeal. Hunters should read the scope first. Sponsors should say clearly what is in and what is out.

Where the money goes

EventWhat moves
DepositGEN you send becomes your credit.
Create bountyReward × slots moves from the sponsor's credit into escrow.
CommitThe bond moves from the hunter's credit into a lock.
Finding is distinctThe hunter receives one reward and the bond back.
Finding is duplicate or unresolved or lateThe bond returns to the hunter.
Finding is invalid or voidThe bond goes to the sponsor's credit.
CloseUnspent escrow returns to the sponsor's credit.
WithdrawYour whole available credit is sent to your own wallet.

The contract keeps a running total of credit and locked funds, and get_accounting compares it with the real balance. The home page shows whether the books balance.

Always deposit through the site.

GEN sent to the contract address by a plain transfer is not credited to anyone and cannot be recovered.

Limits and rules

ItemRule
Reward per slot0.0001 GEN up to 1,000,000,000 GEN
BondAt least 0.000001 GEN and never above the reward
Slots1 to 8
Findings per bounty32 in total, and 4 per hunter
Bounty id1 to 64 characters: letters, digits, dot, dash, underscore, starting with a letter or digit
Scope20 to 800 characters after whitespace is collapsed
Title and bodyUp to 120 and up to 1200 characters
Commit deadline10 minutes to 60 days from creation
Reveal window5 minutes to 7 days, counted from each commit
Review deadline1 to 90 days after the commit deadline plus the reveal window
Confidence threshold80
Retry budget3 inconclusive answers or 6 failures, cooldown 5 minutes doubling to 2 hours

The sponsor cannot commit to their own bounty. This website offers shorter choices than the contract allows so the defaults are safe: the shortest commit window it offers is 15 minutes, because the contract needs at least 10 and your transaction takes a little while to land.

The pages

PageUse it to
HomeSee the idea and the contract's live totals.
BountiesOpen a bounty by sponsor and id, or from your list and the live examples.
Bounty pageRead the scope, timeline and queue. Reveal, review, void, close or cancel, depending on who you are and what the time allows.
CreateOpen a bounty. Shows the total to lock and whether your credit covers it.
HuntCommit a finding and manage your vault: reveal, sync, export and import.
My creditDeposit, withdraw, get test GEN, and see the contract's books.
DemoA guided simulation of a whole bounty.

Where your data lives

The site has no server of its own. It talks to your wallet and to the Studionet RPC. The vault (your saved findings and salts) and your bounty list live in this browser's local storage and never leave it, except as the hash you commit and the text you choose to reveal. Because they are per browser, use Export to back up and Import to move them.

Text from findings and scopes is untrusted. The site always displays it as plain text and never as HTML.

Wallets (EIP-6963)

Browsers can have several wallet extensions at once, and the old window.ethereum object lets them fight over one slot. Primacy uses EIP-6963 instead: each wallet announces itself with its name, icon and identifier, and the site lists every wallet it hears from. If a browser only has an older wallet, Primacy falls back to window.ethereum and labels it.

  • Connect. The picker asks the chosen wallet for access to an account. Your choice is remembered, so reloading the page reconnects quietly without a popup, as long as the wallet still allows it.
  • Switch network. If the wallet is not on Studionet, a yellow banner and a dialog explain it, and the wallet is asked to switch. If Studionet is unknown to the wallet, it is offered to add it first.
  • Disconnect. The menu under your address ends the session: the site forgets the wallet, stops listening to it, and asks the wallet to revoke access where it supports that. You will not be reconnected automatically afterwards.
  • Changes in the wallet. Switching account or network inside the wallet is picked up immediately.

Primacy never sees a private key. Every transaction is confirmed inside your wallet, and the site shows each one as it moves from your wallet, through validator consensus, to the contract's result.

Troubleshooting

Wallet and network

  • "No wallet was found." Install an EIP-6963 wallet such as MetaMask or Rabby and reload the page.
  • Yellow "Wrong network" banner. Press Switch network and approve it in your wallet.
  • "You rejected the request in your wallet." You closed the wallet popup. Press the button again.
  • Consensus ended as UNDETERMINED or a timeout. Validators did not agree in time. Nothing changed. Wait a moment and try again.

Messages from the contract

MessageWhat it means
Insufficient available creditDeposit more on My credit first.
Duplicate bounty idYou already used that id. Choose another.
Invalid commit deadline / reveal window / review deadlineA time is outside the allowed range. Use the choices on the Create page.
Bounty not foundThe sponsor address or id is wrong. Both must match exactly.
Commit window is closedThe commit deadline passed or the bounty is no longer open.
Sponsor cannot submit findingsUse a different address to hunt.
All reward slots are filledEvery slot has been paid.
Finding limit reached / Per-hunter finding limit reachedThe queue has 32 findings, or you already have 4 here.
Only the committing hunter may revealSwitch your wallet to the address that committed.
Reveal window elapsedToo late. Anyone can void the commitment and the bond goes to the sponsor.
Reveal does not match commitmentThe title, body or salt differs from what you committed, even by one character.
Earliest finding awaits reveal or voidingThe finding at the front of the queue is not revealed yet.
Adjudication cooldown is activeThe last attempt was inconclusive. Wait for the timer on the bounty page.
Review window elapsedThe review deadline passed. Close the bounty.
Bounty cannot be closed yetCommits are still open or findings are still pending.
Bounty cannot be cancelledCancelling is only possible before the first commit.
No available creditNothing to withdraw.

The deployed contract

NetworkGenLayer Studionet, chain id 61999
Address0xf49Fca785788a2a3881c593F33B2E20113FD99e1
Deployment transaction0xdec37863…ef8825
Name and versionPrimacy 0.1.0, commitment domain primacy/v1
Sourcegithub.com/reza9133/primacy

The full list of methods, arguments and errors is on the contract reference page.

Security and honest limits

These are real, and the contract's design notes list them too. None of them lets anyone take funds that are not theirs. They concern fairness, liveness and cost.

  1. Queue stuffing. One actor with many addresses can fill the 32-finding queue. The deterrent is the bond, so sponsors should set it to 5 to 10 percent of the reward or more.
  2. Back-off stalls. Decisions are strictly ordered, so a finding that keeps failing holds the line until its retry budget is spent, roughly two and a half hours at most.
  3. The sponsor controls the scope, and there is no appeal.
  4. Compared with accepted findings only. A new finding is compared with accepted ones, not with earlier duplicates or rejected findings. An unusually terse first report can make a better-written later one look distinct.
  5. No truth check. Validators read text. They can say a report is specific and in scope, but not whether the claimed error really exists. The sponsor verifies facts.
  6. Plain transfers are stranded when sent without deposit_credit.
  7. Findings are public forever once revealed.

Run or host the site

The site is plain static files. There is no build step to run it, only to regenerate the bundled GenLayer SDK.

cd frontend
python3 -m http.server 8080
# open http://localhost:8080

Serve it over http://localhost or https. Wallet extensions do not inject into file:// pages.

Change the contract address

Edit one place, assets/js/config.js. The address, chain, links and example bounties are all there.

GitHub Pages

The repository includes a workflow, .github/workflows/pages.yml, that publishes the frontend folder. In the repository settings, set Pages to use GitHub Actions, then push to the main branch.

Rebuild the SDK bundle

cd frontend/tools
npm install
npm run build   # writes ../assets/js/genlayer-sdk.js

The bundle wraps genlayer-js, which is what sends transactions through your wallet and reads the contract.

FAQ

Why commit first and reveal later?
If the text were public at commit time, anyone could copy it and commit first. Committing a hash fixes your place in line without exposing the finding, and the reveal proves the text is what you committed.
Can a sponsor refuse to pay a good finding?
No. Payment is decided by validators and contract code. The sponsor can only choose the scope before the bounty opens.
Can a hunter get paid twice for the same defect?
No. Later reports of an accepted defect are marked duplicate and earn no reward, even if the wording is different.
What if two hunters find the same defect at the same time?
The earlier commit is decided first. The later one is then compared with it and, if it reports the same defect, is a duplicate. That is why commit order is the priority.
I lost my salt. What now?
You cannot reveal that finding, so its bond is forfeited once the reveal window ends. Restore from an exported vault backup if you have one.
Why does review take a minute or more?
Validators each run a language model and then compare results. That takes longer than a normal transaction. The transaction dialog shows the stage it is in.
Who can press Review?
Anyone. The result does not depend on who calls it, so hunters, sponsors and bystanders can all move the line along.
Is this safe to use with real money?
This site targets Studionet, a test network. The contract's limits are documented above, and it should be audited before any use with funds of value.
Why does my wallet show a different recipient address?
On GenLayer every call is sent to the network's consensus contract, which then routes it to Primacy. That is normal. The explorer shows the call and its target, and the amount shown for a deposit is the GEN you are crediting.
Is the commitment really private?
The hash reveals nothing readable. The salt adds randomness so short or guessable text cannot be brute-forced from the hash.

Glossary

Commitment
The SHA-256 fingerprint of a finding, posted before the text.
Salt
A random secret mixed into the fingerprint.
Reveal
Publishing the text so the contract can check it against the commitment.
Adjudicate
Decide the next finding in the queue with validators.
Validator
A GenLayer node that runs the contract's logic, including the language-model step, and votes on the result.
Intelligent Contract
A GenLayer contract that can call a language model and still reach consensus on the outcome.
Studionet
GenLayer's hosted test network for building and trying contracts.
EIP-6963
The standard that lets several browser wallets announce themselves without clashing.