# @cosmjs/faucet Agent Guide

> **Package**: `@cosmjs/faucet` v0.38.0 **Purpose**: Token faucet server
> application **Layer**: Application Layer

## Package Overview

A production-ready faucet server for distributing tokens on Cosmos SDK chains.
Includes rate limiting, concurrent distribution, and credit tracking.

### Key Features

- **HTTP API**: Simple REST endpoints
- **Rate Limiting**: Cooldown periods per address
- **Concurrent Distribution**: Multiple distributor accounts
- **Credit Tracking**: Monitor distribution history
- **Docker Support**: Ready for deployment

## Configuration

### Environment Variables

| Variable                | Default          | Description            |
| ----------------------- | ---------------- | ---------------------- |
| `FAUCET_MNEMONIC`       | (required)       | BIP-39 mnemonic        |
| `FAUCET_ADDRESS_PREFIX` | `"cosmos"`       | Bech32 prefix          |
| `FAUCET_GAS_PRICE`      | `"0.025ucosm"`   | Gas price              |
| `FAUCET_GAS_LIMIT`      | `100000`         | Gas limit              |
| `FAUCET_CONCURRENCY`    | `5`              | Number of distributors |
| `FAUCET_PORT`           | `8000`           | HTTP port              |
| `FAUCET_TOKENS`         | `"ucosm,ustake"` | Tokens to distribute   |
| `FAUCET_COOLDOWN_TIME`  | `86400`          | Cooldown (seconds)     |
| `FAUCET_MEMO`           | `undefined`      | Transaction memo       |

## Running the Faucet

### Using npm

```bash
npm install -g @cosmjs/faucet

export FAUCET_MNEMONIC="your mnemonic here"
export FAUCET_ADDRESS_PREFIX="cosmos"
export FAUCET_TOKENS="uatom,ustake"

cosmos-faucet start "https://rpc.cosmos.network"
```

### Using Docker

```bash
docker run -p 8000:8000 \
  -e FAUCET_MNEMONIC="your mnemonic" \
  -e FAUCET_ADDRESS_PREFIX="cosmos" \
  cosmjs/faucet:latest \
  start "https://rpc.cosmos.network"
```

## API Endpoints

### POST /credit

Request tokens for an address.

```bash
curl -X POST http://localhost:8000/credit \
  -H "Content-Type: application/json" \
  -d '{"address": "cosmos1..."}'
```

Response:

```json
{
  "status": "ok",
  "transactionHash": "ABC123..."
}
```

### GET /status

Get faucet status and balances.

```bash
curl http://localhost:8000/status
```

---

**Last Updated**: January 6, 2026 **Package Version**: 0.38.0


