
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
Modern TypeScript CGMiner API library for Bitcoin miners. Zero dependencies, works with any CGMiner-compatible miner. Includes Avalon-specific extensions for firmware upgrade and MM3 features.
Modern TypeScript CGMiner API Library - Zero Dependencies
A comprehensive, production-ready TypeScript library for communicating with any CGMiner-compatible Bitcoin miner. Works with Avalon, Antminer, and other CGMiner-based miners. Includes Avalon-specific extensions for firmware upgrade and MM3 features.
Key Features:
This is a modern TypeScript port of the original Python library, generalized to support all CGMiner-compatible miners while maintaining Avalon-specific functionality.
npm install fms-core
import { CGMinerAPI } from 'fms-core';
// Works with any CGMiner-compatible miner (Avalon, Antminer, etc.)
const ip = '192.168.1.123';
const port = 4028;
// Get miner version
const version = await CGMinerAPI.aioVersion(ip, port);
if (version.isRequestSuccess()) {
const versionData = version.version();
console.log('Version:', versionData);
}
// Get miner summary (hash rate, accepted/rejected shares, etc.)
const summary = await CGMinerAPI.summary(ip, port);
if (summary.isRequestSuccess()) {
const summaryData = summary.summary();
console.log('Hash Rate:', summaryData?.[0]?.['GHS 5s']);
console.log('Accepted:', summaryData?.[0]?.Accepted);
console.log('Rejected:', summaryData?.[0]?.Rejected);
}
// Get pool information
const pools = await CGMinerAPI.pools(ip, port);
console.log('Pools:', pools.pools());
// Get device information
const devices = await CGMinerAPI.edevs(ip, port);
console.log('Devices:', devices.edevs());
// Get extended statistics
const stats = await CGMinerAPI.estats(ip, port);
console.log('Stats:', stats.estats());
// Pool management (add, remove, switch, enable, disable)
await CGMinerAPI.addPool(ip, port, 'stratum+tcp://pool.example.com:3333', 'user', 'pass');
await CGMinerAPI.switchPool(ip, port, 0); // Switch to pool 0
await CGMinerAPI.enablePool(ip, port, 0);
await CGMinerAPI.disablePool(ip, port, 1);
// Import Avalon extensions
import { upgradeFirmware } from 'fms-core/avalon';
// or
import { upgradeFirmware } from 'fms-core';
// Get Avalon-specific version info (MM3 helpers)
const version = await CGMinerAPI.aioVersion('192.168.1.123');
if (version.isRequestSuccess()) {
console.log('Software Version:', version.mm3SoftwareVersion());
console.log('MAC Address:', version.mm3Mac());
console.log('DNA:', version.mm3Dna());
console.log('Model:', version.mm3Model());
console.log('Hardware Type:', version.mm3HardwareType());
}
// Upgrade Avalon miner firmware (AUP format)
const [success, result] = await upgradeFirmware(
'192.168.1.123',
4028,
'/path/to/firmware.aup',
720 // timeout in seconds
);
// Avalon-specific commands
await CGMinerAPI.rebootMm3('192.168.1.123', 4028);
await CGMinerAPI.mm3SetWorkmode('192.168.1.123', 4028, 0, 0, 0);
After installation, a script command fmsc will be available. Get help by:
npx fmsc -h
Upgrade firmware:
npx fmsc upgrade --ip 192.168.1.123 --file firmware.aup --port 4028 --timeout 720
Main API class for communicating with any CGMiner-compatible miner.
aioVersion(ip, port?, firstTimeout?, retry?) - Get miner version informationsummary(ip, port?, firstTimeout?, retry?) - Get miner summary (hash rate, shares, etc.)pools(ip, port?, firstTimeout?, retry?) - Get pool configurationedevs(ip, port?, firstTimeout?, retry?) - Get device informationestats(ip, port?, firstTimeout?, retry?) - Get extended statisticsaddPool(ip, port, url, user, pass, ...) - Add a mining poolremovePool(ip, port, poolId) - Remove a poolswitchPool(ip, port, poolId) - Switch to a different poolenablePool(ip, port, poolId) - Enable a pooldisablePool(ip, port, poolId) - Disable a poolconfig(ip, port, ...) - Configure miner settingstoggleLED(ip, devId, modId, port?, firstTimeout?, retry?) - Toggle LED (if supported)turnLED(ip, devId, modId, turnOn, port?, firstTimeout?, retry?) - Turn LED on/off (if supported)rebootMm3(ip, lastWhen?, port?, firstTimeout?, retry?) - Reboot Avalon minermm3SetWorkmode(ip, port, devId, modId, workmode, ...) - Set Avalon work modemm3Upgrade(ip, port, ...) - Avalon firmware upgrade commandmm3SoftwareVersion() - Get Avalon software version (helper method on CGMinerAPIResult)mm3Mac() - Get Avalon MAC address (helper method)mm3Dna() - Get Avalon DNA (helper method)mm3Model() - Get Avalon model (helper method)mm3HardwareType() - Get Avalon hardware type (helper method)fms-core/avalon)Upgrade Avalon miner firmware (AUP format).
async function upgradeFirmware(
ip: string,
port: number,
firmwareFilePath: string,
timeout?: number
): Promise<[boolean, UpgradeResults]>
Parse and validate Avalon firmware files (AUP format).
import { AUPFile } from 'fms-core/avalon';
const aupFile = new AUPFile('/path/to/firmware.aup');
Option 1: Using Environment Variables (Recommended)
.env.example to .env: cp .env.example .env.env and add your miner IPsnpm run test:minersOption 2: Direct Configuration
scripts/test-miners.ts and replace placeholder IPs (192.168.1.100, 192.168.1.101) with your actual miner IPsnpm run test:miners.env file or edit tests/integration/miners.test.tsINTEGRATION_TESTS=true npm run test:integrationNote: The .env file is gitignored and will not be committed to the repository.
# Install dependencies
npm install
# Build
npm run build
# Watch mode
npm run dev
# Run unit tests
npm test
# Run integration tests (requires INTEGRATION_TESTS=true)
npm run test:integration
# Test against real miners
npm run test:miners
Apache License 2.0
python-reference/ in that repo)FAQs
Modern TypeScript CGMiner API library for Bitcoin miners. Zero dependencies, works with any CGMiner-compatible miner. Includes Avalon-specific extensions for firmware upgrade and MM3 features.
We found that fms-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.