> ## Documentation Index
> Fetch the complete documentation index at: https://mintlify.com/Ge0frey/nullgraph/llms.txt
> Use this file to discover all available pages before exploring further.

# Quickstart Guide

> Submit your first Null Knowledge Asset and create a bounty in minutes

This guide walks you through the core workflows of NullGraph: submitting a Null Knowledge Asset (NKA) and creating a bounty.

## Prerequisites

Before starting, ensure you have:

* Completed the [Setup](/getting-started/setup) guide
* Connected Phantom wallet set to **Devnet**
* NullGraph frontend running at `http://localhost:5173`
* Some devnet SOL in your wallet for transaction fees

<Note>
  You can get devnet SOL from the [Solana Faucet](https://faucet.solana.com/) or by running:

  ```bash theme={null}
  solana airdrop 1 --url devnet
  ```
</Note>

## Submit Your First NKA

Null Knowledge Assets (NKAs) are on-chain records of negative scientific results. Each NKA is stored as a permanent PDA on Solana.

<Steps>
  ### Navigate to Submit Page

  Click **"Submit NKA"** in the navigation bar or visit `/submit`.

  ### Step 1: Hypothesis

  Enter your research hypothesis (max 128 characters):

  ```
  Increasing temperature to 42°C will enhance bacterial growth rate by 20%
  ```

  Click **Next**.

  ### Step 2: Methodology

  Describe your methodology (max 128 characters):

  ```
  Incubated E. coli cultures at 42°C for 24h, measured OD600 every 2h
  ```

  Enter expected outcome:

  ```
  OD600 > 1.2 at 24h timepoint
  ```

  Enter actual outcome:

  ```
  OD600 = 0.3 at 24h, culture showed minimal growth
  ```

  Click **Next**.

  ### Step 3: Data

  Enter statistical metadata:

  * **P-value:** `0.8700` (enter as decimal, stored as fixed-point)
  * **Sample size:** `50`

  **Optional:** Upload a data file. The frontend will compute a SHA-256 hash and store it on-chain as a tamper-proof fingerprint. The file itself remains off-chain.

  Click **Next**.

  ### Step 4: Review and Submit

  Review all fields:

  ```
  Hypothesis: Increasing temperature to 42°C will enhance bacterial growth...
  Methodology: Incubated E. coli cultures at 42°C for 24h...
  Expected Outcome: OD600 > 1.2 at 24h timepoint
  Actual Outcome: OD600 = 0.3 at 24h, culture showed minimal growth
  P-value: 0.8700
  Sample Size: 50
  Data Hash: 5a7d...3f2e (if file uploaded)
  ```

  Click **Submit to Chain**.

  ### Approve Transaction

  Phantom will prompt you to approve the transaction:

  * **Network fee:** \~0.001 SOL
  * **Account rent:** \~0.002 SOL (refundable if account is closed)

  Click **Approve** in Phantom.

  ### Confirmation

  Upon success, you'll see a toast notification:

  ```
  NKA-0001 submitted!
  ```

  Your NKA is now permanent and browsable on the [Dashboard](/dashboard).
</Steps>

### How It Works

When you submit an NKA, the frontend:

1. Fetches the current `nka_counter` from `ProtocolState`
2. Derives the `NullResult` PDA using seeds: `["null_result", researcher_pubkey, specimen_number]`
3. Calls `submit_null_result` instruction with all metadata
4. Increments the global counter
5. Emits `NullResultSubmitted` event

<CodeGroup>
  ```typescript Frontend Hook (useSubmitNullResult.ts) theme={null}
  const [protocolStatePDA] = findProtocolStatePDA();
  const state = await program.account.protocolState.fetch(protocolStatePDA);
  const nextSpecimen = state.nkaCounter.toNumber() + 1;
  const [nullResultPDA] = findNullResultPDA(publicKey, nextSpecimen);

  const tx = await program.methods
    .submitNullResult(
      hypothesis,
      methodology,
      expectedOutcome,
      actualOutcome,
      pValue,
      sampleSize,
      dataHash
    )
    .accountsPartial({
      researcher: publicKey,
      protocolState: protocolStatePDA,
      nullResult: nullResultPDA,
      systemProgram: SystemProgram.programId,
    })
    .rpc();
  ```

  ```rust Anchor Instruction (lib.rs) theme={null}
  pub fn submit_null_result(
      ctx: Context<SubmitNullResult>,
      hypothesis: [u8; 128],
      methodology: [u8; 128],
      expected_outcome: [u8; 128],
      actual_outcome: [u8; 128],
      p_value: u32,
      sample_size: u32,
      data_hash: [u8; 32],
  ) -> Result<()> {
      let state = &mut ctx.accounts.protocol_state;
      state.nka_counter += 1;

      let null_result = &mut ctx.accounts.null_result;
      null_result.researcher = ctx.accounts.researcher.key();
      null_result.specimen_number = state.nka_counter;
      null_result.hypothesis = hypothesis;
      null_result.methodology = methodology;
      null_result.expected_outcome = expected_outcome;
      null_result.actual_outcome = actual_outcome;
      null_result.p_value = p_value;
      null_result.sample_size = sample_size;
      null_result.data_hash = data_hash;
      null_result.status = 0; // Pending
      null_result.created_at = Clock::get()?.unix_timestamp;

      emit!(NullResultSubmitted {
          specimen_number: state.nka_counter,
          researcher: ctx.accounts.researcher.key(),
      });

      Ok(())
  }
  ```
</CodeGroup>

## Create a Bounty

Bounties allow researchers and BioDAOs to pay for specific null results. When you create a bounty, BIO tokens are escrowed into a vault PDA until the bounty is fulfilled or closed.

<Steps>
  ### Get BIO Tokens

  Bounties are denominated in BIO tokens. The BIO mint address on devnet is:

  ```
  GkjGV1ZF5BsMs6oAvk8jZiuXM8KwuygFCHLBpqR5Q14j
  ```

  <Note>
    For testing on devnet, you'll need to mint test BIO tokens to your wallet. Contact the protocol administrator or use a test token faucet.
  </Note>

  ### Navigate to Market

  Click **"Market"** in the navigation bar or visit `/market`.

  ### Open Create Bounty Modal

  Click **"Create Bounty"** button.

  ### Fill Bounty Details

  Enter bounty information:

  **Description** (max 256 characters):

  ```
  Seeking null results on the effect of caffeine on C. elegans lifespan. Need p-value > 0.6, sample size > 100.
  ```

  **Reward Amount** (in BIO tokens):

  ```
  500
  ```

  This will escrow 500 BIO tokens (500,000,000 base units with 6 decimals).

  **Deadline** (Unix timestamp or date picker):

  ```
  Select a date 30 days from now
  ```

  Click **Create Bounty**.

  ### Approve Transaction

  Phantom will prompt you to approve the transaction. This transaction:

  1. Creates the `NullBounty` PDA
  2. Creates the vault token account PDA
  3. Transfers 500 BIO from your ATA to the vault
  4. Increments the `bounty_counter`

  **Accounts involved:**

  * **Creator:** Your wallet (signer)
  * **Bounty PDA:** Derived from `["null_bounty", creator_pubkey, bounty_number]`
  * **Vault PDA:** Derived from `["bounty_vault", bounty_pda]`
  * **Creator BIO ATA:** Your associated token account for BIO
  * **BIO Mint:** `GkjGV1ZF5BsMs6oAvk8jZiuXM8KwuygFCHLBpqR5Q14j`

  Click **Approve** in Phantom.

  ### Confirmation

  You'll see a toast notification:

  ```
  Bounty NB-0001 created!
  ```

  Your bounty is now live and visible on the Market page with status **Open**.
</Steps>

### How It Works

<CodeGroup>
  ```typescript Frontend Hook (useCreateBounty.ts) theme={null}
  const [protocolStatePDA] = findProtocolStatePDA();
  const state = await program.account.protocolState.fetch(protocolStatePDA);
  const nextBounty = state.bountyCounter.toNumber() + 1;
  const [bountyPDA] = findBountyPDA(publicKey, nextBounty);
  const [vaultPDA] = findVaultPDA(bountyPDA);
  const creatorBioAta = await getAssociatedTokenAddress(BIO_MINT, publicKey);

  const tx = await program.methods
    .createBounty(
      description,
      new BN(rewardAmount),
      new BN(deadline)
    )
    .accountsPartial({
      creator: publicKey,
      protocolState: protocolStatePDA,
      bounty: bountyPDA,
      vault: vaultPDA,
      creatorUsdcAta: creatorBioAta,
      usdcMint: BIO_MINT,
      tokenProgram: TOKEN_PROGRAM_ID,
      associatedTokenProgram: ASSOCIATED_TOKEN_PROGRAM_ID,
      systemProgram: SystemProgram.programId,
    })
    .rpc();
  ```

  ```rust Anchor Instruction (lib.rs) theme={null}
  pub fn create_bounty(
      ctx: Context<CreateBounty>,
      description: [u8; 256],
      reward_amount: u64,
      deadline: i64,
  ) -> Result<()> {
      require!(reward_amount > 0, ErrorCode::InvalidRewardAmount);

      let state = &mut ctx.accounts.protocol_state;
      state.bounty_counter += 1;

      // Transfer BIO to vault
      transfer_checked(
          CpiContext::new(
              ctx.accounts.token_program.to_account_info(),
              TransferChecked {
                  from: ctx.accounts.creator_usdc_ata.to_account_info(),
                  to: ctx.accounts.vault.to_account_info(),
                  authority: ctx.accounts.creator.to_account_info(),
                  mint: ctx.accounts.usdc_mint.to_account_info(),
              },
          ),
          reward_amount,
          6, // BIO decimals
      )?;

      let bounty = &mut ctx.accounts.bounty;
      bounty.creator = ctx.accounts.creator.key();
      bounty.bounty_number = state.bounty_counter;
      bounty.description = description;
      bounty.reward_amount = reward_amount;
      bounty.BIO_mint = ctx.accounts.usdc_mint.key();
      bounty.vault = ctx.accounts.vault.key();
      bounty.deadline = deadline;
      bounty.status = 0; // Open
      bounty.created_at = Clock::get()?.unix_timestamp;

      emit!(BountyCreated {
          bounty_number: state.bounty_counter,
          creator: ctx.accounts.creator.key(),
          reward_amount,
          deadline,
      });

      Ok(())
  }
  ```
</CodeGroup>

## Submit to a Bounty

If you have an NKA that matches a bounty's requirements, you can submit it for review.

<Steps>
  ### Find a Matching Bounty

  Browse the [Market](/market) page for open bounties. Click a bounty card to view details.

  ### Submit Your NKA

  On the bounty detail page (`/market/:bountyId`), click **"Submit NKA"**.

  Select your NKA from the modal (only NKAs you own are shown).

  Click **Submit**.

  ### Approval

  Phantom prompts for approval. This creates a `BountySubmission` PDA linking your NKA to the bounty and transitions the bounty status to **Matched**.

  ### Await Review

  The bounty creator will review your submission and either:

  1. **Approve:** You receive `reward_amount * 0.975` BIO (2.5% protocol fee)
  2. **Close:** Creator closes the bounty and reclaims escrowed BIO
</Steps>

## View Your NKAs

All submitted NKAs are browsable on the [Dashboard](/dashboard). Click an NKA card to view full details including:

* Specimen number (e.g., `NKA-0042`)
* Researcher public key
* Full hypothesis, methodology, outcomes
* P-value and sample size
* Data hash (if provided)
* Timestamp and status
* Solana Explorer link

## Protocol Fee Structure

When a bounty is fulfilled:

* **Researcher payout:** 97.5% of reward amount
* **Protocol fee:** 2.5% (250 basis points)
* **Fee recipient:** Treasury wallet (set during protocol initialization)

Example for 500 BIO bounty:

* Researcher receives: **487.5 BIO**
* Treasury receives: **12.5 BIO**

## Account Structure

NullGraph uses four main account types, all stored as PDAs:

| Account            | Seeds                                          | Description                                 |
| ------------------ | ---------------------------------------------- | ------------------------------------------- |
| `ProtocolState`    | `["protocol_state"]`                           | Singleton with counters, fee rate, treasury |
| `NullResult`       | `["null_result", researcher, specimen_number]` | One per NKA                                 |
| `NullBounty`       | `["null_bounty", creator, bounty_number]`      | One per bounty                              |
| `BountySubmission` | `["bounty_submission", bounty, null_result]`   | Links NKA to bounty                         |
| Vault              | `["bounty_vault", bounty_pda]`                 | Token account holding escrowed BIO          |

## Common Workflows

### Researcher Journey

1. Connect wallet (devnet)
2. Submit NKA with negative result data
3. Browse Market for matching bounties
4. Submit NKA to bounty
5. Receive BIO payout upon approval

### BioDAO Journey

1. Connect wallet (devnet)
2. Acquire BIO tokens
3. Create bounty describing needed null result
4. BIO tokens escrowed to vault
5. Review submissions from researchers
6. Approve matching submission (triggers payout)
7. Or close bounty (reclaim escrowed BIO)

## Next Steps

* Explore [Core Concepts](/core-concepts/nka) to understand NKAs in depth
* Learn about the [Bounty Marketplace](/core-concepts/bounties)
* Review [API Reference](/api-reference/instructions) for all program instructions
* Check [Frontend Integration](/frontend/hooks) for custom integrations

<Note>
  NullGraph is currently deployed to Solana Devnet. All transactions use test tokens and devnet SOL. No real value is at risk.
</Note>
