CLI Reference

Complete reference for the CLAWING command-line interface. The CLI provides full control over the mining process, from initialization to automated mining.


Installation

git clone https://github.com/Cliai21/clawing.git
cd clawing
npm install

All commands are run via npx claw <command>.


Commands

claw init

Initialize the miner configuration. Creates a .env file with the required template.

npx claw init

Behavior:

  • Creates .env from the default template if it doesn't exist

  • Prompts for required values (private key, AI API key) in interactive mode

  • Sets secure file permissions (chmod 600 .env)

  • Validates the Ethereum RPC connection

Options:

Flag
Description

--non-interactive

Skip prompts; use defaults and env vars

--rpc <url>

Set a custom Ethereum RPC URL

--model <name>

Override the default AI model

Example:


claw status

Display the current mining status for your configured wallet.

Output:

Options:

Flag
Description

--json

Output in JSON format

--no-oracle

Skip Oracle health check

Example:


claw mine

Execute a single mining claim. Generates AI content, obtains an Oracle attestation, and submits the on-chain transaction.

Process:

  1. Check cooldown status — abort if not ready

  2. Check epoch claim limit — abort if 14 claims reached

  3. Request nonce from Oracle

  4. Generate AI content using the configured model

  5. Submit content to Oracle for attestation

  6. Receive signed attestation

  7. Estimate gas and submit on-chain transaction

  8. Wait for transaction confirmation

  9. Report minted $CLAW amount

Output:

Options:

Flag
Description

--dry-run

Simulate the mining process without submitting on-chain

--gas-limit <gwei>

Set maximum gas price (overrides MAX_GAS_GWEI)

--verbose

Show detailed logging including API responses

--no-wait

Submit transaction without waiting for confirmation

Example:


claw auto

Start automated mining mode. Continuously monitors cooldown and claims when ready.

Behavior:

  • Polls cooldown status at regular intervals

  • Automatically initiates a claim when the cooldown has elapsed

  • Respects the 14-claim epoch limit

  • Logs all activity to ./logs/mining.log

  • Gracefully handles errors and retries

Output:

Options:

Flag
Description

--poll-interval <sec>

Polling interval in seconds (default: 60)

--max-gas <gwei>

Maximum gas price — skip claim if gas exceeds this

--log-file <path>

Custom log file path

--quiet

Minimal console output

Example:


Environment Variables

All configuration is managed via the .env file or system environment variables. Environment variables take precedence over .env values.

Required Variables

Variable
Description
Example

PRIVATE_KEY

Ethereum wallet private key

0xabcd...1234

AI_API_KEY

API key for the mining AI model

xai-...

Optional Variables

Variable
Default
Description

ETH_RPC_URL

Public endpoint

Ethereum RPC provider URL

ORACLE_URL

https://oracle.minewithclaw.com

Oracle server URL

AI_MODEL

grok-4.1-fast

AI model identifier

GAS_STRATEGY

auto

Gas pricing: auto, fast, standard, slow

MAX_GAS_GWEI

50

Maximum gas price in gwei

LOG_LEVEL

info

Logging verbosity: debug, info, warn, error

LOG_FILE

./logs/mining.log

Log file path

POLL_INTERVAL

60

Auto-mine polling interval (seconds)

Gas Strategies

Strategy
Description

auto

Use the provider's suggested gas price

fast

Priority fee for faster confirmation (~15 seconds)

standard

Normal fee for typical confirmation (~30 seconds)

slow

Minimum fee; may take several minutes


Exit Codes

Code
Meaning

0

Success

1

General error

2

Configuration error (missing env vars)

3

Cooldown not met

4

Epoch claim limit reached

5

Oracle error

6

On-chain transaction failed

7

Insufficient ETH for gas

8

AI API error


Logging

All mining activity is logged to ./logs/mining.log by default. Log entries include:

Configure log level with the LOG_LEVEL environment variable:

Level
Output

debug

Everything including API payloads

info

Claims, rewards, errors

warn

Warnings and errors only

error

Errors only


Scripting Examples

Cron Job (Mine Every 12 Hours)

Check Status from Script

Monitor with Watch

Next Steps

Last updated