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

# Get Started

#### Prerequisites

* **Node.js** 18 or higher
* **npm** or **yarn**
* (Optional) **Solana CLI** for local dev and key management

#### Installation

**Option A: Global install (recommended for CLI use)**

```bash
npm install -g @eternallabs/netauth
```

Then run the CLI from anywhere:

```bash
netauth --help
netauth agent register my-agent
```

**Option B: Local / project install**

```bash
git clone https://github.com/eternal-labs/net-auth.git
cd net-auth
npm install
```

Use the CLI via npm script:

```bash
npm run netauth -- --help
```

#### Configuration

1. Copy the example environment file:

   ```bash
   cp .env.example .env
   ```
2. Edit `.env` with your values:

   | Variable         | Description                                                      | Required                              |
   | ---------------- | ---------------------------------------------------------------- | ------------------------------------- |
   | `SOLANA_RPC_URL` | Solana RPC endpoint (e.g. `https://api.mainnet-beta.solana.com`) | Yes (for live)                        |
   | `NETWORK`        | `mainnet-beta`, `devnet`, or `testnet`                           | No (default: mainnet-beta)            |
   | `ENCRYPTION_KEY` | Secret used to encrypt wallet private keys                       | **Yes** (for wallet creation)         |
   | `PORT`           | HTTP port for the API server                                     | No (default: 3000)                    |
   | `X402_ENDPOINT`  | x402 protocol endpoint                                           | No (optional; fallback used if unset) |
   | `X402_API_KEY`   | API key for x402 service                                         | No (if using x402 endpoint)           |
3. **Important**: Without `ENCRYPTION_KEY`, the server will not start (wallet creation requires it). The CLI can still show help without it.

#### Running the Server

**Development (with watch):**

```bash
npm run dev
```

**Production:**

```bash
npm run build
npm start
```

The API is available at `http://localhost:3000` (or your configured `PORT`). Health check:

```bash
curl http://localhost:3000/health
```

#### Quick Start Flow

1. Start the server (with `ENCRYPTION_KEY` set).
2. Register two agents:

   ```bash
   netauth agent register alice
   netauth agent register bob
   ```
3. Check balance:

   ```bash
   netauth agent balance alice --sol
   ```
4. Send a payment:

   ```bash
   netauth payment send alice bob 0.1 --sol --memo "First payment"
   ```
5. View history:

   ```bash
   netauth payment history alice
   ```

***
