├── requirements.txt ├── README.md └── humanity.py /requirements.txt: -------------------------------------------------------------------------------- 1 | web3==6.20.1 2 | colorama -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Auto Daily Claim $RWT Humanity Protocol Bot 2 | 3 | ## Register 4 | Support the Author by Join with Reffs : http://testnet.humanity.org/login?ref=0xalexyamin 5 | 6 | ## Introduction 7 | This bot automates the daily claiming of $RWT rewards from the Humanity Protocol using multiple wallets. It is designed to be easy to set up and use. 8 | 9 | ## Getting Started 10 | 11 | Follow these steps to set up and run the bot on your local machine. 12 | 13 | ### 1. Clone the Repository 14 | 15 | To start, clone this repository to your local machine using Git: 16 | 17 | ```bash 18 | git clone https://github.com/ganjsmoke/Humanity.git 19 | ``` 20 | 21 | ### 2. Change Directory to the Cloned Folder 22 | 23 | Navigate to the folder where the repository was cloned: 24 | 25 | ```bash 26 | cd Humanity 27 | ``` 28 | 29 | ### 3. Create the private_keys.txt File 30 | Create a private_keys.txt file in the root directory of the project. This file should contain one private key per line, like so: 31 | 32 | ```python 33 | private_key_1 34 | private_key_2 35 | private_key_3 36 | ... 37 | ``` 38 | 39 | ### 4. Install Required Dependencies 40 | Make sure you have Python installed on your system. Then, install the required dependencies using the requirements.txt file: 41 | 42 | ```bash 43 | pip install -r requirements.txt 44 | ``` 45 | 46 | ### 5. Run the Bot 47 | Once everything is set up, you can run the bot with the following command: 48 | 49 | ```bash 50 | python3 humanity.py 51 | ``` 52 | -------------------------------------------------------------------------------- /humanity.py: -------------------------------------------------------------------------------- 1 | import time 2 | import threading 3 | import requests 4 | from web3 import Web3 5 | from colorama import init, Fore, Style 6 | import sys 7 | 8 | # Initialize colorama 9 | init(autoreset=True) 10 | 11 | # Header message 12 | def display_header(): 13 | print(Fore.CYAN + Style.BRIGHT + "===============================") 14 | print(Fore.YELLOW + Style.BRIGHT + "Auto Daily Claim $RWT Humanity Protocol") 15 | print(Fore.CYAN + Style.BRIGHT + "Bot created by: " + Fore.GREEN + "https://t.me/airdropwithmeh") 16 | print(Fore.CYAN + Style.BRIGHT + "===============================\n") 17 | 18 | # Connect to the blockchain network 19 | rpc_url = 'https://rpc.testnet.humanity.org' 20 | web3 = Web3(Web3.HTTPProvider(rpc_url)) 21 | 22 | # Check if connected to the network 23 | if web3.is_connected(): 24 | print(Fore.GREEN + "Connected to Humanity Protocol") 25 | else: 26 | print(Fore.RED + "Connection failed.") 27 | sys.exit(1) # Exit if connection fails 28 | 29 | # Smart contract address and ABI 30 | contract_address = '0xa18f6FCB2Fd4884436d10610E69DB7BFa1bFe8C7' 31 | contract_abi = [{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"anonymous":False,"inputs":[{"indexed":False,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":False,"inputs":[{"indexed":True,"internalType":"address","name":"from","type":"address"},{"indexed":True,"internalType":"address","name":"to","type":"address"},{"indexed":False,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":False,"internalType":"bool","name":"bufferSafe","type":"bool"}],"name":"ReferralRewardBuffered","type":"event"},{"anonymous":False,"inputs":[{"indexed":True,"internalType":"address","name":"user","type":"address"},{"indexed":True,"internalType":"enum IRewards.RewardType","name":"rewardType","type":"uint8"},{"indexed":False,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"RewardClaimed","type":"event"},{"anonymous":False,"inputs":[{"indexed":True,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":True,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":True,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":False,"inputs":[{"indexed":True,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":True,"internalType":"address","name":"account","type":"address"},{"indexed":True,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":False,"inputs":[{"indexed":True,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":True,"internalType":"address","name":"account","type":"address"},{"indexed":True,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"claimBuffer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentEpoch","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cycleStartTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"vcContract","type":"address"},{"internalType":"address","name":"tkn","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"startTimestamp","type":"uint256"}],"name":"start","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stop","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"userBuffer","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"epochID","type":"uint256"}],"name":"userClaimStatus","outputs":[{"components":[{"internalType":"uint256","name":"buffer","type":"uint256"},{"internalType":"bool","name":"claimStatus","type":"bool"}],"internalType":"struct IRewards.UserClaim","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"userGenesisClaimStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}] 32 | 33 | # Load the contract 34 | contract = web3.eth.contract(address=Web3.to_checksum_address(contract_address), abi=contract_abi) 35 | 36 | # Function to load private keys from a text file 37 | def load_private_keys(file_path): 38 | with open(file_path, 'r') as file: 39 | private_keys = [line.strip() for line in file if line.strip()] 40 | return private_keys 41 | 42 | # Function to claim rewards 43 | def claim_rewards(private_key): 44 | try: 45 | # Derive the sender's address from the private key 46 | account = web3.eth.account.from_key(private_key) 47 | sender_address = account.address 48 | 49 | # Check if the genesis reward has already been claimed 50 | genesis_reward_claimed = contract.functions.userGenesisClaimStatus(sender_address).call() 51 | 52 | # Get the current epoch from the contract 53 | current_epoch = contract.functions.currentEpoch().call() 54 | 55 | # Check if the reward has already been claimed for the current epoch 56 | reward_claim_status = contract.functions.userClaimStatus(sender_address, current_epoch).call() 57 | 58 | # reward_claim_status is a tuple: (buffer, claimStatus) 59 | buffer_amount, claim_status = reward_claim_status 60 | 61 | # If the genesis reward is claimed 62 | if genesis_reward_claimed: 63 | # If userClaimStatus is False, proceed to claim the reward 64 | if not claim_status: 65 | print(Fore.GREEN + f"Proceeding to claim reward for address: {sender_address} (Genesis reward claimed).") 66 | proceed_to_claim(sender_address, private_key) 67 | else: 68 | print(Fore.YELLOW + f"Reward already claimed for address: {sender_address} in epoch {current_epoch}. Skipping.") 69 | 70 | # If the genesis reward is not claimed 71 | else: 72 | print(Fore.GREEN + f"Proceeding to claim reward for address: {sender_address} (Genesis reward not claimed).") 73 | proceed_to_claim(sender_address, private_key) 74 | 75 | except Exception as e: 76 | error_message = str(e) 77 | 78 | # Check for specific error: "Rewards: user not registered" 79 | if "Rewards: user not registered" in error_message: 80 | print(Fore.RED + f"Error: User {sender_address} is not registered.") 81 | else: 82 | print(Fore.RED + f"Error claiming reward for {sender_address}: {error_message}") 83 | 84 | def proceed_to_claim(sender_address, private_key): 85 | try: 86 | # Estimate gas limit for the claimReward transaction 87 | gas_amount = contract.functions.claimReward().estimate_gas({ 88 | 'chainId': web3.eth.chain_id, 89 | 'from': sender_address, 90 | 'gasPrice': web3.eth.gas_price, 91 | 'nonce': web3.eth.get_transaction_count(sender_address) 92 | }) 93 | 94 | # Build the transaction to call the 'claimReward' function 95 | transaction = contract.functions.claimReward().build_transaction({ 96 | 'chainId': web3.eth.chain_id, 97 | 'from': sender_address, 98 | 'gas': gas_amount, 99 | 'gasPrice': web3.eth.gas_price, 100 | 'nonce': web3.eth.get_transaction_count(sender_address) 101 | }) 102 | 103 | # Sign the transaction with the private key 104 | signed_txn = web3.eth.account.sign_transaction(transaction, private_key=private_key) 105 | 106 | # Send the transaction 107 | tx_hash = web3.eth.send_raw_transaction(signed_txn.rawTransaction) 108 | 109 | # Wait for the transaction receipt 110 | tx_receipt = web3.eth.wait_for_transaction_receipt(tx_hash) 111 | 112 | print(Fore.GREEN + f"Transaction successful for {sender_address} with hash: {web3.to_hex(tx_hash)}") 113 | 114 | except Exception as e: 115 | print(Fore.RED + f"Error processing claim for {sender_address}: {str(e)}") 116 | 117 | # Function to claim faucet tokens 118 | def claim_faucet(wallet_address): 119 | url = "https://faucet.testnet.humanity.org/api/claim" 120 | payload = { 121 | "address": wallet_address 122 | } 123 | 124 | try: 125 | response = requests.post(url, json=payload) 126 | response_data = response.json() 127 | 128 | # Check if the request was successful 129 | if "msg" in response_data: 130 | tx_hash = response_data["msg"] 131 | print(Fore.GREEN + f"Faucet claim successful for {wallet_address}, TxHash: {tx_hash}") 132 | else: 133 | print(Fore.RED + f"Faucet claim failed for {wallet_address}, Response: {response_data}") 134 | 135 | except Exception as e: 136 | print(Fore.RED + f"Error claiming faucet for {wallet_address}: {str(e)}") 137 | 138 | # Function to perform periodic task (including faucet claim) 139 | def perform_periodic_task(): 140 | while True: 141 | private_keys = load_private_keys('private_keys.txt') 142 | for private_key in private_keys: 143 | # Derive the sender's address from the private key 144 | account = web3.eth.account.from_key(private_key) 145 | wallet_address = account.address 146 | # Call the claim faucet function 147 | claim_faucet(wallet_address) 148 | 149 | # Wait 1 minute before claiming for the next wallet 150 | print(Fore.CYAN + "Waiting 1 minute before claiming for the next wallet...") 151 | time.sleep(60) 152 | 153 | # Optionally add other periodic tasks here, if needed 154 | 155 | # Main execution: display header, load private keys, and claim rewards for each 156 | if __name__ == "__main__": 157 | display_header() 158 | 159 | # Start the periodic task in a separate thread 160 | periodic_task_thread = threading.Thread(target=perform_periodic_task, daemon=True) 161 | periodic_task_thread.start() 162 | 163 | # Infinite loop to run the process every 6 hours (claiming rewards) 164 | while True: 165 | private_keys = load_private_keys('private_keys.txt') 166 | for private_key in private_keys: 167 | claim_rewards(private_key) 168 | 169 | # Wait for 6 hours (1 * 60 * 60 seconds) 170 | print(Fore.CYAN + "Waiting for 6 hours before the next run...") 171 | time.sleep(6*60*60) # For testing purposes, you may want to reduce this time 172 | --------------------------------------------------------------------------------