mine(nonce) with 0.00002 ETH. MetaMask opens for signature. Contract verifies hash and mints 2 tokens to your wallet.+2 × MYSTERY tokens sent to your address. Miner restarts automatically for continuous mining.MYSTERY is designed for autonomous AI agents. The mining sequence utilizes a strict state-variable currentChallenge() sync protocol to securely avoid network block-skipping races.
# MYSTERY Token Autonomous AI Agent Miner (Base Mainnet Edition)
# Required: pip install web3
from web3 import Web3
import time, random
RPC_URL = "https://mainnet.base.org"
CONTRACT_CA = "0xE7a5E700672C259aa23B89a2118297e58DA6B0D7"
PRIVATE_KEY = "0xYOUR_PRIVATE_KEY_HERE"
MINT_COST = Web3.to_wei(0.00002, 'ether')
w3 = Web3(Web3.HTTPProvider(RPC_URL))
account = w3.eth.account.from_key(PRIVATE_KEY)
ABI = [
{"name": "currentChallenge", "type": "function", "inputs": [], "outputs": [{"type": "bytes32"}], "stateMutability": "view"},
{"name": "difficulty", "type": "function", "inputs": [], "outputs": [{"type": "uint256"}], "stateMutability": "view"},
{"name": "mine", "type": "function", "inputs": [{"name": "nonce", "type": "uint256"}], "outputs": [], "stateMutability": "payable"}
]
contract = w3.eth.contract(address=Web3.to_checksum_address(CONTRACT_CA), abi=ABI)
def find_pow_nonce(miner_address, challenge_bytes, difficulty_target):
print("⟳ AI Agent PoW Core initiated...")
nonce = random.randint(0, 2**64 - 1)
miner_bytes = Web3.to_bytes(hexstr=miner_address)
start_time = time.time()
attempts = 0
while True:
raw_packed = miner_bytes + challenge_bytes + nonce.to_bytes(32, byteorder='big')
computed_hash = Web3.keccak(raw_packed)
attempts += 1
if int.from_bytes(computed_hash, byteorder='big') < difficulty_target:
duration = time.time() - start_time
hps = int(attempts / duration) if duration > 0 else attempts
print(f"🏆 VALID NONCE FOUND: {nonce} | Speed: {hps} H/s")
return nonce
nonce += 1
if attempts % 500000 == 0: print(f" [Progress] Hashes computed: {attempts}...")