Spaces:
Running
Running
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Mining⛏️</title> | |
<script src="https://cdn.tailwindcss.com"></script> | |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
<style> | |
@keyframes pulse { | |
0%, 100% { opacity: 1; } | |
50% { opacity: 0.5; } | |
} | |
.pulse-animation { | |
animation: pulse 2s infinite; | |
} | |
.miner-active { | |
box-shadow: 0 0 15px rgba(59, 130, 246, 0.7); | |
} | |
.progress-bar { | |
transition: width 0.5s ease-in-out; | |
} | |
.resource-icon { | |
transition: all 0.3s ease; | |
} | |
.resource-icon:hover { | |
transform: scale(1.1); | |
} | |
.floating { | |
animation: floating 3s ease-in-out infinite; | |
} | |
@keyframes floating { | |
0% { transform: translateY(0px); } | |
50% { transform: translateY(-10px); } | |
100% { transform: translateY(0px); } | |
} | |
.crypto-logo { | |
width: 24px; | |
height: 24px; | |
border-radius: 50%; | |
display: inline-block; | |
margin-right: 8px; | |
vertical-align: middle; | |
} | |
.coin-selector { | |
background: rgba(255,255,255,0.1); | |
border-radius: 20px; | |
padding: 2px; | |
display: inline-flex; | |
} | |
.coin-option { | |
padding: 4px 12px; | |
border-radius: 20px; | |
cursor: pointer; | |
transition: all 0.3s ease; | |
} | |
.coin-option.active { | |
background: rgba(59, 130, 246, 0.7); | |
} | |
.coin-option:hover:not(.active) { | |
background: rgba(255,255,255,0.2); | |
} | |
.mining-animation { | |
position: relative; | |
overflow: hidden; | |
} | |
.mining-animation::after { | |
content: ""; | |
position: absolute; | |
top: 0; | |
left: 0; | |
right: 0; | |
height: 3px; | |
background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.7), transparent); | |
animation: miningGlow 2s infinite; | |
} | |
@keyframes miningGlow { | |
0% { transform: translateX(-100%); } | |
100% { transform: translateX(100%); } | |
} | |
.connect-btn { | |
position: fixed; | |
bottom: 6rem; | |
right: 2rem; | |
width: 60px; | |
height: 60px; | |
border-radius: 50%; | |
background: linear-gradient(135deg, #3B82F6, #8B5CF6); | |
box-shadow: 0 4px 15px rgba(59, 130, 246, 0.5); | |
display: flex; | |
align-items: center; | |
justify-content: center; | |
cursor: pointer; | |
z-index: 50; | |
transition: all 0.3s ease; | |
} | |
.connect-btn:hover { | |
transform: scale(1.1); | |
box-shadow: 0 6px 20px rgba(59, 130, 246, 0.7); | |
} | |
.wallet-input { | |
background: rgba(255,255,255,0.05); | |
border: 1px solid rgba(255,255,255,0.1); | |
transition: all 0.3s ease; | |
} | |
.wallet-input:focus { | |
border-color: #3B82F6; | |
box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2); | |
} | |
.lucky-miner { | |
background: linear-gradient(135deg, rgba(20, 184, 166, 0.1), rgba(5, 150, 105, 0.1)); | |
border: 1px solid rgba(20, 184, 166, 0.3); | |
} | |
.lucky-miner.active { | |
box-shadow: 0 0 15px rgba(20, 184, 166, 0.7); | |
} | |
</style> | |
</head> | |
<body class="bg-gray-900 text-white min-h-screen"> | |
<div class="container mx-auto px-4 py-8"> | |
<!-- Header with logo and coin selector --> | |
<header class="flex flex-col items-center mb-10"> | |
<div class="flex items-center space-x-4 mb-4"> | |
<div class="floating relative"> | |
<div class="absolute -inset-2 bg-blue-500 rounded-full opacity-20 blur"></div> | |
<img src="https://cryptologos.cc/logos/bitcoin-cash-bch-logo.png" alt="CryptoMiner Pro" class="w-16 h-16"> | |
</div> | |
<h1 class="text-4xl font-bold bg-gradient-to-r from-blue-400 to-purple-500 bg-clip-text text-transparent"> | |
JVALKENBURG Mining | |
</h1> | |
</div> | |
<p class="text-gray-400 text-center max-w-2xl mb-6"> | |
Advanced cryptocurrency mining operations with Lucky Miner technology | |
</p> | |
<div class="coin-selector mb-8"> | |
<div class="coin-option active" onclick="switchCoin('BCH')"> | |
<span class="crypto-logo" style="background-color: #0AC18E;"></span> | |
BCH | |
</div> | |
<div class="coin-option" onclick="switchCoin('FB')"> | |
<span class="crypto-logo" style="background-color: #F7931A;"></span> | |
FB | |
</div> | |
</div> | |
</header> | |
<!-- Wallet Address Input --> | |
<div class="bg-gray-800 rounded-xl p-6 shadow-lg mb-8"> | |
<h2 class="text-xl font-semibold mb-4 flex items-center"> | |
<i class="fas fa-wallet mr-2 text-blue-400"></i> Wallet Configuration | |
</h2> | |
<div class="grid grid-cols-1 md:grid-cols-2 gap-4"> | |
<div> | |
<label class="block text-sm font-medium mb-2">BCH Wallet Address</label> | |
<input type="text" id="bch-wallet" placeholder="bitcoincash:..." | |
class="w-full px-4 py-2 rounded-lg wallet-input focus:outline-none"> | |
</div> | |
<div> | |
<label class="block text-sm font-medium mb-2">FB Wallet Address</label> | |
<input type="text" id="fb-wallet" placeholder="0x..." | |
class="w-full px-4 py-2 rounded-lg wallet-input focus:outline-none"> | |
</div> | |
</div> | |
<button onclick="saveWalletInfo()" class="mt-4 px-6 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg transition"> | |
Save Wallet Info | |
</button> | |
</div> | |
<!-- Main dashboard --> | |
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8 mb-10"> | |
<!-- Resources panel --> | |
<div class="bg-gray-800 rounded-xl p-6 shadow-lg col-span-1"> | |
<h2 class="text-xl font-semibold mb-4 flex items-center"> | |
<i class="fas fa-wallet mr-2 text-blue-400"></i> Wallet Balance | |
</h2> | |
<div class="space-y-4"> | |
<div class="flex justify-between items-center p-3 bg-gray-700 rounded-lg"> | |
<div class="flex items-center"> | |
<i class="fab fa-bitcoin text-yellow-400 text-xl mr-3 resource-icon"></i> | |
<span>Bitcoin Cash (BCH)</span> | |
</div> | |
<span class="font-mono" id="bch-count">0</span> | |
</div> | |
<div class="flex justify-between items-center p-3 bg-gray-700 rounded-lg"> | |
<div class="flex items-center"> | |
<i class="fas fa-project-diagram text-orange-500 text-xl mr-3 resource-icon"></i> | |
<span>Fractal Bitcoin (FB)</span> | |
</div> | |
<span class="font-mono" id="fb-count">0</span> | |
</div> | |
<div class="flex justify-between items-center p-3 bg-gray-700 rounded-lg"> | |
<div class="flex items-center"> | |
<i class="fas fa-bolt text-blue-400 text-xl mr-3 resource-icon"></i> | |
<span>Mining Power</span> | |
</div> | |
<span class="font-mono" id="power-count">0 MH/s</span> | |
</div> | |
</div> | |
<div class="mt-6 bg-gray-700 p-4 rounded-lg"> | |
<h3 class="font-medium mb-2">Estimated Earnings</h3> | |
<div class="flex justify-between text-sm"> | |
<span>Daily:</span> | |
<span id="daily-earnings" class="font-mono">0 BCH</span> | |
</div> | |
<div class="flex justify-between text-sm"> | |
<span>Weekly:</span> | |
<span id="weekly-earnings" class="font-mono">0 BCH</span> | |
</div> | |
<div class="flex justify-between text-sm"> | |
<span>Monthly:</span> | |
<span id="monthly-earnings" class="font-mono">0 BCH</span> | |
</div> | |
</div> | |
</div> | |
<!-- Mining status --> | |
<div class="bg-gray-800 rounded-xl p-6 shadow-lg col-span-1 lg:col-span-2 mining-animation"> | |
<h2 class="text-xl font-semibold mb-4 flex items-center"> | |
<i class="fas fa-hard-hat mr-2 text-blue-400"></i> Mining Operations | |
</h2> | |
<div class="mb-6"> | |
<div class="flex justify-between mb-2"> | |
<span>Mining Progress</span> | |
<span id="mining-progress-text">0%</span> | |
</div> | |
<div class="w-full bg-gray-700 rounded-full h-4"> | |
<div id="mining-progress-bar" class="progress-bar h-4 rounded-full bg-gradient-to-r from-blue-500 to-purple-500" style="width: 0%"></div> | |
</div> | |
</div> | |
<div class="grid grid-cols-1 md:grid-cols-3 gap-4"> | |
<div class="bg-gray-700 p-4 rounded-lg"> | |
<div class="flex justify-between items-center mb-2"> | |
<span>Active Miners</span> | |
<span id="active-miners" class="font-mono">0</span> | |
</div> | |
<div class="text-sm text-gray-400">Efficiency: <span id="miner-efficiency">0%</span></div> | |
</div> | |
<div class="bg-gray-700 p-4 rounded-lg"> | |
<div class="flex justify-between items-center mb-2"> | |
<span>Hashrate</span> | |
<span id="hashrate" class="font-mono">0 MH/s</span> | |
</div> | |
<div class="text-sm text-gray-400">Shares: <span id="shares">0</span></div> | |
</div> | |
<div class="bg-gray-700 p-4 rounded-lg"> | |
<div class="flex justify-between items-center mb-2"> | |
<span>Next Block</span> | |
<span id="next-block" class="font-mono">--:--</span> | |
</div> | |
<div class="text-sm text-gray-400">Difficulty: <span id="difficulty">0</span></div> | |
</div> | |
</div> | |
<div class="mt-6 grid grid-cols-2 gap-4"> | |
<button | |
id="start-mining-btn" | |
class="col-span-2 py-3 bg-green-600 hover:bg-green-500 rounded-lg transition flex items-center justify-center" | |
onclick="toggleMining()"> | |
<i class="fas fa-play mr-2"></i> Start Mining | |
</button> | |
</div> | |
</div> | |
</div> | |
<!-- Miners control panel --> | |
<div class="bg-gray-800 rounded-xl p-6 shadow-lg mb-10"> | |
<h2 class="text-xl font-semibold mb-6 flex items-center"> | |
<i class="fas fa-server mr-2 text-blue-400"></i> Mining Rigs | |
</h2> | |
<div class="grid grid-cols-1 lg:grid-cols-2 gap-4"> | |
<!-- Lucky Miner --> | |
<div id="miner-1" class="bg-gray-700 rounded-lg p-4 transition-all duration-300 lucky-miner"> | |
<div class="flex justify-between items-center mb-3"> | |
<h3 class="font-medium">Lucky Miner Rig #08D9</h3> | |
<span id="miner-1-status" class="text-xs px-2 py-1 rounded-full bg-gray-600">OFFLINE</span> | |
</div> | |
<div class="flex justify-between text-sm text-gray-400 mb-1"> | |
<span>Hashrate:</span> | |
<span id="miner-1-hashrate">0 MH/s</span> | |
</div> | |
<div class="flex justify-between text-sm text-gray-400 mb-3"> | |
<span>Power:</span> | |
<span id="miner-1-power">0 W</span> | |
</div> | |
<div class="flex justify-between text-sm text-gray-400 mb-3"> | |
<span>Luck Bonus:</span> | |
<span id="miner-1-luck">+25%</span> | |
</div> | |
<button | |
id="miner-1-btn" | |
class="w-full py-2 rounded-lg bg-gray-600 hover:bg-gray-500 transition" | |
onclick="toggleMiner(1)"> | |
Activate | |
</button> | |
</div> | |
<!-- Cloud Miner --> | |
<div id="miner-2" class="bg-gray-700 rounded-lg p-4 transition-all duration-300"> | |
<div class="flex justify-between items-center mb-3"> | |
<h3 class="font-medium">Cloud Miner</h3> | |
<span id="miner-2-status" class="text-xs px-2 py-1 rounded-full bg-gray-600">OFFLINE</span> | |
</div> | |
<div class="flex justify-between text-sm text-gray-400 mb-1"> | |
<span>Hashrate:</span> | |
<span id="miner-2-hashrate">0 MH/s</span> | |
</div> | |
<div class="flex justify-between text-sm text-gray-400 mb-3"> | |
<span>Power:</span> | |
<span id="miner-2-power">0 W</span> | |
</div> | |
<button | |
id="miner-2-btn" | |
class="w-full py-2 rounded-lg bg-gray-600 hover:bg-gray-500 transition" | |
onclick="toggleMiner(2)"> | |
Activate | |
</button> | |
</div> | |
</div> | |
</div> | |
<!-- Upgrades and actions --> | |
<div class="grid grid-cols-1 lg:grid-cols-2 gap-8"> | |
<!-- Upgrades --> | |
<div class="bg-gray-800 rounded-xl p-6 shadow-lg"> | |
<h2 class="text-xl font-semibold mb-6 flex items-center"> | |
<i class="fas fa-level-up-alt mr-2 text-blue-400"></i> Upgrades | |
</h2> | |
<div class="space-y-4"> | |
<div class="flex justify-between items-center p-4 bg-gray-700 rounded-lg"> | |
<div> | |
<h3 class="font-medium">Hashrate Boost</h3> | |
<p class="text-sm text-gray-400">Increase hashrate by 25% per miner</p> | |
</div> | |
<button | |
id="hashrate-upgrade-btn" | |
class="px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg transition disabled:opacity-50" | |
onclick="buyUpgrade('hashrate')" | |
disabled> | |
<span class="font-mono">0.5</span> <i class="fab fa-bitcoin ml-1"></i> | |
</button> | |
</div> | |
<div class="flex justify-between items-center p-4 bg-gray-700 rounded-lg"> | |
<div> | |
<h3 class="font-medium">Energy Efficiency</h3> | |
<p class="text-sm text-gray-400">Reduce power consumption by 20%</p> | |
</div> | |
<button | |
id="efficiency-upgrade-btn" | |
class="px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg transition disabled:opacity-50" | |
onclick="buyUpgrade('efficiency')" | |
disabled> | |
<span class="font-mono">0.75</span> <i class="fab fa-bitcoin ml-1"></i> | |
</button> | |
</div> | |
<div class="flex justify-between items-center p-4 bg-gray-700 rounded-lg"> | |
<div> | |
<h3 class="font-medium">Cloud Capacity</h3> | |
<p class="text-sm text-gray-400">Double cloud mining capacity</p> | |
</div> | |
<button | |
id="miner-upgrade-btn" | |
class="px-4 py-2 bg-blue-600 hover:bg-blue-500 rounded-lg transition disabled:opacity-50" | |
onclick="buyUpgrade('miner')" | |
disabled> | |
<span class="font-mono">1.2</span> <i class="fab fa-bitcoin ml-1"></i> | |
</button> | |
</div> | |
</div> | |
</div> | |
<!-- Actions --> | |
<div class="bg-gray-800 rounded-xl p-6 shadow-lg"> | |
<h2 class="text-xl font-semibold mb-6 flex items-center"> | |
<i class="fas fa-rocket mr-2 text-blue-400"></i> Quick Actions | |
</h2> | |
<div class="grid grid-cols-2 gap-4"> | |
<button | |
id="withdraw-btn" | |
class="col-span-2 py-3 bg-purple-600 hover:bg-purple-500 rounded-lg transition flex items-center justify-center" | |
onclick="withdrawFunds()"> | |
<i class="fas fa-wallet mr-2"></i> Withdraw Funds | |
</button> | |
<button | |
class="py-3 bg-green-600 hover:bg-green-500 rounded-lg transition flex items-center justify-center" | |
onclick="exchangeToBCH()"> | |
<i class="fas fa-exchange-alt mr-2"></i> FB → BCH | |
</button> | |
<button | |
class="py-3 bg-yellow-600 hover:bg-yellow-500 rounded-lg transition flex items-center justify-center" | |
onclick="exchangeToFB()"> | |
<i class="fas fa-exchange-alt mr-2"></i> BCH → FB | |
</button> | |
</div> | |
<div class="mt-6 p-4 bg-gray-700 rounded-lg"> | |
<h3 class="font-medium mb-2">Market Prices</h3> | |
<div class="text-sm space-y-2"> | |
<div class="flex justify-between"> | |
<span>1 BCH =</span> | |
<span id="bch-price">$250.00</span> | |
</div> | |
<div class="flex justify-between"> | |
<span>1 FB =</span> | |
<span id="fb-price">$0.85</span> | |
</div> | |
<div class="flex justify-between"> | |
<span>Exchange Rate:</span> | |
<span>1 BCH = 300 FB</span> | |
</div> | |
</div> | |
</div> | |
</div> | |
</div> | |
<!-- Connect Button --> | |
<div class="connect-btn" onclick="connectToLuckyMiner()"> | |
<i class="fas fa-plug text-white text-xl"></i> | |
</div> | |
<!-- Notifications area --> | |
<div id="notifications" class="fixed bottom-4 right-4 space-y-2 max-w-xs"></div> | |
</div> | |
<script> | |
// Game state | |
const state = { | |
currentCoin: 'BCH', // 'BCH' or 'FB' | |
wallet: { | |
BCH: 0, | |
FB: 0, | |
power: 0 // in MH/s | |
}, | |
walletAddresses: { | |
BCH: '', | |
FB: '' | |
}, | |
miners: { | |
1: { | |
active: false, | |
baseHashrate: 100, // MH/s (higher for Lucky Miner) | |
powerUsage: 800, // W | |
type: 'Lucky', | |
luckBonus: 0.25 // 25% bonus | |
}, | |
2: { | |
active: false, | |
baseHashrate: 20, | |
powerUsage: 0, | |
type: 'Cloud', | |
unlocked: true | |
} | |
}, | |
upgrades: { | |
hashrate: { level: 0, cost: 0.5 }, | |
efficiency: { level: 0, cost: 0.75 }, | |
miner: { level: 0, cost: 1.2 } | |
}, | |
mining: false, | |
miningProgress: 0, | |
shares: 0, | |
difficulty: 1000000, | |
lastUpdate: Date.now(), | |
prices: { | |
BCH: 250.00, | |
FB: 0.85 | |
}, | |
luckyMinerConnected: false | |
}; | |
// DOM elements | |
const elements = { | |
bchCount: document.getElementById('bch-count'), | |
fbCount: document.getElementById('fb-count'), | |
powerCount: document.getElementById('power-count'), | |
miningProgressBar: document.getElementById('mining-progress-bar'), | |
miningProgressText: document.getElementById('mining-progress-text'), | |
activeMiners: document.getElementById('active-miners'), | |
minerEfficiency: document.getElementById('miner-efficiency'), | |
hashrate: document.getElementById('hashrate'), | |
shares: document.getElementById('shares'), | |
nextBlock: document.getElementById('next-block'), | |
difficulty: document.getElementById('difficulty'), | |
dailyEarnings: document.getElementById('daily-earnings'), | |
weeklyEarnings: document.getElementById('weekly-earnings'), | |
monthlyEarnings: document.getElementById('monthly-earnings'), | |
startMiningBtn: document.getElementById('start-mining-btn'), | |
notifications: document.getElementById('notifications'), | |
bchPrice: document.getElementById('bch-price'), | |
fbPrice: document.getElementById('fb-price'), | |
bchWalletInput: document.getElementById('bch-wallet'), | |
fbWalletInput: document.getElementById('fb-wallet') | |
}; | |
// Initialize miner elements | |
for (let i = 1; i <= 2; i++) { | |
elements[`miner${i}Status`] = document.getElementById(`miner-${i}-status`); | |
elements[`miner${i}Btn`] = document.getElementById(`miner-${i}-btn`); | |
elements[`miner${i}Hashrate`] = document.getElementById(`miner-${i}-hashrate`); | |
elements[`miner${i}Power`] = document.getElementById(`miner-${i}-power`); | |
elements[`miner${i}Container`] = document.getElementById(`miner-${i}`); | |
} | |
// Special element for Lucky Miner | |
elements.miner1Luck = document.getElementById('miner-1-luck'); | |
// Upgrade buttons | |
elements.hashrateUpgradeBtn = document.getElementById('hashrate-upgrade-btn'); | |
elements.efficiencyUpgradeBtn = document.getElementById('efficiency-upgrade-btn'); | |
elements.minerUpgradeBtn = document.getElementById('miner-upgrade-btn'); | |
// Game loop | |
function gameLoop() { | |
const now = Date.now(); | |
const deltaTime = (now - state.lastUpdate) / 1000; // in seconds | |
state.lastUpdate = now; | |
// Update mining if active | |
if (state.mining) { | |
updateMining(deltaTime); | |
} | |
// Update UI | |
updateUI(); | |
// Check for upgrades availability | |
checkUpgrades(); | |
requestAnimationFrame(gameLoop); | |
} | |
function updateMining(deltaTime) { | |
let activeMiners = 0; | |
let totalHashrate = 0; | |
let totalPower = 0; | |
// Calculate active miners and their rates | |
for (let i = 1; i <= 2; i++) { | |
const miner = state.miners[i]; | |
if (miner.active && (i !== 2 || miner.unlocked)) { | |
activeMiners++; | |
// Calculate hashrate with upgrades | |
let hashrate = miner.baseHashrate * (1 + state.upgrades.hashrate.level * 0.25); | |
// Apply luck bonus for Lucky Miner | |
if (miner.type === 'Lucky' && state.luckyMinerConnected) { | |
hashrate *= (1 + miner.luckBonus); | |
} | |
totalHashrate += hashrate; | |
// Calculate power with efficiency upgrades | |
const power = miner.powerUsage * (1 - state.upgrades.efficiency.level * 0.2); | |
totalPower += power; | |
} | |
} | |
// Update mining progress | |
if (activeMiners > 0) { | |
// Calculate mining progress based on hashrate and difficulty | |
const progressRate = (totalHashrate * 1000) / state.difficulty; // Adjusted for difficulty | |
state.miningProgress += progressRate * deltaTime; | |
// Check if we mined a block (every 100% progress) | |
if (state.miningProgress >= 100) { | |
state.miningProgress = 0; | |
state.shares++; | |
// Add coins based on current coin being mined | |
const coinsEarned = calculateCoinsEarned(totalHashrate); | |
state.wallet[state.currentCoin] += coinsEarned; | |
// Randomly adjust difficulty | |
state.difficulty = Math.max(500000, state.difficulty + (Math.random() * 200000 - 100000)); | |
addNotification(`Block mined! +${coinsEarned.toFixed(8)} ${state.currentCoin}`, 'success'); | |
} | |
} | |
// Update wallet power | |
state.wallet.power = totalHashrate; | |
// Update stats | |
state.activeMiners = activeMiners; | |
state.totalHashrate = totalHashrate; | |
state.totalPower = totalPower; | |
} | |
function calculateCoinsEarned(hashrate) { | |
// Base reward decreases as you mine more (simulating halving) | |
const baseReward = 0.01 * Math.pow(0.9, Math.floor(state.shares / 100)); | |
// Adjust reward based on hashrate (more hashrate = more reward) | |
const reward = baseReward * (hashrate / 100); | |
return Math.max(reward, 0.00000001); // Minimum reward | |
} | |
function updateUI() { | |
// Update wallet counters | |
elements.bchCount.textContent = state.wallet.BCH.toFixed(8); | |
elements.fbCount.textContent = state.wallet.FB.toFixed(8); | |
elements.powerCount.textContent = `${state.wallet.power.toFixed(2)} MH/s`; | |
// Update mining progress | |
elements.miningProgressBar.style.width = `${state.miningProgress}%`; | |
elements.miningProgressText.textContent = `${Math.floor(state.miningProgress)}%`; | |
// Update miner status | |
for (let i = 1; i <= 2; i++) { | |
const miner = state.miners[i]; | |
if (miner.active) { | |
elements[`miner${i}Status`].textContent = 'ACTIVE'; | |
elements[`miner${i}Status`].className = 'text-xs px-2 py-1 rounded-full bg-green-600'; | |
elements[`miner${i}Btn`].textContent = 'Deactivate'; | |
elements[`miner${i}Btn`].className = 'w-full py-2 rounded-lg bg-red-600 hover:bg-red-500 transition'; | |
elements[`miner${i}Container`].classList.add(i === 1 ? 'miner-active lucky-miner' : 'miner-active'); | |
// Calculate hashrate with upgrades | |
let hashrate = miner.baseHashrate * (1 + state.upgrades.hashrate.level * 0.25); | |
// Apply luck bonus for Lucky Miner | |
if (i === 1 && state.luckyMinerConnected) { | |
hashrate *= (1 + miner.luckBonus); | |
} | |
elements[`miner${i}Hashrate`].textContent = `${hashrate.toFixed(2)} MH/s`; | |
// Calculate power with efficiency upgrades | |
const power = miner.powerUsage * (1 - state.upgrades.efficiency.level * 0.2); | |
elements[`miner${i}Power`].textContent = `${power.toFixed(0)} W`; | |
} else { | |
elements[`miner${i}Status`].textContent = 'OFFLINE'; | |
elements[`miner${i}Status`].className = 'text-xs px-2 py-1 rounded-full bg-gray-600'; | |
elements[`miner${i}Btn`].textContent = 'Activate'; | |
elements[`miner${i}Btn`].className = 'w-full py-2 rounded-lg bg-gray-600 hover:bg-gray-500 transition'; | |
elements[`miner${i}Container`].classList.remove('miner-active', 'lucky-miner'); | |
elements[`miner${i}Hashrate`].textContent = '0 MH/s'; | |
elements[`miner${i}Power`].textContent = '0 W'; | |
} | |
} | |
// Update Lucky Miner stats | |
if (state.luckyMinerConnected) { | |
elements.miner1Luck.textContent = `+${(state.miners[1].luckBonus * 100).toFixed(0)}%`; | |
elements.miner1Luck.className = 'text-sm text-green-400'; | |
} else { | |
elements.miner1Luck.textContent = '+0%'; | |
elements.miner1Luck.className = 'text-sm text-gray-400'; | |
} | |
// Update stats | |
elements.activeMiners.textContent = state.activeMiners; | |
const efficiency = state.upgrades.efficiency.level * 20; | |
elements.minerEfficiency.textContent = `${efficiency}%`; | |
elements.hashrate.textContent = `${state.totalHashrate.toFixed(2)} MH/s`; | |
elements.shares.textContent = state.shares; | |
elements.difficulty.textContent = Math.floor(state.difficulty).toLocaleString(); | |
// Calculate next block time | |
if (state.activeMiners > 0 && state.totalHashrate > 0) { | |
const timeLeft = Math.max(0, (100 - state.miningProgress) / (state.totalHashrate * 1000 / state.difficulty)); | |
const minutes = Math.floor(timeLeft / 60); | |
const seconds = Math.floor(timeLeft % 60); | |
elements.nextBlock.textContent = `${minutes.toString().padStart(2, '0')}:${seconds.toString().padStart(2, '0')}`; | |
} else { | |
elements.nextBlock.textContent = '--:--'; | |
} | |
// Update estimated earnings | |
const dailyEarnings = calculateCoinsEarned(state.totalHashrate) * 24; | |
elements.dailyEarnings.textContent = `${dailyEarnings.toFixed(8)} ${state.currentCoin}`; | |
elements.weeklyEarnings.textContent = `${(dailyEarnings * 7).toFixed(8)} ${state.currentCoin}`; | |
elements.monthlyEarnings.textContent = `${(dailyEarnings * 30).toFixed(8)} ${state.currentCoin}`; | |
// Update market prices | |
elements.bchPrice.textContent = `$${state.prices.BCH.toFixed(2)}`; | |
elements.fbPrice.textContent = `$${state.prices.FB.toFixed(2)}`; | |
// Update mining button | |
if (state.mining) { | |
elements.startMiningBtn.innerHTML = '<i class="fas fa-stop mr-2"></i> Stop Mining'; | |
elements.startMiningBtn.className = 'col-span-2 py-3 bg-red-600 hover:bg-red-500 rounded-lg transition flex items-center justify-center'; | |
} else { | |
elements.startMiningBtn.innerHTML = '<i class="fas fa-play mr-2"></i> Start Mining'; | |
elements.startMiningBtn.className = 'col-span-2 py-3 bg-green-600 hover:bg-green-500 rounded-lg transition flex items-center justify-center'; | |
} | |
} | |
function checkUpgrades() { | |
// Hashrate upgrade | |
if (state.wallet.BCH >= state.upgrades.hashrate.cost && state.upgrades.hashrate.level < 4) { | |
elements.hashrateUpgradeBtn.disabled = false; | |
elements.hashrateUpgradeBtn.innerHTML = `<span class="font-mono">${state.upgrades.hashrate.cost}</span> <i class="fab fa-bitcoin ml-1"></i>`; | |
} else { | |
elements.hashrateUpgradeBtn.disabled = true; | |
if (state.upgrades.hashrate.level >= 4) { | |
elements.hashrateUpgradeBtn.innerHTML = '<span>MAX</span>'; | |
} | |
} | |
// Efficiency upgrade | |
if (state.wallet.BCH >= state.upgrades.efficiency.cost && state.upgrades.efficiency.level < 5) { | |
elements.efficiencyUpgradeBtn.disabled = false; | |
elements.efficiencyUpgradeBtn.innerHTML = `<span class="font-mono">${state.upgrades.efficiency.cost}</span> <i class="fab fa-bitcoin ml-1"></i>`; | |
} else { | |
elements.efficiencyUpgradeBtn.disabled = true; | |
if (state.upgrades.efficiency.level >= 5) { | |
elements.efficiencyUpgradeBtn.innerHTML = '<span>MAX</span>'; | |
} | |
} | |
// Miner upgrade | |
if (state.wallet.BCH >= state.upgrades.miner.cost && state.upgrades.miner.level < 1) { | |
elements.minerUpgradeBtn.disabled = false; | |
elements.minerUpgradeBtn.innerHTML = `<span class="font-mono">${state.upgrades.miner.cost}</span> <i class="fab fa-bitcoin ml-1"></i>`; | |
} else { | |
elements.minerUpgradeBtn.disabled = true; | |
if (state.upgrades.miner.level >= 1) { | |
elements.minerUpgradeBtn.innerHTML = '<span>MAX</span>'; | |
} | |
} | |
} | |
function toggleMiner(minerId) { | |
const miner = state.miners[minerId]; | |
// Check if miner is unlocked (only relevant for cloud miner) | |
if (minerId === 2 && !miner.unlocked) return; | |
// Toggle miner | |
miner.active = !miner.active; | |
if (miner.active) { | |
addNotification(`Miner #${minerId} activated`, "success"); | |
} else { | |
addNotification(`Miner #${minerId} deactivated`, "info"); | |
} | |
} | |
function toggleMining() { | |
state.mining = !state.mining; | |
if (state.mining) { | |
// Check if we have active miners | |
let activeMiners = 0; | |
for (let i = 1; i <= 2; i++) { | |
if (state.miners[i].active && (i !== 2 || state.miners[2].unlocked)) { | |
activeMiners++; | |
} | |
} | |
if (activeMiners === 0) { | |
addNotification("No active miners to start mining!", "error"); | |
state.mining = false; | |
return; | |
} | |
addNotification(`Started mining ${state.currentCoin}`, "success"); | |
} else { | |
addNotification("Mining stopped", "info"); | |
} | |
} | |
function buyUpgrade(type) { | |
const upgrade = state.upgrades[type]; | |
// Check if we can afford it | |
if (state.wallet.BCH < upgrade.cost) { | |
addNotification("Not enough BCH for this upgrade!", "error"); | |
return; | |
} | |
// Check if already max level | |
if ((type === 'hashrate' && upgrade.level >= 4) || | |
(type === 'efficiency' && upgrade.level >= 5) || | |
(type === 'miner' && upgrade.level >= 1)) { | |
return; | |
} | |
// Apply upgrade | |
state.wallet.BCH -= upgrade.cost; | |
upgrade.level += 1; | |
// Special effects for each upgrade | |
if (type === 'hashrate') { | |
addNotification(`Hashrate increased to ${upgrade.level * 25}%!`, "success"); | |
upgrade.cost = Math.floor(upgrade.cost * 1.5 * 100) / 100; | |
} else if (type === 'efficiency') { | |
addNotification(`Power efficiency increased to ${upgrade.level * 20}%!`, "success"); | |
upgrade.cost = Math.floor(upgrade.cost * 1.8 * 100) / 100; | |
} else if (type === 'miner') { | |
state.miners[2].baseHashrate *= 2; | |
addNotification("Cloud mining capacity doubled!", "success"); | |
} | |
} | |
function withdrawFunds() { | |
if (state.wallet.BCH < 0.001 && state.wallet.FB < 1) { | |
addNotification("Not enough funds to withdraw", "info"); | |
return; | |
} | |
let message = "Withdrawn:"; | |
if (state.wallet.BCH >= 0.001) { | |
message += ` ${state.wallet.BCH.toFixed(8)} BCH`; | |
state.wallet.BCH = 0; | |
} | |
if (state.wallet.FB >= 1) { | |
message += ` ${state.wallet.FB.toFixed(2)} FB`; | |
state.wallet.FB = 0; | |
} | |
addNotification(message, "success"); | |
} | |
function exchangeToBCH() { | |
if (state.wallet.FB < 300) { | |
addNotification("You need at least 300 FB to exchange for 1 BCH", "info"); | |
return; | |
} | |
const exchangeAmount = Math.floor(state.wallet.FB / 300); | |
state.wallet.FB -= exchangeAmount * 300; | |
state.wallet.BCH += exchangeAmount; | |
addNotification(`Exchanged ${exchangeAmount * 300} FB for ${exchangeAmount} BCH`, "success"); | |
} | |
function exchangeToFB() { | |
if (state.wallet.BCH < 1) { | |
addNotification("You need at least 1 BCH to exchange for 300 FB", "info"); | |
return; | |
} | |
const exchangeAmount = Math.floor(state.wallet.BCH); | |
state.wallet.BCH -= exchangeAmount; | |
state.wallet.FB += exchangeAmount * 300; | |
addNotification(`Exchanged ${exchangeAmount} BCH for ${exchangeAmount * 300} FB`, "success"); | |
} | |
function switchCoin(coin) { | |
if (coin === state.currentCoin) return; | |
state.currentCoin = coin; | |
state.miningProgress = 0; | |
// Update UI for coin selector | |
document.querySelectorAll('.coin-option').forEach(option => { | |
if (option.textContent.includes(coin)) { | |
option.classList.add('active'); | |
} else { | |
option.classList.remove('active'); | |
} | |
}); | |
addNotification(`Now mining ${coin}`, "info"); | |
} | |
function connectToLuckyMiner() { | |
state.luckyMinerConnected = !state.luckyMinerConnected; | |
if (state.luckyMinerConnected) { | |
addNotification("Connected to Lucky Miner Rig #08D9", "success"); | |
} else { | |
addNotification("Disconnected from Lucky Miner Rig", "info"); | |
} | |
} | |
function saveWalletInfo() { | |
state.walletAddresses.BCH = elements.bchWalletInput.value.trim(); | |
state.walletAddresses.FB = elements.fbWalletInput.value.trim(); | |
if (state.walletAddresses.BCH || state.walletAddresses.FB) { | |
addNotification("Wallet addresses saved!", "success"); | |
} else { | |
addNotification("Please enter at least one wallet address", "info"); | |
} | |
} | |
function addNotification(message, type) { | |
const notification = document.createElement('div'); | |
notification.className = `p-3 rounded-lg shadow-lg flex items-start ${type === 'error' ? 'bg-red-600' : type === 'success' ? 'bg-green-600' : 'bg-blue-600'}`; | |
const icon = document.createElement('i'); | |
icon.className = `mr-2 ${type === 'error' ? 'fas fa-exclamation-circle' : type === 'success' ? 'fas fa-check-circle' : 'fas fa-info-circle'}`; | |
const text = document.createElement('span'); | |
text.textContent = message; | |
notification.appendChild(icon); | |
notification.appendChild(text); | |
elements.notifications.appendChild(notification); | |
// Auto-remove after 3 seconds | |
setTimeout(() => { | |
notification.classList.add('opacity-0', 'transition-opacity', 'duration-500'); | |
setTimeout(() => notification.remove(), 500); | |
}, 3000); | |
} | |
// Initialize the game | |
function init() { | |
// Set initial UI state | |
updateUI(); | |
// Start game loop | |
gameLoop(); | |
// Add welcome notification | |
setTimeout(() => { | |
addNotification("Welcome to JVALKENBURG Mining Ops!", "info"); | |
setTimeout(() => { | |
addNotification("Connect to your Lucky Miner Rig to get started", "info"); | |
}, 1500); | |
}, 500); | |
// Simulate price changes | |
setInterval(() => { | |
// Random price fluctuations | |
state.prices.BCH = Math.max(100, state.prices.BCH + (Math.random() * 10 - 5)); | |
state.prices.FB = Math.max(0.5, state.prices.FB + (Math.random() * 0.1 - 0.05)); | |
// Occasionally add small amounts of coins (simulating mining rewards) | |
if (Math.random() > 0.95) { | |
const smallReward = Math.random() * 0.0001; | |
state.wallet[state.currentCoin] += smallReward; | |
} | |
}, 10000); | |
} | |
// Start the game | |
init(); | |
</script> | |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=privateuserh/jvmnnvbeta1-0" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
</html> |