Native CPU miner for the $CODES mine-to-mint protocol on Ethereum Mainnet.
Network: Ethereum Mainnet
CODES: 0xdAeEB910888e3613638C6a9b71691C72B2e7DD36The miner uses:
- Rust native CPU scanner to search valid nonces.
- Node.js submitter to submit
submitBlock(nonce)when a valid proof is found. .envprivate key to auto-sign the submit transaction.
Browser mining uses wallet popups.
CLI mining uses MINER_PRIVATE_KEY and auto-submits when a valid block is found.
GPU miner is not included yet. Current tested mode is native CPU mining.
Run as root:
apt update && apt upgrade -y
apt install -y curl git build-essential pkg-config screen tmuxcurl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs
node -v
npm -vcurl https://sh.rustup.rs -sSf | sh -s -- -y
source /root/.cargo/env
rustc --version
cargo --versioncd /root
git clone https://github.com/404-Agent/codes-miner.git
cd codes-minernpm installcd /root/codes-miner/native-miner
cargo build --release
ls -lah target/release/codes-native-minerExpected binary:
/root/codes-miner/native-miner/target/release/codes-native-minercd /root/codes-miner
cp .env.example .env
nano .env
chmod 600 .envExample:
ETH_RPC=https://YOUR_ETH_MAINNET_RPC
MINER_PRIVATE_KEY=YOUR_MINER_PRIVATE_KEY
CODES_ADDRESS=0xdAeEB910888e3613638C6a9b71691C72B2e7DD36
CHAIN_ID=1
WORKERS=12
LOG_EVERY_MS=30000
NATIVE_REFRESH_MS=0
NATIVE_BIN=/root/codes-miner/native-miner/target/release/codes-native-minerImportant:
- Use a fresh miner wallet.
- Do not use your main wallet private key.
- The miner wallet needs ETH for gas.
- Never share your
.envfile. - Never upload
.envanywhere.
Check CPU threads:
nprocEdit .env:
nano .envExample for 48 threads:
WORKERS=48
LOG_EVERY_MS=30000LOG_EVERY_MS=30000 means scan logs appear every 30 seconds.
cd /root/codes-miner
node mine-native.mjsExpected output:
==================================================
$CODES NATIVE MINER
==================================================
wallet : 0x...
contract : 0xdAeEB910888e3613638C6a9b71691C72B2e7DD36
mode : native-cpu
workers : 48
native : /root/codes-miner/native-miner/target/release/codes-native-miner
==================================================
[sync] block : ...
[sync] batch : ...
[sync] challenge : 0x...
[sync] target : ...
[sync] supply : ... / 10,000,000
[sync] balance : ... $CODES
[mine] native CPU scan started
[native] version=total-rate-v2 mode=cpu workers=48
[native] start_nonce=...
[scan] hashrate=3.23 MH/s nonce=... hash=0x...The miner auto-submits the transaction.
[FOUND] worker=... nonce=... hash=0x...
==================================================
[FOUND]
nonce : ...
hash : 0x...
[tx] submitting block...
==================================================
[tx] hash: 0x...
[tx] waiting confirmation...
[tx] confirmed in block: ...
[reward] 1000 $CODES minted if tx succeededCLI mining does not show a wallet popup.
Browser mining:
- Wallet popup appears.
- User confirms
submitBlockmanually.
CLI mining:
- Uses
MINER_PRIVATE_KEYfrom.env. - Automatically signs and submits
submitBlock(nonce).
cd /root/codes-miner
screen -S codes-native
node mine-native.mjsDetach from screen:
CTRL + A, then DReturn to miner:
screen -r codes-nativepkill -f "mine-native.mjs" || true
pkill -f "codes-native-miner" || true[wait] wallet already won batch 1This means the wallet already won in the current batch. One wallet can only win once per batch. Wait for the next batch or use another miner wallet.
insufficient fundsThe miner wallet needs more ETH for gas.
Wrong chainThe RPC is not Ethereum Mainnet.
RPC error / 503 / too many requestsUse a better Ethereum Mainnet RPC.
- Current tested mode is native CPU mining.
- GPU miner is coming later.
- Do not upload
.env. - Do not expose private keys.