> 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/build/sdk-quickstart.md). Agents can also search and read this documentation through its [MCP server](https://docs.minervachain.org/~gitbook/mcp).

# SDK quickstart

The TypeScript SDK gives you Minerva network metadata, a viem-based client, ML-DSA-65 account creation, balance and account-state reads, and native transaction signing and submission.

## Packages

| Package                        | Version | Purpose                                                                            |
| ------------------------------ | ------- | ---------------------------------------------------------------------------------- |
| `@minervaquantum/sdk`          | 0.4.0   | the client, accounts, balances and transactions; depends on the two below          |
| `@minervaquantum/chain-config` | 0.2.0   | chain ids, RPC and explorer URLs, genesis hashes, `wallet_addEthereumChain` params |
| `@minervaquantum/pq-native-tx` | 0.1.2   | the `MinervaPQTxV1` encoder and signer, ML-DSA-65 key handling, release signing    |

All three are ESM only and need Node 20 or newer. They contain public metadata and code only: no keys, no server configuration.

```sh
npm install @minervaquantum/sdk viem
# or
pnpm add @minervaquantum/sdk viem
```

## Read the chain

```ts
import { createMinervaClient, getMrvBalance } from "@minervaquantum/sdk";

const client = createMinervaClient({ networkName: "mainnet" }); // "testnet" for 77138

const block = await client.getBlockNumber();
const vault = await getMrvBalance(client, "0x0000000000000000000000000000000000000303");

console.log({ block, vaultMrv: vault / 10n ** 18n });
```

`createMinervaClient` returns a viem public client pointed at the network's public RPC, so every viem read method (`getBlock`, `readContract`, `getLogs`, `estimateGas`) works unchanged. A client created without `networkName` targets the **testnet** in this release; always pass the name explicitly.

## Create an account

```ts
import { createPQAccount } from "@minervaquantum/sdk";

const account = createPQAccount();
console.log(account.address);   // 0x…, the same on every Minerva network
// account.publicKey (1,952 bytes), account.privateKey: store the private key securely
```

The address is derived from the public key with the canonical factory and a zero salt. Nothing is sent to the chain; the account can receive MRV immediately. If you need to derive an address from an existing key, use `deriveMinervaPQAccountAddress(publicKey)` from `@minervaquantum/pq-native-tx`.

## Send MRV

```ts
import { createMinervaClient, sendPQTransaction } from "@minervaquantum/sdk";

const client = createMinervaClient({ networkName: "mainnet" });

const gas = await client.estimateGas({
  account: account.address,
  to: "0x000000000000000000000000000000000000dEaD",
  value: 10n ** 18n,
});

const txHash = await sendPQTransaction(client, {
  nonce: await client.getTransactionCount({ address: account.address }),
  gasTipCap: 1_000_000_000n,
  gasFeeCap: 2_000_000_000n,
  gas: (gas * 13n) / 10n,          // 30 % headroom over the estimate
  to: "0x000000000000000000000000000000000000dEaD",
  value: 10n ** 18n,               // 1 MRV
  pqPublicKey: account.publicKey,
  pqPrivateKey: account.privateKey,
});

const receipt = await client.waitForTransactionReceipt({ hash: txHash });
console.log(receipt.status, receipt.blockNumber);
```

The SDK signs a `MinervaPQTxV1`, submits it through the node's `eth_sendRawTransaction`, and returns the hash. The account pays gas in MRV, so fund it first (bridge MRV in, or on the testnet use the faucet). Use an estimate for `gas`: a native transaction carries a 1,952-byte key and a 3,309-byte signature and costs far more than 21,000 gas.

## Chain metadata only

```ts
import {
  minervaMainnet,
  minervaTestnet,
  MINERVA_MAINNET_RPC_URL,
  MINERVA_MAINNET_GENESIS_HASH,
  walletAddEthereumChainParams,
} from "@minervaquantum/chain-config";

console.log(minervaMainnet.chainId);                       // 77139
console.log(walletAddEthereumChainParams(minervaMainnet)); // for wallet_addEthereumChain
```

`getConfiguredMinervaNetwork("mainnet")` and `getMinervaNetworkByChainId(77139)` resolve the same config, and `MINERVA_NETWORK=mainnet` selects it in services that read the environment.

## Next

* [Send a PQ transaction](https://docs.minervachain.org/build/send-pq-transaction.md) covers signing without the SDK client and submitting through the public relayer.
* [Integrate a dapp](https://docs.minervachain.org/build/dapp-integration.md) covers the browser provider.


---

# 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/build/sdk-quickstart.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.
