> For the complete documentation index, see [llms.txt](https://docs.minervachain.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.minervachain.org/protocol/hash-based-accounts.md). Agents can also search and read this documentation through its [MCP server](https://docs.minervachain.org/~gitbook/mcp).

# Hash-based accounts (MHL-1)

A Minerva account can be controlled by one of two post-quantum key types, chosen when the account is created:

|                                      | ML-DSA-65                   | Hash-based (MHL-1)                |
| ------------------------------------ | --------------------------- | --------------------------------- |
| Security rests on                    | lattice problems (FIPS 204) | the hash function keccak256 alone |
| Signs                                | transactions and messages   | transactions only                 |
| Signatures per key                   | unlimited                   | 65,536, then the key is rotated   |
| Device keys                          | yes                         | yes (device keys are ML-DSA-65)   |
| Algorithm id in a `0x4D` transaction | 1                           | 2                                 |

Both are verified by consensus on every transaction. A hash-based account exists for people who want their funds to depend on as few assumptions as possible: if a weakness is ever found in lattice-based signatures, a hash-based account is unaffected.

## Availability

Hash-based accounts arrive with the `minervaHashLadder` network upgrade.

| Network         | Activation                                                                   |
| --------------- | ---------------------------------------------------------------------------- |
| Minerva Testnet | block 307,000                                                                |
| Minerva mainnet | not scheduled; it will be announced with a signed release and a block number |

Minerva Wallet offers the key type under **Create account** on any network where the upgrade is active.

## How it works

MHL-1 is a hash-based signature scheme built like XMSS (RFC 8391): Winternitz one-time keys at the leaves of a Merkle tree, two tree layers of height 8, keccak256 throughout. A signature is 4,804 bytes and proves knowledge of one one-time key under the account's 64-byte public key.

A one-time key must never sign two different messages. Minerva makes that a consensus rule instead of trusting the wallet: the account key carries a `startNonce`, and the leaf a transaction uses must equal the account's nonce minus `startNonce`. An account nonce never goes down, so no leaf can be used twice on chain, even by a wallet restored from its seed alone.

The full specification is in the network repository: `docs/architecture/hash-ladder-accounts.md`.

## What a wallet does for you

Two rules keep a hash-based key safe before a transaction is mined. Minerva Wallet follows both:

* **A pending transaction is never replaced.** Speeding up or cancelling a pending transaction would put two signatures on one one-time key in public. The wallet sets one fee with headroom, keeps every signed transaction until it is mined, and rebroadcasts the same bytes if needed. Use one device per hash-based account.
* **Rotation is exact.** When a key is rotated, the new key starts at the rotation transaction's nonce plus one. The wallet signs the rotation only at the nonce it built the new key for.

The Security screen shows how many signatures the current key has left. Rotate before it reaches zero; the address stays the same, and the first rotation also deploys the account contract.

## For developers

* Algorithm 2 transactions: `signMinervaPQTxV1` in `@minervaquantum/pq-native-tx` with `pqAlgorithm: 2`, a 72-byte `pqPublicKey` from `mhl1AccountKey(seed, startNonce)`, and the `mhl1Seed`. The SDK derives the leaf from the nonce and refuses unsafe requests.
* Counterfactual address: `deriveMinervaHashLadderAccountAddress(accountKey)`, a CREATE2 address from the factory at `0x0000000000000000000000000000000000000206`.
* Verifying MHL-1 in a contract: the precompile at `0x0000000000000000000000000000000000004D02`, same ABI as the ML-DSA-65 verifier, 60,000 gas. A hash-based account does not implement EIP-1271 signatures.


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.minervachain.org/protocol/hash-based-accounts.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
