├── README.md └── main.py /README.md: -------------------------------------------------------------------------------- 1 | # ربات تراکنش اتوماتیک در تست نت kakarot 2 | ![image](https://github.com/user-attachments/assets/9ae886b4-c600-4200-a8fd-e19571123dc4) 3 | 4 | ## برای استفاده از این ربات مراحل زیر را اجرا کنید 5 | 1. نصب محیط مجازی پایتون 6 | 7 | ``` 8 | python3 -m venv path/to/venv 9 | ``` 10 | ``` 11 | source path/to/venv/bin/activate 12 | ``` 13 | ``` 14 | pip install web3 python-dotenv prompt-toolkit 15 | ``` 16 | 2. دانلود و اجرای ربات 17 | 18 | ``` 19 | git clone https://github.com/xONEIROS/kakarotBot.git 20 | cd kakarotBot 21 | ``` 22 | ``` 23 | python main.py 24 | ``` 25 | -------------------------------------------------------------------------------- /main.py: -------------------------------------------------------------------------------- 1 | from web3 import Web3, Account 2 | import json 3 | import os 4 | from dotenv import load_dotenv 5 | from prompt_toolkit import prompt 6 | import time 7 | 8 | # Function to write private key to .env file 9 | def save_private_key_to_env(private_key): 10 | with open('.env', 'w') as env_file: 11 | env_file.write(f'PRIVATE_KEYS=\'["{private_key}"]\'') 12 | 13 | # Load environment variables 14 | def load_env(): 15 | load_dotenv() 16 | 17 | # Constants 18 | RPC_URL = 'https://sepolia-rpc.kakarot.org' 19 | CHAIN_ID = 1802203764 20 | 21 | def generate_random_address(): 22 | return Web3.to_checksum_address(Web3.keccak(os.urandom(20))[:20].hex()) 23 | 24 | def display_header(): 25 | header = r""" 26 | ____ ____ ____ ____ ____ ____ ____ 27 | ||O |||N |||E |||I |||R |||O |||S || 28 | ||__|||__|||__|||__|||__|||__|||__|| 29 | |/__\|/__\|/__\|/__\|/__\|/__\|/__\| 30 | """ 31 | twitter_link = "\033[92mhttps://x.com/0xOneiros\033[0m" 32 | print(header) 33 | print(twitter_link) 34 | 35 | def get_valid_input(prompt_text, input_type=int): 36 | while True: 37 | try: 38 | return input_type(prompt(prompt_text)) 39 | except ValueError: 40 | print(f"Please enter a valid {input_type.__name__}") 41 | 42 | def main(): 43 | display_header() 44 | 45 | # Get private key from user 46 | private_key = prompt('Please enter your private key: ') 47 | save_private_key_to_env(private_key) 48 | load_env() 49 | 50 | private_keys = json.loads(os.getenv('PRIVATE_KEYS', '[]')) 51 | 52 | provider = Web3(Web3.HTTPProvider(RPC_URL)) 53 | wallets = [] 54 | for private_key in private_keys: 55 | wallets.append(Account.from_key(private_key.strip())) 56 | 57 | if not wallets: 58 | print('No wallets found') 59 | return 60 | 61 | amount_to_send = get_valid_input('How much ETH do you want to send (in ETH): ', float) 62 | num_addresses = get_valid_input('How many addresses do you want to send to: ', int) 63 | 64 | amount_in_wei = Web3.to_wei(amount_to_send, 'ether') 65 | gas_price = provider.eth.gas_price 66 | 67 | delay_between_transactions = 5 68 | 69 | for wallet in wallets: 70 | balance = provider.eth.get_balance(wallet.address) 71 | balance_in_eth = Web3.from_wei(balance, 'ether') 72 | print(f'Wallet {wallet.address} balance: {balance_in_eth} ETH') 73 | 74 | if balance <= 0: 75 | print(f'Wallet {wallet.address} Insufficient balance. Skipping transactions for this wallet.') 76 | continue 77 | 78 | for _ in range(num_addresses): 79 | random_address = generate_random_address() 80 | tx = { 81 | 'to': random_address, 82 | 'value': amount_in_wei, 83 | 'gas': 21000, 84 | 'gasPrice': gas_price, 85 | 'nonce': provider.eth.get_transaction_count(wallet.address), 86 | 'chainId': CHAIN_ID 87 | } 88 | 89 | try: 90 | signed_tx = wallet.sign_transaction(tx) 91 | tx_hash = provider.eth.send_raw_transaction(signed_tx.raw_transaction) 92 | print(f'Sent {amount_to_send} ETH from {wallet.address} to {random_address}') 93 | print(f'Tx Hash: {tx_hash.hex()}') 94 | except Exception as e: 95 | print(f'Failed to send transaction from {wallet.address} to {random_address}:', e) 96 | 97 | if _ < num_addresses - 1: 98 | time.sleep(delay_between_transactions) 99 | 100 | if wallet != wallets[-1]: 101 | time.sleep(delay_between_transactions) 102 | 103 | if __name__ == '__main__': 104 | main() 105 | --------------------------------------------------------------------------------