Setiap field di orchestrator/.env dijelaskan, plus rekomendasi RPC providers dan tuning tips.
Lokasi: orchestrator/.env (cp dari .env.example)
RPC_URL=https://ethereum-rpc.publicnode.com
PRIVATE_KEY=0xREPLACE_WITH_YOUR_PRIVATE_KEY
THREADS=4
GAS_LIMIT=200000
PRIORITY_FEE_GWEI=0.5
MAX_GAS_PRICE_GWEI=20Endpoint Ethereum mainnet JSON-RPC. Orchestrator pakai untuk:
getChallenge(address)— fetch current challenge per walletminingState()— fetch difficulty, era, epoch infoeth_getBalance— cek ETH balanceeth_getBlockNumber,eth_feeHistory— gas estimationeth_call— pre-flight simulationeth_sendRawTransaction— submitmine()tx
| Field | Wajib | Default | Format |
|---|---|---|---|
RPC_URL |
✅ | (none) | https://... URL JSON-RPC HTTPS |
Tidak boleh: ws:// (WebSocket — tidak di-support orchestrator saat ini), HTTP plain (insecure).
Private key wallet mining (NEW dedicated wallet, bukan wallet utama).
| Field | Wajib | Default | Format |
|---|---|---|---|
PRIVATE_KEY |
✅ | (none) | 0x + 64 hex chars (66 chars total) |
CRITICAL:
- ❌ JANGAN paste di chat / IDE diagnostics / logs
- ❌ JANGAN commit ke git (
.gitignoreblock, tapi cek manual) - ❌ JANGAN share dengan orang lain
- ✅ Edit file
.envLANGSUNG di mesin VPS, via SSH
Validasi: node preflight.js cek format + derive address (tanpa display PK).
Jumlah pthread di C miner. Default 4.
| Field | Wajib | Default | Range |
|---|---|---|---|
THREADS |
❌ | 4 |
1–64 |
Rekomendasi:
- VPS 4-vCPU dedicated →
THREADS=4 - VPS 8-vCPU dedicated →
THREADS=8 - Laptop 16-core (i9, Ryzen 9) →
THREADS=14(sisakan 2 core untuk OS + browser) - Bare metal Workstation 32+ core →
THREADS= physical core count (tidak hyperthread, AVX-512 sudah ngacir)
Lihat Tuning THREADS di bawah.
Gas limit untuk tx mine(nonce). Default 200,000.
| Field | Wajib | Default | Tipikal usage |
|---|---|---|---|
GAS_LIMIT |
❌ | 200000 |
~80,000–150,000 |
Kalau gas limit terlalu rendah, tx revert dengan "out of gas" — lose gas. Kalau terlalu tinggi, tidak masalah (cuma reserve, refund kalau tidak terpakai). 200,000 = comfortable buffer.
Tip ke validator (atas base fee). Default 0.5 gwei.
| Field | Wajib | Default | Range |
|---|---|---|---|
PRIORITY_FEE_GWEI |
❌ | 0.5 |
0.1–5.0 |
Naik = tx land lebih cepat (1-2 blok), tapi bayar lebih per submit. 0.5 gwei sudah cukup untuk land dalam ~24 detik (2 blok).
Kalau sering kena race condition (challenge rotated sebelum tx land):
- Naikkan ke 1.0 atau 2.0 gwei
Skip submit kalau base fee melebihi ini. Default 20 gwei.
| Field | Wajib | Default | Trade-off |
|---|---|---|---|
MAX_GAS_PRICE_GWEI |
❌ | 20 |
Higher = mining lebih agresif tapi gas cost tinggi |
Kalkulasi:
- Base fee 1 gwei = ~$0.04 per submit (gas 80-150k)
- Base fee 20 gwei = ~$0.80 per submit
- Base fee 50 gwei = ~$2 per submit
- Base fee 100+ gwei = ~$4+ per submit (NFT mint event, MEV chaos)
Kalau reward 100 HASH dan harga HASH = $0.005, total reward $0.50. Submit dengan gas $2 = LOSS!
Setting konservatif:
- Bear market / cheap mining:
MAX_GAS_PRICE_GWEI=20 - Volatile market:
MAX_GAS_PRICE_GWEI=10 - Mining dengan margin tipis:
MAX_GAS_PRICE_GWEI=5
| Provider | URL | Free tier | Rate limit | Pros | Cons |
|---|---|---|---|---|---|
| PublicNode ⭐ | https://ethereum-rpc.publicnode.com |
Free, no signup | ~30 req/s | Most reliable, no API key | Sometimes burst limit |
| LlamaRPC | https://eth.llamarpc.com |
Free, no signup | ~30 req/s | Backup default | Occasional timeouts |
| Ankr | https://rpc.ankr.com/eth |
Free, no signup | ~30 req/s | Fast, geo-distributed | Sometimes 429 |
| 1RPC | https://1rpc.io/eth |
Free, no signup | ~25 req/s | Privacy-focused | Slower |
| Cloudflare ETH | https://cloudflare-eth.com |
Free, no signup | ~50 req/s | High availability | Less updated state cache |
| Alchemy | sign up | Free 300M req/mo | ~25 req/s tier free | High quality, eth_call cache | Need signup, API key in URL |
| Infura | sign up | Free 3M req/day | ~10 req/s | High quality | Lower free tier vs Alchemy |
| QuickNode | sign up | Trial only | varies | Fastest tier | Paid only beyond trial |
Rekomendasi:
- Default (paling banyak case): PublicNode. Stabil, free, no signup pain.
- Backup: tambah failover di code (lihat
ARSITEKTUR.md). - Heavy duty: kalau ada > 10 wallet mining instance dari satu IP, signup Alchemy/Infura supaya tidak kena IP ban di public RPC.
Saat ini orchestrator pakai single RPC_URL. Kalau mau auto-failover, modifikasi code (sketsa di ARSITEKTUR.md).
Workaround tanpa code change: pasang nginx local sebagai LB:
upstream eth_rpc {
server ethereum-rpc.publicnode.com:443 max_fails=3 fail_timeout=30s;
server eth.llamarpc.com:443 backup;
server rpc.ankr.com:443 backup;
}
server {
listen 127.0.0.1:8545;
location / {
proxy_pass https://eth_rpc;
}
}Lalu di .env: RPC_URL=http://127.0.0.1:8545.
Tapi nginx kompleks setup ini, biasanya skip dulu — single RPC sudah cukup untuk solo miner.
Beberapa provider format URL:
https://eth-mainnet.g.alchemy.com/v2/<API_KEY>
https://mainnet.infura.io/v3/<API_KEY>
API key visible di URL. preflight.js mask API key saat print log:
info(`RPC_URL: ${process.env.RPC_URL.replace(/\/v2\/.*/, "/v2/***")}`);Risiko:
- Kalau
.envbocor, API key jadi kuota gratis orang lain (sampai habis). - Bisa rate-limit kuota kamu sendiri.
Mitigasi:
- Set kuota / IP whitelist di dashboard provider.
- Rotasi API key tiap bulan.
lscpu | grep -E "^CPU\(s\)|Thread\(s\) per core|Core\(s\) per socket|Socket"Output contoh:
CPU(s): 4
Thread(s) per core: 1
Core(s) per socket: 4
Socket(s): 1
= 4 physical cores, no hyperthread → set THREADS=4.
CPU(s): 16
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 1
= 8 physical, 16 logical (hyperthread) → set THREADS=8 (hyperthread tidak banyak gain untuk AVX-512 throughput-bound).
for n in 1 2 4 8 16; do
THREADS=$n make bench 2>&1 | grep aggregate
doneCari THREADS=N yang aggregate hashrate tertinggi. Biasanya = physical core count.
AVX-512 instructions sangat heavy — banyak waktu μop dispatch di port 0/1 di execution units. 2 hyperthread di 1 physical core kompetisi resource yang sama, gain mendekati nol.
Empirical di Zen 4 Ryzen 7700X (8C/16T):
- THREADS=8 (1 thread per physical): ~1200 MH/s
- THREADS=16 (2 thread per physical): ~1280 MH/s (+6%, marginal)
Worth-it kalau benchmark hasil > +5%. Kalau tidak, set THREADS = physical core count.
Server EPYC dual-socket (128+ core). 2 NUMA node. pthread bisa cross-NUMA → cache miss penalty.
Pin tiap thread ke NUMA-local core via numactl:
numactl --cpunodebind=0 --membind=0 ./bin/miner --threads 64Tapi jarang case begini — kebanyakan VPS single-socket.
Persamaan profit per submit:
profit_per_submit = reward_HASH × price_HASH − gas_used × gas_price
Kalau gas_used × gas_price > reward_HASH × price_HASH = LOSS.
Run dengan default. Cek stats:
curl http://127.0.0.1:7878/api/stats | jq '.attempts, .successes, .reverts, .skipped, .ethSpent'Tujuan:
successes / attempts> 90% (most submits land OK)skipped / (attempts + skipped)< 30% (pre-flight tidak terlalu agresif)reverts == 0(idealnya)
Kemungkinan: tx land terlalu lambat, challenge rotated sebelum confirm.
Naikkan PRIORITY_FEE_GWEI:
PRIORITY_FEE_GWEI=0.5 → PRIORITY_FEE_GWEI=1.5
Recheck setelah 24 jam.
Cek mana yang trigger:
grep 'SKIP' ~/hash256-miner-c/orchestrator/miner.log | tail -20Kalau dominan "gas price > MAX":
- Naik
MAX_GAS_PRICE_GWEI(10 → 20 → 30) — kalau market price HASH tinggi, masih untung - Atau biarkan saja — better lose 1 reward daripada bayar mahal gas
Kalau dominan "challenge rotated":
- Networking lambat. Cek
pingke RPC. Coba RPC lain.
Misal HASH = $0.01:
- Reward per submit = 100 HASH × $0.01 = $1
- Break-even gas = $0.95 (kasih 5% margin)
- Gas budget = $0.95 / (gas_used 100k) = ~9.5 gwei
Set MAX_GAS_PRICE_GWEI=9 — skip aggressive saat gas mahal.
Misal HASH = $0.001:
- Reward = $0.10 per submit
- Tidak feasible mining; tunggu market.
-
.envdi mesin VPS, bukan di Git, bukan paste in chat -
chmod 600 ~/hash256-miner-c/orchestrator/.env -
PRIVATE_KEY= wallet baru (bukan utama) - Wallet baru funded tepat (~0.005 ETH untuk buffer)
-
node preflight.jsPASS semua 8 checks - Ngerti risiko di
README.id.md → Disclaimer
- Cek balance ETH wallet weekly (top-up kalau < 0.001 ETH)
- Withdraw HASH ke wallet utama tiap >1000 HASH (kurangi exposure)
- Backup
miner.logmingguan (kalau ada anomali, bisa investigate) - Cek
monitor-check.shsetiap login VPS
| Threat | Mitigation |
|---|---|
| VPS provider compromise (admin baca disk) | Wallet baru, fund minimal, withdraw rutin. Total exposure terbatas |
| Private key bocor (typo paste, screenshot) | Generate baru, transfer semua ETH+HASH ke wallet aman |
| RPC compromised (man-in-the-middle) | HTTPS only di RPC_URL. Public RPC reputasi bagus (PublicNode) |
| MEV searcher front-run | Kontrak hash256 require valid mine(nonce) per wallet — tidak bisa front-run nonce yang dimiliki wallet kita |
| Smart contract bug | Read kontrak source di Etherscan dulu. Tidak ada audit publik = invest minimal |
| Hosting ban (mining ToS) | Hetzner OK; AWS/GCP banyak yang block. Cek ToS provider |
# Default rekomendasi (untuk Hetzner CCX13 / 4 vCPU AVX-512)
RPC_URL=https://ethereum-rpc.publicnode.com
PRIVATE_KEY=0x<your-mining-wallet>
THREADS=4
GAS_LIMIT=200000
PRIORITY_FEE_GWEI=0.5
MAX_GAS_PRICE_GWEI=20
# Rekomendasi kalau gas sering spike, naik tip:
PRIORITY_FEE_GWEI=1.0
# Rekomendasi kalau bear market, agresif skip mahal:
MAX_GAS_PRICE_GWEI=10
# Rekomendasi 8-core dedicated:
THREADS=8
# Rekomendasi workstation 16-core AVX-512 home:
THREADS=14
PRIORITY_FEE_GWEI=2.0 # land cepat, jangan kalah dari miner pro