AI Mine
Scanned@nancyuahon
npx machina-cli add skill @nancyuahon/aimine --openclawAI Mine (PoAIW) — OpenClaw Skill
This skill lets users install, configure, and start/stop AIT mining entirely from OpenClaw. All actions are performed by the agent via Exec; the user never needs to open a terminal or edit files manually.
Supported user intents (English trigger phrases):
- Install — e.g. "install AIT mining", "set up AIT miner", "install the miner"
- Configure — e.g. "configure AIT mining", "configure mining", "set up my keys"
- Start mining — e.g. "start mining", "start AIT mining", "begin mining"
- Stop mining — e.g. "stop mining", "stop AIT mining"
- Mining status — e.g. "mining status", "status", "how is mining doing"
- Balance — e.g. "AIT balance", "check balance", "my AIT balance"
Conventions:
AIMINE_DIR: base directory for the repo; default~/PoAIW. Miner directory is$AIMINE_DIR/miner.- Port for the miner web API:
3000(localhost only). - Keys: user can set
PRIVATE_KEYand eitherOPENAI_KEYorOPENAI_API_KEYin OpenClaw skill config (env injection), or provide them once in chat. The miner accepts both env var names for the OpenAI key. Then the agent runs init with those values.
When the user wants to INSTALL the miner
Run (use AIMINE_DIR if set, else default to $HOME/PoAIW):
AIMINE_DIR=${AIMINE_DIR:-$HOME/PoAIW}
[ -d "$AIMINE_DIR/.git" ] || git clone https://github.com/AIMineRes/PoAIW.git "$AIMINE_DIR"
cd "$AIMINE_DIR/miner" && npm install
Do not ask the user to open a terminal or run these manually.
When the user wants to CONFIGURE mining
The user must have provided wallet private key and OpenAI API key (either in OpenClaw skill config as PRIVATE_KEY and OPENAI_KEY or OPENAI_API_KEY, or in the conversation). If users get "invalid API key", have them check: no leading/trailing spaces, key starts with sk-, and if using OpenClaw config try setting OPENAI_API_KEY (some UIs use that name).
-
If keys are in environment (e.g. injected by OpenClaw skill config): run
cd "$AIMINE_DIR/miner" && npx ts-node src/index.ts init --from-env
(ensure AIMINE_DIR is set or use $HOME/PoAIW/miner). -
If the user provided keys in the message: run
cd "$AIMINE_DIR/miner" && npx ts-node src/index.ts init --private-key <key> --openai-key <key>
using the keys they provided. Do not echo the keys back in full.
Do not ask the user to manually edit .env or openclaw.json.
When the user wants to START mining
Run the one-shot script so that the web server is started in the background if needed, then the API is called. Do not tell the user to "run npm run web first".
cd "${AIMINE_DIR:-$HOME/PoAIW}/miner" && node scripts/start-mining.js
If AIMINE_DIR is not set, use $HOME/PoAIW (or equivalent on the host). The script will start the web server on port 3000 if it is not already listening, wait a few seconds, then POST to http://127.0.0.1:3000/api/start.
When the user wants to STOP mining
Run:
curl -s -X POST http://127.0.0.1:3000/api/stop
When the user wants MINING STATUS
Run:
curl -s http://127.0.0.1:3000/api/status
Then summarize the JSON (miningActive, blocksMined, tokenBalance, bnbBalance, hashRate) in a short reply.
When the user wants AIT BALANCE (wallet / mining stats)
Run:
cd "${AIMINE_DIR:-$HOME/PoAIW}/miner" && npx ts-node src/index.ts balance
Summarize the output for the user.
Summary
- Install: clone repo into AIMINE_DIR (default ~/PoAIW), then
cd miner && npm install. - Configure:
ai-mine init --from-env(if keys in env) orai-mine init --private-key ... --openai-key ...(if user gave keys in chat). - Start:
node scripts/start-mining.jsin the miner directory (no need for user to run npm run web). - Stop:
curl -s -X POST http://127.0.0.1:3000/api/stop. - Status:
curl -s http://127.0.0.1:3000/api/status. - Balance:
npx ts-node src/index.ts balancein the miner directory.
Always use the miner directory as $AIMINE_DIR/miner with AIMINE_DIR defaulting to ~/PoAIW when not set.
Overview
AI Mine lets you install, configure, and control AIT mining entirely from OpenClaw. It performs all actions via Exec, so you never need to open a terminal or edit files manually. The miner runs locally with a web API on port 3000 and supports PRIVATE_KEY and either OPENAI_KEY or OPENAI_API_KEY for setup.
How This Skill Works
The skill manages the PoAIW miner inside a default directory (~/PoAIW) with a miner subfolder. It clones the repo when needed, runs npm install, and initializes the miner either from environment keys or from keys provided in chat, using ts-node. Mining is controlled through a local web API (port 3000) and actions are executed by the OpenClaw Exec engine, including start, stop, and status checks.
When to Use It
- Install the POAIW AIT miner for the first time from OpenClaw
- Configure mining by supplying PRIVATE_KEY and OPENAI_KEY or OPENAI_API_KEY
- Start mining and have the agent spin up the web server and API
- Stop mining when you want to pause or end mining
- Check mining status or balance via the API endpoints
Quick Start
- Step 1: Install the miner: AIMINE_DIR=${AIMINE_DIR:-$HOME/PoAIW}; [ -d "$AIMINE_DIR/.git" ] || git clone https://github.com/AIMineRes/PoAIW.git "$AIMINE_DIR"; cd "$AIMINE_DIR/miner" && npm install
- Step 2: Configure mining: If keys are in env, run ai-mine init --from-env; else run ai-mine init --private-key <key> --openai-key <key> (do not echo keys back in chat)
- Step 3: Start mining: cd "${AIMINE_DIR:-$HOME/PoAIW}/miner" && node scripts/start-mining.js
Best Practices
- Keep PRIVATE_KEY and OPENAI keys secure; prefer env-injected keys via OpenClaw config
- Verify AIMINE_DIR and miner path before running actions
- Do not echo or share keys in chat or logs
- Use local host (port 3000) and avoid exposing the miner to the public internet
- Validate keys (no leading/trailing spaces; OpenAI keys start with sk-)
Example Use Cases
- Install the PoAIW miner into the default directory and run npm install
- Configure mining by providing PRIVATE_KEY and OPENAI_KEY in the chat
- Start mining; the agent starts the web server on port 3000 and calls the API
- Query mining status and receive JSON with miningActive, blocksMined, tokenBalance, bnbBalance, hashRate
- Check AIT balance via the balance command and summarize results