> ## Documentation Index
> Fetch the complete documentation index at: https://docs.aultblockchain.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run a Licensed Mining Node

The Ault miner client uses VRF-based mining with micro proof-of-work checks.

## Quick Start

### 1) Build

```bash theme={null}
cd miner
make build
```

### 2) Generate VRF key

```bash theme={null}
./aultmined vrfkeygen
```

### 3) Configure environment

```bash theme={null}
export CHAIN_GRPC="test-grpc.cloud.aultblockchain.xyz:9090"
export CHAIN_RPC="https://test-rpc.cloud.aultblockchain.xyz"
export CHAIN_ID="ault_10904-1"
```

Provide `MINER_OPERATOR_KEY` and `MINER_VRF_KEY` through a secret manager or protected service environment. Do not `export` raw private keys in an interactive shell or commit them to an env file.

### 4) Register VRF key

```bash theme={null}
./aultmined set-key
```

### 5) Start mining

```bash theme={null}
./aultmined mine --yes
```

## Core commands

* `aultmined keygen`
* `aultmined vrfkeygen`
* `aultmined set-key`
* `aultmined mine`
* `aultmined mine --yes`

## Key environment variables

* `MINER_OPERATOR_KEY`: secp256k1 operator private key. Inject it as a secret, not via interactive `export`.
* `MINER_VRF_KEY`: Ed25519 VRF private key. Inject it as a secret, not via interactive `export`.
* `CHAIN_GRPC`: gRPC endpoint
* `CHAIN_RPC`: RPC endpoint
* `CHAIN_ID`: chain ID
* `MINER_BATCH_SIZE`: max submissions per batch
* `MINER_DISABLE_DB`: disable SQLite if needed
* `MINER_DATA_DIR`: key/data directory

If neither `MINER_OPERATOR_KEY` nor `MINER_VRF_KEY` is set, auto mode can generate keys.

## How mining works

1. Monitor epochs
2. Compute VRF output
3. Check threshold
4. Solve micro-PoW
5. Batch-submit wins

## Operator mode (delegated licenses)

```bash theme={null}
# Register operator with commission
aultd tx miner register-operator 10 --from <your-key>

# License owners delegate
aultd tx miner delegate-mining <operator-addr> <license-ids...> --from <license-owner>

# Miner detects delegated licenses and mines
aultmined mine --yes
```

## Troubleshooting

* Stuck on "awaiting delegation": confirm delegated licenses on-chain
* VRF registration retries: usually resolves after valid delegation/key setup
* Health check failures: verify gRPC/RPC connectivity
* Key persistence issues: verify the storage mount or data directory

## Security Notice

⚠️ **Never expose your private keys.**

If your deployment uses the following environment variables, treat them as secrets:

* `MINER_OPERATOR_KEY`
* `MINER_VRF_KEY`

Do not:

* Commit them to version control
* Share them in screenshots or logs
* Store them in plaintext in production servers
* Export them in an interactive shell
* Use them directly in shell history

For production setups, it is strongly recommended to:

* Use a secure key management system
* Isolate the miner in a dedicated environment
* Restrict server access
* Avoid storing raw private keys in shared environments

If your operator private key is exposed, your mining rewards and delegated licenses may be at risk.
