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.
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
- Press Connect wallet and approve the switch to GenLayer Studionet when your wallet asks.
- Open My credit. If you have no test GEN, use Get 1 test GEN, then deposit what you want to lock.
- Open Create. Write the scope, set the reward, slots, bond and deadlines, then create the bounty. The reward for every slot is locked immediately.
- Share the bounty link with hunters.
- After the reveals, press Review finding on the bounty page, or let anyone else do it. Validators decide each finding in order.
- When the work is done, close the bounty. Unused reward returns to your credit and you can withdraw it.
As a hunter
- Connect your wallet and keep at least the bond in your Primacy credit.
- Open the bounty and read the scope carefully. It is what validators will judge against.
- Go to Hunt, write the title and details, and press Commit finding. The site generates the salt and saves everything in your vault.
- Export a vault backup from the Hunt page.
- Before the reveal deadline, press Reveal now in the vault. Missing it forfeits the bond.
- 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 name | GenLayer Studionet |
|---|---|
| Chain ID | 61999 (hex 0xf22f) |
| RPC URL | https://studio.genlayer.com/api |
| Currency symbol | GEN (18 decimals) |
| Block explorer | https://explorer-studio.genlayer.com |
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
| Status | Meaning | Bond | Reward |
|---|---|---|---|
| committed | Hash is on chain, text is hidden. | Locked | No |
| revealed | Text is public, waiting its turn. | Locked | No |
| distinct | In scope, actionable, and the first report of its defect. | Refunded | Paid |
| duplicate | Same defect as an accepted finding. | Refunded | No |
| invalid | Out of scope or not actionable, with enough confidence. | To the sponsor | No |
| unresolved | Validators could not decide within the retry budget, or the bounty closed first. | Refunded | No |
| void | Not revealed in time. | To the sponsor | No |
| late | The bounty filled its slots while this finding was still waiting. | Refunded | No |
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:
- The domain string
primacy/v1 - The bounty key: the sponsor address in lowercase, a colon, and the bounty id
- Your address in lowercase
- Your salt
- The title
- 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()
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.
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 says | The outcome is |
|---|---|
| confidence below 80 | inconclusive |
| in_scope is no, or actionable is no | invalid |
| in_scope or actionable is unclear | inconclusive |
| duplicate_of is unclear | inconclusive |
| duplicate_of is none | distinct |
| duplicate_of names H1, H2 and so on | duplicate 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.
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
| Event | What moves |
|---|---|
| Deposit | GEN you send becomes your credit. |
| Create bounty | Reward × slots moves from the sponsor's credit into escrow. |
| Commit | The bond moves from the hunter's credit into a lock. |
| Finding is distinct | The hunter receives one reward and the bond back. |
| Finding is duplicate or unresolved or late | The bond returns to the hunter. |
| Finding is invalid or void | The bond goes to the sponsor's credit. |
| Close | Unspent escrow returns to the sponsor's credit. |
| Withdraw | Your 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.
GEN sent to the contract address by a plain transfer is not credited to anyone and cannot be recovered.
Limits and rules
| Item | Rule |
|---|---|
| Reward per slot | 0.0001 GEN up to 1,000,000,000 GEN |
| Bond | At least 0.000001 GEN and never above the reward |
| Slots | 1 to 8 |
| Findings per bounty | 32 in total, and 4 per hunter |
| Bounty id | 1 to 64 characters: letters, digits, dot, dash, underscore, starting with a letter or digit |
| Scope | 20 to 800 characters after whitespace is collapsed |
| Title and body | Up to 120 and up to 1200 characters |
| Commit deadline | 10 minutes to 60 days from creation |
| Reveal window | 5 minutes to 7 days, counted from each commit |
| Review deadline | 1 to 90 days after the commit deadline plus the reveal window |
| Confidence threshold | 80 |
| Retry budget | 3 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
| Page | Use it to |
|---|---|
| Home | See the idea and the contract's live totals. |
| Bounties | Open a bounty by sponsor and id, or from your list and the live examples. |
| Bounty page | Read the scope, timeline and queue. Reveal, review, void, close or cancel, depending on who you are and what the time allows. |
| Create | Open a bounty. Shows the total to lock and whether your credit covers it. |
| Hunt | Commit a finding and manage your vault: reveal, sync, export and import. |
| My credit | Deposit, withdraw, get test GEN, and see the contract's books. |
| Demo | A 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
| Message | What it means |
|---|---|
| Insufficient available credit | Deposit more on My credit first. |
| Duplicate bounty id | You already used that id. Choose another. |
| Invalid commit deadline / reveal window / review deadline | A time is outside the allowed range. Use the choices on the Create page. |
| Bounty not found | The sponsor address or id is wrong. Both must match exactly. |
| Commit window is closed | The commit deadline passed or the bounty is no longer open. |
| Sponsor cannot submit findings | Use a different address to hunt. |
| All reward slots are filled | Every slot has been paid. |
| Finding limit reached / Per-hunter finding limit reached | The queue has 32 findings, or you already have 4 here. |
| Only the committing hunter may reveal | Switch your wallet to the address that committed. |
| Reveal window elapsed | Too late. Anyone can void the commitment and the bond goes to the sponsor. |
| Reveal does not match commitment | The title, body or salt differs from what you committed, even by one character. |
| Earliest finding awaits reveal or voiding | The finding at the front of the queue is not revealed yet. |
| Adjudication cooldown is active | The last attempt was inconclusive. Wait for the timer on the bounty page. |
| Review window elapsed | The review deadline passed. Close the bounty. |
| Bounty cannot be closed yet | Commits are still open or findings are still pending. |
| Bounty cannot be cancelled | Cancelling is only possible before the first commit. |
| No available credit | Nothing to withdraw. |
The deployed contract
| Network | GenLayer Studionet, chain id 61999 |
|---|---|
| Address | 0xf49Fca785788a2a3881c593F33B2E20113FD99e1 |
| Deployment transaction | 0xdec37863…ef8825 |
| Name and version | Primacy 0.1.0, commitment domain primacy/v1 |
| Source | github.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.
- 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.
- 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.
- The sponsor controls the scope, and there is no appeal.
- 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.
- 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.
- Plain transfers are stranded when sent without
deposit_credit. - 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?
Can a sponsor refuse to pay a good finding?
Can a hunter get paid twice for the same defect?
What if two hunters find the same defect at the same time?
I lost my salt. What now?
Why does review take a minute or more?
Who can press Review?
Is this safe to use with real money?
Why does my wallet show a different recipient address?
Is the commitment really private?
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.