> For the complete documentation index, see [llms.txt](https://docs.mineglyph.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mineglyph.xyz/getting-started/how-it-works.md).

# How it works

A blockchain contract cannot read a wallet's history — Solidity only sees current state, recent block hashes, the block number, and the timestamp. So Mine Glyph computes hashrate **off-chain** and proves it **on-chain** with a signature.

## The flow, end to end

```
┌──────────┐  reads history   ┌──────────┐  EIP-712 sign   ┌──────────┐  submit sig  ┌──────────────┐
│ Indexer  │ ───────────────► │  Signer  │ ──────────────► │ Frontend │ ───────────► │ GlyphMining  │
│ off-chain│  age/tx/vol/hold │ off-chain│ (wallet, hr, …) │ (your UI)│              │  (contract)  │
└──────────┘                  └──────────┘                 └──────────┘              │ verify + mint│
                                                                                     └──────────────┘
```

1. **Indexer** reads your wallet's history from the chain and computes your hashrate with the public log-scaled formula.
2. **Signer** signs a message — `(wallet, hashrate, epoch, nonce, expiry)` — with a trusted key, using EIP-712 typed data bound to the specific contract and chain.
3. **You** submit that signed attestation to the `GlyphMining` contract from your own wallet.
4. **The contract** verifies the signature (`ecrecover == signer`), checks it isn't expired or replayed, then records your hashrate and starts streaming rewards.

The contract **never trusts a hashrate that did not arrive through a valid signature.** A forged or edited number is rejected on-chain.

## What you actually do

Connecting your wallet is **free** — it is not a transaction. Mining involves two kinds of on-chain transactions that you sign and pay gas for:

* **Start mining** — one transaction that registers your hashrate. It charges a small one-time [registration fee](/protocol/fees-and-cooldown.md). After this, rewards accrue **every second automatically** with no further transactions.
* **Claim** — a transaction that mints your accrued GLYPH to your wallet. Subject to a [claim cooldown](/protocol/fees-and-cooldown.md).

## Why the epoch snapshot matters

Your metrics are measured against the **start of the current epoch**, not the live moment. This prevents last-minute activity from inflating a score — you can't spam transactions right before registering and instantly rank up. Within an epoch your score is deterministic.

## The trust boundary

The only trusted off-chain component is the **signer**. It recomputes your hashrate server-side on every request and never signs a number supplied by a client. If the signer key were ever compromised, the protocol owner can rotate it on-chain. Everything else — reward math, the hard cap, replay protection — is enforced by the contract itself. See [Security model](/security/security-model.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.mineglyph.xyz/getting-started/how-it-works.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
