├── check_balance.py ├── README.md └── faucet.py /check_balance.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | import json 3 | import requests 4 | from tqdm import tqdm # Progress bar import 5 | 6 | # Set your RPC endpoint (e.g., Infura, Alchemy, or your own node) 7 | RPC_ENDPOINT = "https://carrot.megaeth.com/rpc" # <-- Replace with your RPC endpoint 8 | 9 | def get_balance(address): 10 | """ 11 | Fetch the native balance for the given address via JSON-RPC. 12 | Returns the balance in Ether as a float, or None if fetching fails. 13 | """ 14 | payload = { 15 | "jsonrpc": "2.0", 16 | "method": "eth_getBalance", 17 | "params": [address, "latest"], 18 | "id": 1 19 | } 20 | try: 21 | response = requests.post(RPC_ENDPOINT, json=payload) 22 | response.raise_for_status() 23 | result = response.json().get("result") 24 | if result: 25 | # Convert balance from hex (Wei) to Ether 26 | balance_wei = int(result, 16) 27 | balance_eth = balance_wei / (10 ** 18) 28 | return balance_eth 29 | except Exception as e: 30 | print(f"Error fetching balance for {address}: {e}") 31 | return None 32 | 33 | def main(): 34 | try: 35 | with open("wallets.json", "r") as f: 36 | wallets = json.load(f) 37 | except Exception as e: 38 | print(f"Error loading wallets.json: {e}") 39 | return 40 | 41 | # Create a list to hold wallets with an empty balance. 42 | empty_wallets = [] 43 | 44 | # Process wallets in reverse order with a progress bar 45 | for wallet in tqdm(wallets[::-1], desc="Processing wallets"): 46 | address = wallet.get("address") 47 | private_key = wallet.get("privateKey") 48 | balance = get_balance(address) 49 | 50 | # Print wallet details to the console 51 | print(f"\n\n\nAddress: {address}") 52 | print(f"Balance: {balance} ETH") 53 | print(f"PrivateKey: {private_key}") 54 | print("-" * 40) 55 | 56 | # Check if balance is "empty" (None or zero) 57 | if balance is None or balance == 0: 58 | empty_wallets.append({ 59 | "address": address, 60 | "balance": balance if balance is not None else 0, 61 | "privateKey": private_key 62 | }) 63 | 64 | # Save empty wallets to file "empty.txt" 65 | if empty_wallets: 66 | try: 67 | with open("empty.txt", "w") as f: 68 | for ew in empty_wallets: 69 | f.write(f"{ew.get('address')}\n") 70 | # Uncomment the lines below if you wish to add more details 71 | # f.write(f"Balance: {ew.get('balance')} ETH\n") 72 | # f.write(f"PrivateKey: {ew.get('privateKey')}\n") 73 | # f.write("-" * 40 + "\n") 74 | print(f"\nSaved {len(empty_wallets)} wallet(s) with empty balance to empty.txt.") 75 | except Exception as e: 76 | print(f"Error saving empty wallets: {e}") 77 | else: 78 | print("\nNo wallets with empty balance were found.") 79 | 80 | 81 | 82 | print(""" 83 | 84 | 85 | 86 | _ _ _ _ _ _____ _ 87 | | | | (_) | | | | / ____| | | 88 | | |__| |_ __| | __| | ___ _ __ | | ___ __| | ___ 89 | | __ | |/ _` |/ _` |/ _ \ '_ \| | / _ \ / _` |/ _ \\ 90 | | | | | | (_| | (_| | __/ | | | |___| (_) | (_| | __/ 91 | |_| |_|_|\__,_|\__,_|\___|_| |_|\_____\___/ \__,_|\___| 92 | 93 | MegaETH Faucet by Aero25x 94 | 95 | Join us to get more scripts 96 | https://t.me/hidden_coding 97 | 98 | 99 | """) 100 | 101 | 102 | if __name__ == "__main__": 103 | main() 104 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Join our Telegram RU](https://img.shields.io/badge/Telegram-RU-03A500?style=for-the-badge&logo=telegram&logoColor=white&labelColor=blue&color=red)](https://t.me/hidden_coding) 2 | [![GitHub](https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/aero25x) 3 | [![Twitter](https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/aero25x) 4 | [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@flaming_chameleon) 5 | [![Reddit](https://img.shields.io/badge/Reddit-FF3A00?style=for-the-badge&logo=reddit&logoColor=white)](https://www.reddit.com/r/HiddenCode/) 6 | [![Join our Telegram ENG](https://img.shields.io/badge/Telegram-EN-03A500?style=for-the-badge&logo=telegram&logoColor=white&labelColor=blue&color=red)](https://t.me/hidden_coding_en) 7 | 8 | 9 | 10 | 11 | 12 | 13 | # MegaETH Faucet Automation 14 | 15 | An automated script designed to claim tokens from the [MegaETH Faucet](https://github.com/Aero25x/megaeth-faucet). This repository harnesses the power of automation, multi-threading, and 2Captcha integration to streamline the token claim process on **MegaETH**, a high-performance, Layer 2 blockchain for Ethereum. 16 | 17 | ## Table of Contents 18 | 19 | - [Project Overview](#project-overview) 20 | - [Features](#features) 21 | - [Installation](#installation) 22 | - [Configuration](#configuration) 23 | - [Wallet Configuration](#wallet-configuration) 24 | - [Proxy Configuration](#proxy-configuration) 25 | - [Script Settings](#script-settings) 26 | - [Usage](#usage) 27 | - [Logging](#logging) 28 | - [About MegaETH](#about-megaeth) 29 | - [Contribution](#contribution) 30 | - [License](#license) 31 | 32 | ## Project Overview 33 | 34 | This repository offers an **automated solution** specifically crafted for the MegaETH network. MegaETH is a Layer 2 blockchain solution designed to enhance the scalability of Ethereum by enabling real-time transaction processing. Our script targets the MegaETH Faucet, facilitating **fast and reliable token distribution** through automated processes that handle Turnstile captchas, proxy configurations, and multi-threaded wallet claims. 35 | 36 | ## Features 37 | 38 | - **Automated Turnstile Captcha Solving:** Seamlessly integrates with [2Captcha](https://2captcha.com/) to solve captchas automatically. 39 | - **Proxy Support:** Compatible with both non-authenticated (`ip:port`) and authenticated proxies (`ip:port:user:pass`). 40 | - **Multi-threaded Processing:** Handles wallet claims concurrently to maximize efficiency and throughput. 41 | - **Flexible Wallet Configuration:** Supports wallet addresses from both `wallet.txt` (plain text) and `wallets.json` (JSON format). 42 | - **Enhanced Logging:** Captures detailed logs with successes in `success.txt` and failures in `fail.txt`. 43 | 44 | ## Installation 45 | 46 | ### Clone the Repository 47 | 48 | Clone the repository from GitHub to start using the automation tool: 49 | 50 | ```bash 51 | git clone https://github.com/Aero25x/megaeth-faucet.git 52 | cd megaeth-faucet 53 | ``` 54 | 55 | ### Install Dependencies 56 | 57 | Install all necessary dependencies with pip: 58 | 59 | ```bash 60 | pip install requests colorama twocaptcha pytz tzlocal 61 | pip install 2captcha-python==1.5.1 62 | ``` 63 | 64 | *Note: Verify package versions and update if necessary.* 65 | 66 | ## Configuration 67 | 68 | Before running the script, update the configurations to match your environment and MegaETH network settings. 69 | 70 | ### Wallet Configuration 71 | 72 | #### `wallet.txt` 73 | 74 | Add your MegaETH wallet addresses—one per line: 75 | 76 | ```text 77 | 0xYourWalletAddress1 78 | 0xYourWalletAddress2 79 | ``` 80 | 81 | #### `wallets.json` (Optional) 82 | 83 | Load additional wallet addresses using JSON format: 84 | 85 | ```json 86 | [ 87 | {"address": "0xYourWalletAddress3"}, 88 | {"address": "0xYourWalletAddress4"} 89 | ] 90 | ``` 91 | 92 | Wallet addresses from `wallets.json` are combined with those in `wallet.txt`. 93 | 94 | ### Proxy Configuration 95 | 96 | #### `proxy.txt` 97 | 98 | List your proxies in one of the following formats: 99 | 100 | - **Without Authentication:** 101 | 102 | ```text 103 | 192.168.1.100:8080 104 | ``` 105 | 106 | - **With Authentication:** 107 | 108 | ```text 109 | 31.56.139.207:6276:hxjsvept:3pzgwox5suvu 110 | ``` 111 | 112 | ### Script Settings 113 | 114 | Edit the script (e.g., `main.py`) and update your API keys along with MegaETH configuration details: 115 | 116 | ```python 117 | TWO_CAPTCHA_API_KEY = "Your_2Captcha_API_Key" 118 | TURNSTILE_SITEKEY = "Your_Turnstile_Sitekey" 119 | TURNSTILE_PAGE_URL = "https://testnet.megaeth.com/" 120 | ``` 121 | 122 | You can further adjust thread counts, endpoints, and other settings as needed. 123 | 124 | ## Usage 125 | 126 | Execute the script to initiate the token claim process on the MegaETH Faucet: 127 | 128 | ```bash 129 | python faucet.py 130 | ``` 131 | 132 | ### Example Output 133 | 134 | ``` 135 | Processing wallet: 0xYourWalletAddress1 136 | Attempt 1: Using proxy IP 31.56.139.207 137 | Requesting Turnstile captcha solution from 2Captcha... 138 | Turnstile captcha solved successfully. 139 | Claim response: https://www.megaexplorer.xyz/tx/transaction_hash_here 140 | Claim SUCCESS for wallet 0xYourWalletAddress1 141 | ``` 142 | 143 | ## Logging 144 | 145 | - **Successful Claims:** All successful transactions are recorded in `success.txt`. 146 | - **Failed Attempts:** Any errors or failed transactions are recorded in `fail.txt`. 147 | 148 | ## About MegaETH 149 | 150 | [MegaETH](https://megaeth.org/) is a state-of-the-art, Layer 2 blockchain network designed to supercharge Ethereum by providing high scalability and low-latency transactions. Key points include: 151 | 152 | - **High Throughput:** Capable of processing over 100,000 transactions per second (TPS). 153 | - **Modular Architecture:** Utilizes specialized nodes such as sequencers, provers, and full nodes to optimize transaction ordering and execution. 154 | - **EVM Compatibility:** Fully compatible with the Ethereum Virtual Machine, ensuring seamless integration with existing Ethereum infrastructure. 155 | 156 | This automation script is built for users who want to leverage the fast-paced transactions on the MegaETH network for automated token claims. 157 | 158 | ## Contribution 159 | 160 | Contributions are highly encouraged! If you have improvements, feature suggestions, or bug fixes, please open an issue or submit a pull request. Your contributions help make the MegaETH ecosystem even stronger. 161 | 162 | ## License 163 | 164 | This project is open source and available under the [MIT License](LICENSE). 165 | 166 | 167 | 168 | 169 | ## Disclaimer 170 | 171 | Use this script responsibly. The developer is not liable for any misuse or unintended consequences. Always test in a safe environment before deploying in production. 172 | 173 | [![Join our Telegram RU](https://img.shields.io/badge/Telegram-RU-03A500?style=for-the-badge&logo=telegram&logoColor=white&labelColor=blue&color=red)](https://t.me/hidden_coding) 174 | [![GitHub](https://img.shields.io/badge/GitHub-181717?style=for-the-badge&logo=github&logoColor=white)](https://github.com/aero25x) 175 | [![Twitter](https://img.shields.io/badge/Twitter-1DA1F2?style=for-the-badge&logo=x&logoColor=white)](https://x.com/aero25x) 176 | [![YouTube](https://img.shields.io/badge/YouTube-FF0000?style=for-the-badge&logo=youtube&logoColor=white)](https://www.youtube.com/@flaming_chameleon) 177 | [![Reddit](https://img.shields.io/badge/Reddit-FF3A00?style=for-the-badge&logo=reddit&logoColor=white)](https://www.reddit.com/r/HiddenCode/) 178 | [![Join our Telegram ENG](https://img.shields.io/badge/Telegram-EN-03A500?style=for-the-badge&logo=telegram&logoColor=white&labelColor=blue&color=red)](https://t.me/hidden_coding_en) 179 | -------------------------------------------------------------------------------- /faucet.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | print(""" 4 | 5 | 6 | 7 | _ _ _ _ _ _____ _ 8 | | | | (_) | | | | / ____| | | 9 | | |__| |_ __| | __| | ___ _ __ | | ___ __| | ___ 10 | | __ | |/ _` |/ _` |/ _ \ '_ \| | / _ \ / _` |/ _ \\ 11 | | | | | | (_| | (_| | __/ | | | |___| (_) | (_| | __/ 12 | |_| |_|_|\__,_|\__,_|\___|_| |_|\_____\___/ \__,_|\___| 13 | 14 | MegaETH Faucet by Aero25x 15 | 16 | Join us to get more scripts 17 | https://t.me/hidden_coding 18 | 19 | 20 | """) 21 | 22 | 23 | # ================== IMPORTS ================== 24 | import json 25 | import time 26 | import requests 27 | from twocaptcha import TwoCaptcha 28 | from colorama import init, Fore 29 | from datetime import datetime 30 | import threading 31 | from tzlocal import get_localzone 32 | from concurrent.futures import ThreadPoolExecutor, as_completed 33 | 34 | # ================== INITIALIZATION ================== 35 | init(autoreset=True) 36 | 37 | # ================== CONFIGURATION ================== 38 | THREADS = 5 # Number of threads to use 39 | TWO_CAPTCHA_API_KEY = "" # 2Captcha API key 40 | 41 | TURNSTILE_SITEKEY = "0x4AAAAAABA4JXCaw9E2Py-9" # Turnstile site key 42 | TURNSTILE_PAGE_URL = "https://testnet.megaeth.com/" # Turnstile page URL 43 | MEGAETH_API_URL = "https://carrot.megaeth.com/claim" # Megaeth claim endpoint 44 | 45 | WALLETS_FILE = "wallet.txt" # Primary wallets file 46 | WALLETS_JSON_FILE = "wallets.json" # Secondary wallets file (JSON format) 47 | PROXIES_FILE = "proxy.txt" # Proxies file 48 | 49 | SUCCESS_FILE = "success.txt" # File to log successful claims 50 | FAIL_FILE = "fail.txt" # File to log failed claims 51 | 52 | HEADERS = { 53 | "Accept": "*/*", 54 | "Content-Type": "text/plain;charset=UTF-8", 55 | "Origin": "https://testnet.megaeth.com", 56 | "Referer": "https://testnet.megaeth.com/", 57 | "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 " 58 | "(KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36" 59 | } 60 | 61 | # ================== UTILITY FUNCTIONS ================== 62 | def read_lines(filepath): 63 | """Read non-empty lines from a file.""" 64 | try: 65 | with open(filepath, 'r') as f: 66 | return [line.strip() for line in f if line.strip()] 67 | except Exception as e: 68 | print(Fore.RED + f"Error reading {filepath}: {e}") 69 | return [] 70 | 71 | def read_wallets(): 72 | """ 73 | Read wallet addresses from both wallet.txt and wallets.json files. 74 | Returns a combined list of wallet addresses. 75 | """ 76 | wallets = read_lines(WALLETS_FILE) 77 | try: 78 | with open(WALLETS_JSON_FILE, "r") as f: 79 | wallets_json = json.load(f) 80 | wallets += [entry['address'] for entry in wallets_json if 'address' in entry] 81 | except Exception as e: 82 | print(Fore.YELLOW + f"Warning: {WALLETS_JSON_FILE} not found or error reading it: {e}") 83 | return wallets 84 | 85 | # ================== PROXY MANAGEMENT ================== 86 | proxies_list = read_lines(PROXIES_FILE) 87 | proxy_index = 0 88 | PROXY_LOCK = threading.Lock() 89 | 90 | def format_proxy(proxy_str): 91 | """ 92 | Convert a proxy string in the format "ip:port:user:pass" or "ip:port" 93 | into a dictionary suitable for the requests module. 94 | """ 95 | parts = proxy_str.split(':') 96 | if len(parts) == 4: 97 | ip, port, user, passwd = parts 98 | formatted = f"http://{user}:{passwd}@{ip}:{port}" 99 | return {'http': formatted, 'https': formatted} 100 | elif len(parts) == 2: 101 | ip, port = parts 102 | formatted = f"http://{ip}:{port}" 103 | return {'http': formatted, 'https': formatted} 104 | else: 105 | raise ValueError(f"Invalid proxy format: {proxy_str}") 106 | 107 | def get_next_proxy(): 108 | """Cycle through the proxies list in a thread-safe manner.""" 109 | global proxy_index 110 | with PROXY_LOCK: 111 | if not proxies_list: 112 | return None 113 | proxy = proxies_list[proxy_index % len(proxies_list)] 114 | proxy_index += 1 115 | return proxy 116 | 117 | def get_current_ip(proxy_str): 118 | """Get current IP address using the provided proxy string.""" 119 | try: 120 | proxy_dict = format_proxy(proxy_str) 121 | except ValueError as e: 122 | print(Fore.RED + f"Proxy formatting error: {e}") 123 | return "Invalid Proxy" 124 | try: 125 | r = requests.get("https://api.myip.com", proxies=proxy_dict, timeout=30) 126 | if r.status_code == 200: 127 | return r.json().get("ip", "Unknown IP") 128 | except Exception as e: 129 | print(Fore.RED + f"Error getting IP with proxy {proxy_str}: {e}") 130 | return "Unknown IP" 131 | 132 | # ================== CAPTCHA SOLVER ================== 133 | def solve_turnstile(): 134 | """ 135 | Solve the Turnstile captcha using 2Captcha. 136 | Returns the captcha token if successful. 137 | """ 138 | try: 139 | solver = TwoCaptcha(TWO_CAPTCHA_API_KEY) 140 | print(Fore.YELLOW + "Requesting Turnstile captcha solution from 2Captcha...") 141 | result = solver.turnstile(sitekey=TURNSTILE_SITEKEY, url=TURNSTILE_PAGE_URL) 142 | token = result.get("code") 143 | if token: 144 | print(Fore.GREEN + "Turnstile captcha solved successfully.") 145 | return token 146 | else: 147 | print(Fore.RED + f"Invalid response from captcha solver: {result}") 148 | except Exception as e: 149 | print(Fore.RED + f"Turnstile captcha solve error: {e}") 150 | return None 151 | 152 | # ================== CLAIM FUNCTION ================== 153 | def megaeth_claim(wallet, token, proxy_str): 154 | """ 155 | Send a claim request to the Megaeth faucet. 156 | Returns the response JSON. 157 | """ 158 | try: 159 | proxy_dict = format_proxy(proxy_str) 160 | except ValueError as e: 161 | print(Fore.RED + f"Proxy formatting error: {e}") 162 | return None 163 | try: 164 | response = requests.post( 165 | MEGAETH_API_URL, 166 | json={"addr": wallet, "token": token}, 167 | headers=HEADERS, 168 | proxies=proxy_dict, 169 | timeout=60 170 | ) 171 | return response.json() 172 | except Exception as e: 173 | print(Fore.RED + f"Claim API error for {wallet}: {e}") 174 | return None 175 | 176 | # ================== WALLET PROCESSING ================== 177 | def process_wallet(wallet, stop_event): 178 | """ 179 | Process a single wallet: 180 | - Cycle through proxies. 181 | - Solve the captcha. 182 | - Attempt to claim the faucet (retry up to 3 times). 183 | Logs success or failure. 184 | """ 185 | print(Fore.CYAN + f"Processing wallet: {wallet}") 186 | max_retries = 3 187 | attempts = 0 188 | success_flag = False 189 | 190 | while attempts < max_retries and not success_flag: 191 | if stop_event.is_set(): 192 | print(Fore.CYAN + "Stop event detected. Exiting thread.") 193 | return 194 | 195 | proxy_str = get_next_proxy() 196 | ip = get_current_ip(proxy_str) 197 | print(Fore.YELLOW + f"Attempt {attempts + 1}: Using proxy IP {ip}") 198 | 199 | captcha_token = solve_turnstile() 200 | if not captcha_token: 201 | print(Fore.RED + "Captcha solving failed. Retrying...") 202 | attempts += 1 203 | continue 204 | 205 | resp = megaeth_claim(wallet, captcha_token, proxy_str) 206 | if resp: 207 | tx_hash = resp.get("txhash", "") 208 | print(Fore.CYAN + f"Claim response: https://www.megaexplorer.xyz/tx/{tx_hash}") 209 | message = resp.get("message", "").lower() 210 | if "less than" in message and "hours have passed since the last claim" in message: 211 | print(Fore.YELLOW + f"Wallet {wallet} has claimed recently. Skipping further attempts.") 212 | return 213 | if resp.get("success", False) and tx_hash: 214 | success_flag = True 215 | else: 216 | print(Fore.RED + "Claim not successful, retrying...") 217 | else: 218 | print(Fore.RED + "No response from claim API, retrying...") 219 | 220 | attempts += 1 221 | 222 | if success_flag: 223 | print(Fore.GREEN + f"Claim SUCCESS for wallet {wallet}") 224 | with open(SUCCESS_FILE, "a") as f: 225 | f.write(wallet + "\n") 226 | else: 227 | print(Fore.RED + f"Claim FAILED after {max_retries} attempts for wallet {wallet}") 228 | with open(FAIL_FILE, "a") as f: 229 | f.write(wallet + "\n") 230 | 231 | # ================== MAIN PROCESS ================== 232 | def main_process(stop_event): 233 | """Main function to process all wallets using multi-threading.""" 234 | print(Fore.CYAN + "Starting Megaeth Faucet Claim Process...") 235 | wallets = read_wallets() 236 | if not wallets: 237 | print(Fore.RED + "No wallets found. Exiting.") 238 | return 239 | 240 | with ThreadPoolExecutor(max_workers=THREADS) as executor: 241 | futures = {executor.submit(process_wallet, wallet, stop_event): wallet for wallet in wallets} 242 | try: 243 | for future in as_completed(futures): 244 | future.result() 245 | except KeyboardInterrupt: 246 | print(Fore.CYAN + "KeyboardInterrupt detected. Stopping all threads...") 247 | stop_event.set() 248 | for future in futures: 249 | future.cancel() 250 | raise 251 | 252 | if __name__ == "__main__": 253 | stop_event = threading.Event() 254 | try: 255 | main_process(stop_event) 256 | except KeyboardInterrupt: 257 | print(Fore.CYAN + "User interrupted the process. Exiting...") 258 | --------------------------------------------------------------------------------