├── BNB Chain ├── .DS_Store ├── BuySpecificToken │ ├── BuyaSpecificToken.py │ └── config.py ├── DEX │ ├── CheckIfLiquidity_IsAdded.py │ └── NewlyCreatedPair.py ├── Evaluate Bsc Token │ ├── AfterLP-buy.py │ ├── Evaluate-BSCTOKEN.py │ ├── Evaluate-Binance-Token.py │ ├── GetLocktime.py │ ├── Scam-metrics.md │ ├── Wallet-trade-history.py │ ├── abi.py │ └── config.py ├── Memepool │ ├── AnalazizeProfitablitly.py │ ├── DecodeMulticall.py │ ├── PanCakeSwapV3Memepool.py │ ├── Pancakeswap_memepool.py │ ├── Sandwich-Attack.py │ ├── config.py │ └── router_abi.json ├── Miscellaneous │ ├── GetContractEventNames.py │ ├── GetTelegramGroup.py │ ├── GetTokenReserves_WithRIghtIndex.py │ └── GettokenPrice_BNB_and_USDT.py ├── Trading │ ├── AddLiquidityEvents.py │ ├── BuyWithMultipleAddress.py │ ├── CopyBuy_Sells.py │ ├── CopyWalletTrade.py │ ├── LaunchBot.py │ ├── MonitorMultipleAddresses.py │ ├── TrackEOA_ReceivingBNB.py │ ├── TrackingSmartContractEvents.py │ └── sendMessage.py └── Wallet │ ├── BuywithMultipleWallets.py │ ├── Hd-wallet.py │ ├── MonitorMultipleWallets.py │ ├── MonitorPriceandSell.py │ ├── SendBNB-MultipleWallets.py │ ├── addresses_and_keys.crypto │ └── create-multiple-BSCaddress.py ├── Ethereum ├── Buy_Sell │ └── Buy_Sell.py ├── DEX │ ├── CheckIfLiquidity_IsAdded.py │ └── NewlyCreatedPair.py ├── Decoding │ ├── Example_1.py │ └── Example_2.py ├── Evaluate ERC20 Token │ ├── EvaluateToken_HoneypotAPI.py │ ├── GetLocktime.py │ ├── Token-Early-Transactions.py │ ├── TokenProperty.py │ └── Ultimate_TokenEvaluator.py ├── GasFees │ └── gas_fees.py ├── GoogleCloudSetUp │ └── Instructions.md ├── JarethFromSubway │ ├── jareth_anlytics.py │ ├── jareth_copytrade.py │ └── uniswapAnalytics.py ├── Launchpads │ ├── All_LaunchpadsEvents.py │ ├── PinkySaleLockEvents.py │ ├── TrustswapSecurity.py │ └── UnicryptLockEvents.py ├── Memepool │ ├── AllrouterAddresses.py │ ├── DecodingExecuteFunction.py │ ├── DecodingMulticall.py │ ├── memepool2.0.py │ ├── router_abi.json │ ├── simple.py │ └── v3Memepool.py ├── Miscellaneous │ ├── Block_logs.py │ ├── GetEventNames.py │ ├── GetTokenPairFromLp.py │ └── SpecificTokenInWallet_PriceInWETHUSDT.py ├── Monitoring │ ├── Monitor-MultipleLp-Concurrently.py │ └── MonitorPools-TokenOwned.py ├── Trading │ ├── AddLp_Events.py │ ├── BuyTokenErc20-1inch.py │ ├── CopyAnyWallets-Buy_Sells.py │ ├── CopyTrade-IrrespectiveOfRouter.py │ ├── CopyWalletTrade.py │ ├── GaslessApprove.py │ ├── MonitorPriceOfBoughtToken.py │ ├── MonitorPriceandSell.py │ ├── Monitor_TokenLiquidityTxn.py │ ├── SnipeOnSameBlock.py │ ├── Subscribe.py │ ├── TrackLockEvents.py │ └── jarethfromsubway.py └── Wallet │ ├── BuyWithMultipleWallets.py │ ├── Hd-wallet.py │ ├── MultisignatureWallet.py │ └── create-multiple-ETHaddress.py ├── LICENSE ├── Learning Resources └── myLearningResources.md ├── Notes └── Todo.txt ├── README.md ├── SDK └── AlchemyPythonSDK │ ├── BananGunRouter_Buys_Sells.py │ ├── CopyTrade_MultipleWallets.py │ ├── GetNumberOfBuys.py │ ├── MonitorWallet_MinedTransactions.py │ ├── MonitorWallet_PendingTransaction.py │ ├── SMS_Notifications.py │ └── Send_PrivateTxn ├── Smart Contracts ├── BuyandSell.sol ├── ER20HoneypotChecker.sol ├── MEV_Bot.sol ├── Memepool.sol ├── Sameblock.sol └── ScanNewlyCreatedPairs.sol ├── Solana ├── Listen_tokenBurns.py ├── Miscellaneous │ ├── Deserialize.py │ ├── Deserialize_SPL.py │ ├── GetAmmID.py │ └── GetPool_Info.py ├── Monitor │ ├── Buy_Sells.py │ ├── Concurrent-Monitoring-Accounts.py │ ├── DifferentTransactionBuilds.py │ └── MonitorWalletList.py ├── NewPairs_Simple.py ├── NewlyCreatedPairs.py ├── Solana Dev Resources.txt ├── Solana-Web3JS │ ├── DecodeMarketBid.ts │ └── NewPoolRaydium.js ├── TokenAnalysis.py ├── TrackBots.py ├── Trade │ ├── Buy.py │ ├── Sell.py │ ├── create_close_account.py │ ├── dexscreener.py │ └── layouts.py ├── Wallet │ ├── .env │ ├── Create_WalletAddress.py │ └── WalletFrom_PrivateKey.py ├── Wallet_AddressAnalytics.py ├── copyTrade.py ├── progam.py └── spl-token-Analytics.py ├── Subgraphs └── NewlyCreatedPairs.py └── Telegram Bot ├── snipe_telegram.py └── tg.py /BNB Chain/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BitFancy/Solana-Trading-Bot/c5bf9b933bc01278b6d292052a744f2ca4969f3b/BNB Chain/.DS_Store -------------------------------------------------------------------------------- /BNB Chain/BuySpecificToken/config.py: -------------------------------------------------------------------------------- 1 | 2 | WalletAddress="Enter Your Wallet Address Here " 3 | 4 | private2= "Enter Your Private Key" 5 | -------------------------------------------------------------------------------- /BNB Chain/DEX/CheckIfLiquidity_IsAdded.py: -------------------------------------------------------------------------------- 1 | import json 2 | from web3 import Web3 3 | import time 4 | import datetime 5 | import requests 6 | 7 | 8 | 9 | class style(): # Class of different text colours - default is white 10 | BLACK = '\033[30m' 11 | RED = '\033[31m' 12 | GREEN = '\033[32m' 13 | YELLOW = '\033[33m' 14 | BLUE = '\033[34m' 15 | MAGENTA = '\033[35m' 16 | CYAN = '\033[36m' 17 | WHITE = '\033[37m' 18 | UNDERLINE = '\033[4m' 19 | RESET = '\033[0m' 20 | 21 | 22 | 23 | 24 | def getTimestamp(): 25 | while True: 26 | timeStampData = datetime.datetime.now() 27 | currentTimeStamp = "[" + timeStampData.strftime("%H:%M:%S.%f")[:-3] + "]" 28 | return currentTimeStamp 29 | 30 | 31 | web3 = Web3(Web3.HTTPProvider("https://bsc-dataseed2.binance.org/")) 32 | if web3.is_connected(): 33 | print(getTimestamp()," BSC Node successfully connected") 34 | 35 | contract_address = input("Enter Token Address: ") 36 | WBNB= "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" 37 | 38 | pancake_factory = '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73' # Testnet #0x6725F303b657a9451d8BA641348b6761A6CC7a17 39 | pancake_factory_abi = json.loads('[{"inputs":[{"internalType":"address","name":"_feeToSetter","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"PairCreated","type":"event"},{"constant":true,"inputs":[],"name":"INIT_CODE_PAIR_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allPairs","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"allPairsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"}],"name":"createPair","outputs":[{"internalType":"address","name":"pair","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feeTo","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeToSetter","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getPair","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_feeTo","type":"address"}],"name":"setFeeTo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_feeToSetter","type":"address"}],"name":"setFeeToSetter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]') 40 | contract = web3.eth.contract(address=pancake_factory, abi=pancake_factory_abi) 41 | lp_abi = '[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint112","name":"reserve0","type":"uint112"},{"indexed":false,"internalType":"uint112","name":"reserve1","type":"uint112"}],"name":"Sync","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":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"_reserve0","type":"uint112"},{"internalType":"uint112","name":"_reserve1","type":"uint112"},{"internalType":"uint32","name":"_blockTimestampLast","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"kLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"price0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"skim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount0Out","type":"uint256"},{"internalType":"uint256","name":"amount1Out","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"sync","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]' 42 | 43 | 44 | 45 | 46 | 47 | def get_liquidity_balance(lp_address): 48 | lp_contract = web3.eth.contract(address=lp_address, abi=lp_abi) 49 | reserves = lp_contract.functions.getReserves().call() 50 | balance = reserves[0] 51 | return balance 52 | 53 | def check_liquidity(lp_address): 54 | balance = get_liquidity_balance(lp_address) 55 | if balance > 0: 56 | print(f"{getTimestamp()} Liquidity balance detected' {balance}") 57 | #buy() # We can set up buy as soon as liquidity is added 58 | else: 59 | pass 60 | #print('No liquidity balance detected') 61 | 62 | 63 | 64 | def run_lp_check(): 65 | lp_address = contract.functions.getPair(contract_address, WBNB).call() 66 | if lp_address != web3.to_checksum_address('0x0000000000000000000000000000000000000000'): 67 | #print('LP address detected:', lp_address) 68 | check_liquidity(lp_address) 69 | return True 70 | else: 71 | print('No LP address found') 72 | return False 73 | print("Checking for Liquidity....") 74 | 75 | while True: 76 | #print("Checking for Liquidity....") 77 | run_lp_check() 78 | time.sleep(1) 79 | 80 | 81 | -------------------------------------------------------------------------------- /BNB Chain/DEX/NewlyCreatedPair.py: -------------------------------------------------------------------------------- 1 | import json 2 | from web3 import Web3 3 | import asyncio 4 | import time 5 | import datetime 6 | import requests 7 | 8 | 9 | 10 | class style(): # Class of different text colours - default is white 11 | BLACK = '\033[30m' 12 | RED = '\033[31m' 13 | GREEN = '\033[32m' 14 | YELLOW = '\033[33m' 15 | BLUE = '\033[34m' 16 | MAGENTA = '\033[35m' 17 | CYAN = '\033[36m' 18 | WHITE = '\033[37m' 19 | UNDERLINE = '\033[4m' 20 | RESET = '\033[0m' 21 | 22 | 23 | 24 | 25 | def getTimestamp(): 26 | while True: 27 | timeStampData = datetime.datetime.now() 28 | currentTimeStamp = "[" + timeStampData.strftime("%H:%M:%S.%f")[:-3] + "]" 29 | return currentTimeStamp 30 | 31 | 32 | web3 = Web3(Web3.HTTPProvider("https://bsc-dataseed2.binance.org/")) 33 | if web3.is_connected(): 34 | print(getTimestamp()," BSC Node successfully connected") 35 | 36 | 37 | 38 | # 39 | # pancakeswap factory 40 | pancake_factory = '0xcA143Ce32Fe78f1f7019d7d551a6402fC5350c73' # Testnet #0x6725F303b657a9451d8BA641348b6761A6CC7a17 41 | pancake_factory_abi = json.loads( 42 | '[{"inputs":[{"internalType":"address","name":"_feeToSetter","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"PairCreated","type":"event"},{"constant":true,"inputs":[],"name":"INIT_CODE_PAIR_HASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allPairs","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"allPairsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"}],"name":"createPair","outputs":[{"internalType":"address","name":"pair","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feeTo","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeToSetter","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getPair","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_feeTo","type":"address"}],"name":"setFeeTo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_feeToSetter","type":"address"}],"name":"setFeeToSetter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]') 43 | contract = web3.eth.contract(address=pancake_factory, abi=pancake_factory_abi) 44 | """Connection to Pancakeswap""" 45 | 46 | tokenNameABI = json.loads( 47 | '[ { "anonymous": false, "inputs": [ { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } ], "name": "Approval", "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": "value", "type": "uint256" } ], "name": "Transfer", "type": "event" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "_owner", "type": "address" }, { "internalType": "address", "name": "spender", "type": "address" } ], "name": "allowance", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "address", "name": "spender", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "approve", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": true, "inputs": [ { "internalType": "address", "name": "account", "type": "address" } ], "name": "balanceOf", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "decimals", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "getOwner", "outputs": [ { "internalType": "address", "name": "", "type": "address" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "name", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "symbol", "outputs": [ { "internalType": "string", "name": "", "type": "string" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "payable": false, "stateMutability": "view", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transfer", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" }, { "constant": false, "inputs": [ { "internalType": "address", "name": "sender", "type": "address" }, { "internalType": "address", "name": "recipient", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transferFrom", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "payable": false, "stateMutability": "nonpayable", "type": "function" } ]') 48 | 49 | 50 | 51 | #web3.middleware_onion.inject(geth_poa_middleware, layer=0) 52 | 53 | liquidityPairAddress = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" 54 | 55 | #event_filter = contract.events.PairCreated.create_filter(fromBlock=30716374, toBlock=30718978) 56 | 57 | event_filter = contract.events.PairCreated.create_filter(fromBlock="latest") 58 | 59 | while True: 60 | try: 61 | #events = event_filter.get_all_entries() 62 | events = event_filter.get_new_entries() 63 | 64 | if len(events) > 0: 65 | for event in events: 66 | if (event['args']['token1'] == "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"): 67 | tokenAddress = event['args']['token0'] 68 | 69 | getTokenName = web3.eth.contract(address=tokenAddress, 70 | abi=tokenNameABI) 71 | tokenName = getTokenName.functions.name().call() 72 | tokenSymbol = getTokenName.functions.symbol().call() 73 | tx_hash = web3.to_hex(event['transactionHash']) 74 | print( 75 | style.YELLOW + getTimestamp() + " [Token] New Token Detected: " + style.CYAN + tokenName + " (" + tokenSymbol + "): " + style.MAGENTA + tokenAddress + " https://bscscan.com/tx/" + tx_hash + style.RESET) 76 | 77 | elif (event['args']['token0'] == liquidityPairAddress): 78 | tokenAddress = event['args']['token1'] 79 | getTokenName = web3.eth.contract(address=tokenAddress, 80 | abi=tokenNameABI) # code to get name and symbol from token address 81 | tokenName = getTokenName.functions.name().call() 82 | tokenSymbol = getTokenName.functions.symbol().call() 83 | tx_hash = web3.to_hex(event['transactionHash']) 84 | print( 85 | style.RED + getTimestamp() + " [Token] New Token Detected: " + style.CYAN + tokenName + " (" + tokenSymbol + "): " + style.MAGENTA + tokenAddress + " https://bscscan.com/tx/" + tx_hash + style.RESET) 86 | 87 | 88 | else: 89 | print(style.BLUE + "Not WBNB LQ PAIR") 90 | time.sleep(1) 91 | 92 | 93 | except Exception as e: 94 | print(f"Error: {e}") 95 | 96 | 97 | 98 | 99 | 100 | 101 | -------------------------------------------------------------------------------- /BNB Chain/Evaluate Bsc Token/AfterLP-buy.py: -------------------------------------------------------------------------------- 1 | 2 | """ 3 | You actually see early transactions of a project and it's a high determinant of it's success 4 | You just have to know what to fine 5 | This script can help you spot good wallets to follow. 6 | 7 | """ 8 | import requests 9 | import json 10 | 11 | 12 | api_key = 'KFEM9CQIBQVGZWTDGW5VDZGSM5ZYVGJ6KR' 13 | 14 | # Prompt user to input the token contract address and number of wallets 15 | contract_address = input("Enter the token contract address: ") 16 | num_wallets = int(input("Enter the number of Transactions to display: ")) 17 | 18 | # Define the BscScan API URL 19 | url = f"https://api.bscscan.com/api?module=account&action=tokentx&contractaddress={contract_address}&apikey={api_key}" 20 | 21 | # Send a request to BscScan API and parse the JSON response 22 | response = requests.get(url) 23 | data = json.loads(response.text) 24 | 25 | if data['status'] == "1": 26 | transactions = data['result'] 27 | 28 | # Filter transactions and get the first 'num_wallets' wallet addresses 29 | wallets = [] 30 | print(f"\nThe first {num_wallets} wallets that bought the token after liquidity was added:\n") 31 | for tx in transactions: 32 | if tx['from'] != contract_address and tx['to'] != contract_address: 33 | if tx['from'] not in wallets: 34 | wallets.append(tx['from']) 35 | print(f"{len(wallets)}. Wallet: {tx['from']}, TxHash: https://bscscan.com/tx/{tx['hash']}") 36 | 37 | if len(wallets) >= num_wallets: 38 | break 39 | elif tx['to'] == contract_address.lower(): #and len(wallets) == 1: 40 | print(f"Liquidity added transaction: TxHash: {tx['hash']}\n") 41 | else: 42 | print("Error fetching transactions. Please check the contract address and try again.") 43 | -------------------------------------------------------------------------------- /BNB Chain/Evaluate Bsc Token/GetLocktime.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | # Unix timestamp 4 | timestamp = int(input("Enter unix timestamp: ")) 5 | 6 | # Convert the timestamp to a date 7 | date = datetime.datetime.fromtimestamp(timestamp) 8 | 9 | # Get the current date 10 | current_date = datetime.datetime.now() 11 | 12 | lock_date = f"{current_date:%d-%m-%Y %H:%M:%S}" 13 | 14 | # Calculate the difference from current date 15 | difference = date-current_date 16 | locktime= difference.days 17 | print(current_date) 18 | print(locktime) 19 | print("Tokens are locked till: ",lock_date) 20 | print("Months Lock",locktime//30) 21 | print("Years Lock",locktime//365) 22 | -------------------------------------------------------------------------------- /BNB Chain/Evaluate Bsc Token/Scam-metrics.md: -------------------------------------------------------------------------------- 1 | # Key Metrics for Evaluating a Token to determine whether it's a cam 2 | 3 | 4 | If this repository reaches 50 stars, a surprise awaits with some exciting revelations 5 | 6 | 7 | 8 | 9 | 1.**Property 1** 10 | 11 | -------------------------------------------------------------------------------- /BNB Chain/Evaluate Bsc Token/Wallet-trade-history.py: -------------------------------------------------------------------------------- 1 | "Analyse an EOA wallet trade history" -------------------------------------------------------------------------------- /BNB Chain/Evaluate Bsc Token/config.py: -------------------------------------------------------------------------------- 1 | bsc_api ="KFEM9CQIBQVGZWTDGW5VDZGSM5ZYVGJ6KR" 2 | -------------------------------------------------------------------------------- /BNB Chain/Memepool/AnalazizeProfitablitly.py: -------------------------------------------------------------------------------- 1 | """This script aims to analyze the profitability of an EOA 2 | 3 | https://dexcheck.ai/app/address-analyzer/ 4 | 5 | 6 | """" 7 | 8 | -------------------------------------------------------------------------------- /BNB Chain/Memepool/Sandwich-Attack.py: -------------------------------------------------------------------------------- 1 | #sandwich-attack-bot 2 | #Scans the memepool for transactions and buys before the victm and sells after victime. buys -------------------------------------------------------------------------------- /BNB Chain/Memepool/config.py: -------------------------------------------------------------------------------- 1 | bsc_api ="KFEM9CQIBQVGZWTDGW5VDZGSM5ZYVGJ6KR" 2 | -------------------------------------------------------------------------------- /BNB Chain/Memepool/router_abi.json: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BitFancy/Solana-Trading-Bot/c5bf9b933bc01278b6d292052a744f2ca4969f3b/BNB Chain/Memepool/router_abi.json -------------------------------------------------------------------------------- /BNB Chain/Miscellaneous/GetContractEventNames.py: -------------------------------------------------------------------------------- 1 | import web3 2 | from web3 import Web3 3 | import requests 4 | 5 | contract_abi = "contract_abi_string" 6 | 7 | web3 = Web3(Web3.HTTPProvider("https://bsc-dataseed2.binance.org/")) 8 | 9 | 10 | 11 | contract_address =input("Enter Contract Address: ") 12 | 13 | def get_contract_abi(contract_address): 14 | try: 15 | bscscan_api_key = 'YJ1VVGT761NZBN6RTC5JWPTZ511GN4VHGT' 16 | url = f'https://api.bscscan.com/api?module=contract&action=getsourcecode&address={contract_address}&apikey={bscscan_api_key}' 17 | response = requests.get(url) 18 | 19 | if response.status_code == 200: 20 | contract_info = response.json() 21 | if 'result' in contract_info and contract_info['result'] and 'ABI' in contract_info['result'][0]: 22 | return contract_info['result'][0]['ABI'] 23 | else: 24 | return None 25 | else: 26 | return None 27 | except Exception as e: 28 | print(f"An error occurred while fetching contract ABI: {e}") 29 | return None 30 | 31 | 32 | contract_tirla = web3.eth.contract(address=contract_address, abi=get_contract_abi(contract_address)) 33 | 34 | event = contract_tirla.events 35 | 36 | 37 | for events in event: 38 | print(events) 39 | 40 | -------------------------------------------------------------------------------- /BNB Chain/Miscellaneous/GetTelegramGroup.py: -------------------------------------------------------------------------------- 1 | import json 2 | import time 3 | import datetime 4 | from web3 import Web3 5 | import requests 6 | import re 7 | 8 | 9 | 10 | 11 | web3 = Web3(Web3.HTTPProvider("https://bsc-dataseed1.binance.org/")) 12 | 13 | def get_source_code(token_address): 14 | Eth_Api = "VFZUKK626NHN7SQTP1GAE5MK6TZN3BV2BR" # Change this to your Etherscan API ID 15 | sourceCodeGetRequestURL = "https://api.bscscan.com/api?module=contract&action=getsourcecode&address=" + token_address + "&apikey=" + Eth_Api 16 | response = requests.get(url=sourceCodeGetRequestURL) 17 | resultSourceCode = response.json() 18 | 19 | # Check if the request was successful 20 | if 'status' in resultSourceCode and resultSourceCode['status'] == '1': 21 | sourceCode = resultSourceCode['result'][0]['SourceCode'] 22 | #print(sourceCode) 23 | 24 | # Extract the Telegram link from the source code 25 | telegram_link = extract_telegram_link(str(sourceCode)) 26 | print(telegram_link) 27 | else: 28 | print("Failed to get source code.") 29 | 30 | 31 | 32 | def extract_telegram_link(source_code): 33 | pattern = r'(https?://t\.me/[^\s]+)' 34 | match = re.search(pattern, source_code) 35 | if match: 36 | return match.group(1) 37 | else: 38 | return None 39 | 40 | 41 | 42 | source_code =get_source_code("0x2BF588C05dfF2d926095e10f2bC0a2667eC0ABDE") 43 | -------------------------------------------------------------------------------- /BNB Chain/Miscellaneous/GettokenPrice_BNB_and_USDT.py: -------------------------------------------------------------------------------- 1 | from web3 import Web3 2 | 3 | pancakeSwapAbi = [ 4 | { 5 | "inputs": [ 6 | {"internalType": "uint256", "name": "amountIn", "type": "uint256"}, 7 | {"internalType": "address[]", "name": "path", "type": "address[]"}, 8 | ], 9 | "name": "getAmountsOut", 10 | "outputs": [{"internalType": "uint256[]", "name": "amounts", "type": "uint256[]"}], 11 | "stateMutability": "view", 12 | "type": "function", 13 | } 14 | ] 15 | 16 | 17 | 18 | 19 | pancakeSwapContract = "0x10ED43C718714eb63d5aA57B78B54704E256024E" 20 | web3 = Web3(Web3.HTTPProvider("https://bsc-dataseed1.binance.org")) 21 | 22 | 23 | def getAmountInBNB(tokenAddress, tokenAmount): 24 | BNBTokenAddress = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" 25 | tokenAmountWei = web3.to_wei(tokenAmount, "ether") 26 | 27 | try: 28 | router = web3.eth.contract(abi=pancakeSwapAbi, address=pancakeSwapContract) 29 | amounts = router.functions.getAmountsOut(tokenAmountWei, [tokenAddress, BNBTokenAddress]).call() 30 | if amounts and len(amounts) > 1: 31 | amountInBNBWei = amounts[1] 32 | amountInBNB = web3.from_wei(amountInBNBWei, "ether") 33 | return round(amountInBNB,2) 34 | else: 35 | return None 36 | except Exception as error: 37 | print("Error in getAmountInBNB:", error) 38 | return None 39 | 40 | #def getAmountInUSDT(tokenAddress,tokenAmount,decimal): 41 | def getAmountInUSDT(tokenAmount): 42 | BNBTokenAddress = "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" 43 | USDTokenAddress = "0x55d398326f99059fF775485246999027B3197955" 44 | bnbToSell = web3.to_wei(tokenAmount, "ether") 45 | amountOut = None 46 | 47 | try: 48 | router = web3.eth.contract(abi=pancakeSwapAbi, address=pancakeSwapContract) 49 | amountOut = router.functions.getAmountsOut(bnbToSell, [BNBTokenAddress, USDTokenAddress]).call() 50 | #print("Amounts:", amountOut) # Add this line 51 | 52 | amountOut = web3.from_wei(amountOut[1], "ether") 53 | except Exception as error: 54 | print("Error:", error) # Add this line 55 | 56 | pass 57 | 58 | if not amountOut: 59 | return 0 60 | return round(amountOut) 61 | 62 | 63 | 64 | 65 | 66 | def main(): 67 | tokenAddress =web3.to_checksum_address("0xce186ad6430e2fe494a22c9edbd4c68794a28b35") 68 | tokenAmount = 102000 69 | 70 | amountInBNB = getAmountInBNB(tokenAddress, tokenAmount) 71 | amountInUSDT= getAmountInUSDT(amountInBNB) 72 | 73 | if amountInBNB is not None: 74 | print(f'Token Amount: {tokenAmount}') 75 | print(f'Token Amount in BNB: {amountInBNB}') 76 | print(f'Token Amount in USDT: ${amountInUSDT}') 77 | else: 78 | print("Failed to calculate the token amount in BNB.") 79 | 80 | 81 | if __name__ == "__main__": 82 | main() 83 | -------------------------------------------------------------------------------- /BNB Chain/Trading/AddLiquidityEvents.py: -------------------------------------------------------------------------------- 1 | "Using logs to listen to addingLiquity Events For All tokens on PancakeSwap" 2 | 3 | import web3 4 | import time 5 | import datetime 6 | 7 | url = "https://bsc-dataseed1.binance.org/" # Replace with your Ethereum node URL 8 | 9 | w3 = web3.Web3(web3.HTTPProvider(url)) 10 | def getTimestamp(): 11 | while True: 12 | timeStampData = datetime.datetime.now() 13 | currentTimeStamp = "[" + timeStampData.strftime("%H:%M:%S.%f")[:-3] + "]" 14 | return currentTimeStamp 15 | 16 | # Define Topic Filter 17 | topic_filter = [ 18 | "0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f", 19 | "0x00000000000000000000000010ed43c718714eb63d5aa57b78b54704e256024e" 20 | ] 21 | while True: 22 | # Create an event filter with the specified event signature 23 | event_filter = w3.eth.filter({'topics': topic_filter}) 24 | 25 | 26 | # Get changes in the filter to retrieve AddLiquidity events 27 | add_liquidity_events = w3.eth.get_filter_changes(event_filter.filter_id) 28 | 29 | 30 | for event in add_liquidity_events: 31 | txn_hash = event['transactionHash'].hex() 32 | txn_receipt= w3.eth.get_transaction(txn_hash) 33 | input_signature= txn_receipt['input'][:10].hex() 34 | #Filter with Add Liquidity Function Signature 35 | if input_signature.startswith('0xf305d719'): 36 | print("AddLiquidity Event:") 37 | print("Block Number:", event['blockNumber']) 38 | print("Transaction Hash:", event['transactionHash'].hex()) 39 | print("Log Index:", event['logIndex']) 40 | print("Topics:", event['topics']) 41 | print("Data:", event['data'].hex()) 42 | print("\n") 43 | 44 | -------------------------------------------------------------------------------- /BNB Chain/Trading/CopyBuy_Sells.py: -------------------------------------------------------------------------------- 1 | "Copy Buys and Sells Of a list of wallets" 2 | -------------------------------------------------------------------------------- /BNB Chain/Trading/CopyWalletTrade.py: -------------------------------------------------------------------------------- 1 | """Copy Wallet Trade""" 2 | 3 | 4 | import asyncio 5 | import json 6 | from web3 import Web3 7 | from websockets import connect 8 | import datetime 9 | import asyncio 10 | 11 | """ 12 | Subscribes to pending transactions 13 | https://community.infura.io/t/web3-py-how-to-subscribe-to-pending-ethereum-transactions-in-python/5409 14 | """ 15 | 16 | class style(): # Class of different text colours - default is white 17 | BLACK = '\033[30m' 18 | RED = '\033[31m' 19 | GREEN = '\033[32m' 20 | YELLOW = '\033[33m' 21 | BLUE = '\033[34m' 22 | MAGENTA = '\033[35m' 23 | CYAN = '\033[36m' 24 | WHITE = '\033[37m' 25 | UNDERLINE = '\033[4m' 26 | RESET = '\033[0m' 27 | def getTimestamp(): 28 | while True: 29 | timeStampData = datetime.datetime.now() 30 | currentTimeStamp = "[" + timeStampData.strftime("%H:%M:%S.%f")[:-3] + "]" 31 | return currentTimeStamp 32 | 33 | 34 | def format_hex(original_hex): 35 | hex_without_prefix = original_hex[2:] 36 | 37 | desired_length = 64 38 | 39 | padded_hex = hex_without_prefix.zfill(desired_length) 40 | 41 | final_hex = "0x" + padded_hex 42 | 43 | return final_hex.lower() 44 | 45 | 46 | 47 | 48 | infura_ws_url="Enter Your ChainStack Websocket URL" 49 | infura_http_url = 'https://bsc-dataseed1.binance.org/' 50 | web3 = Web3(Web3.HTTPProvider(infura_http_url)) 51 | WETH="0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c" 52 | 53 | 54 | #Enter list of Wallet Addresses to monitor and copyTrade 55 | addresses = ["0x142aAbcc7D567e138384C1Fe637e3868e79eb9EB", 56 | "0xA80711c35543250191B52d3BDcABA125bceCC483", 57 | "0x981D4337876D3756d5BccbE2e1f3CF41C4496f7D"] 58 | 59 | monitored_wallets_hex = [format_hex(address) for address in addresses] 60 | 61 | 62 | async def get_event(): 63 | async with connect(infura_ws_url) as ws: 64 | await ws.send('{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}') 65 | subscription_response = await ws.recv() 66 | print(subscription_response) 67 | 68 | while True: 69 | try: 70 | message = await asyncio.wait_for(ws.recv(), timeout=15) 71 | response = json.loads(message) 72 | txHash = response['params']['result'] 73 | receipt = web3.eth.get_transaction_receipt(txHash) 74 | # print(receipt) 75 | transfer_details = web3.eth.get_transaction(txHash) 76 | 77 | from_address = transfer_details['from'] 78 | 79 | txn_hash = web3.to_hex(transfer_details['hash']) 80 | block_num = transfer_details['blockNumber'] 81 | if receipt['status'] == 1: 82 | # print(from_address) 83 | # 84 | # print(f"Transaction Successful, TxnHash: https://bscscan.com/tx/{txn_hash}") 85 | 86 | eth_value = None 87 | 88 | for logs in receipt['logs']: 89 | if logs['address'] == WETH and web3.to_hex(logs['topics'][ 90 | 0]) == "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": 91 | hex_value = web3.to_hex(logs['data']) 92 | integer_value = int(hex_value, 16) 93 | eth_value = web3.from_wei(integer_value, 'ether') 94 | eth_value = '{:.4f}'.format(eth_value) 95 | 96 | if eth_value is not None: 97 | for logs in receipt['logs']: 98 | if logs['address'] != WETH: 99 | if web3.to_hex(logs['topics'][ 100 | 0]) == "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": 101 | if web3.to_hex(logs['topics'][2]) in monitored_wallets_hex: 102 | print( 103 | f" {getTimestamp()} {style.RED}{block_num}{style.RESET} {style.GREEN} TOKEN BOUGHT: {logs['address']} {style.RESET} {style.MAGENTA} WALLET_ADDRESS: {from_address}{style.RESET} For {eth_value} BNB", 104 | style.RESET) 105 | print(f"TxnHash: https://bscscan.com/tx/{txn_hash} ") 106 | print(style.CYAN + "====BUYING TRADE SIMULATION======", style.RESET) 107 | # analyze_token(logs['address']) 108 | 109 | elif web3.to_hex(logs['topics'][1]) in monitored_wallets_hex: 110 | print( 111 | f" {getTimestamp()} {style.RED}{block_num}{style.RESET} {style.YELLOW}TOKEN SOLD: {logs['address']} {style.RESET} {style.MAGENTA} WALLET_ADDRESS: {from_address}{style.RESET} For {eth_value} BNB", 112 | style.RESET) 113 | print(f"TxnHash: https://bscscan.com/tx/{txn_hash} ") 114 | print(style.MAGENTA + "====SELLING TRADE SALE SIMULATION=====", style.RESET) 115 | elif logs['address'] != WETH: 116 | if web3.to_hex( 117 | logs['topics'][ 118 | 0]) == "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": 119 | if web3.to_hex(logs['topics'][1]) in monitored_wallets_hex: 120 | print( 121 | f"{getTimestamp()} {style.RED}{block_num}{style.RESET}{style.MAGENTA} TOKEN APPROVED: {logs['address']}{style.RESET}{style.MAGENTA} WALLET_ADDRESS {from_address}{style.RESET} ", 122 | style.RESET) 123 | print(f"TxnHash: https://bscscan.com/tx/{txn_hash}") 124 | print(style.MAGENTA + "====APPROVED TRANSACTION=====", style.RESET) 125 | else: 126 | pass 127 | # print("Transaction Failed") 128 | # print(f"TxnHash: https://bscscan.com/tx/{txn_hash}") 129 | # print(style.RED + "====TRANSACTION FAILED=====", style.RESET) 130 | except Exception as e: 131 | pass 132 | #print("An error occurred while processing a transaction:", e) 133 | 134 | if __name__ == "__main__": 135 | loop = asyncio.get_event_loop() 136 | while True: 137 | loop.run_until_complete(get_event()) -------------------------------------------------------------------------------- /BNB Chain/Trading/LaunchBot.py: -------------------------------------------------------------------------------- 1 | "Monitor token liquidity pools and automatically execute token purchases upon detecting the addition of liquidity." -------------------------------------------------------------------------------- /BNB Chain/Trading/MonitorMultipleAddresses.py: -------------------------------------------------------------------------------- 1 | #TODO -------------------------------------------------------------------------------- /BNB Chain/Trading/TrackEOA_ReceivingBNB.py: -------------------------------------------------------------------------------- 1 | #TODO Track the contract address of BNB smartcontract dispatcher. The aim is to find new wallets that receive BNB ie Lowe nonce count and the aggregae them in a pool and monitor them for new transactions emmited -------------------------------------------------------------------------------- /BNB Chain/Trading/TrackingSmartContractEvents.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BitFancy/Solana-Trading-Bot/c5bf9b933bc01278b6d292052a744f2ca4969f3b/BNB Chain/Trading/TrackingSmartContractEvents.py -------------------------------------------------------------------------------- /BNB Chain/Trading/sendMessage.py: -------------------------------------------------------------------------------- 1 | from web3 import Web3 2 | #https://testnet.bscscan.com/address/0x32f4b44286be50e905cfc5ab16b0a4747f477276 3 | # Node Connection 4 | w3 = Web3(Web3.HTTPProvider('https://data-seed-prebsc-1-s1.binance.org:8545/')) 5 | 6 | # Replace these with the sender's private key and the recipient's address 7 | sender_private_key = 'Enter Your Private Key' 8 | recipient_address = w3.toChecksumAddress('Enter Recipient Address') 9 | 10 | # Your message 11 | message = 'Enter Your Message' 12 | 13 | # Convert the message to hexadecimal data 14 | message_hex = message.encode('utf-8').hex() 15 | 16 | # Sender's address 17 | sender_address = w3.toChecksumAddress("Sender's Address") 18 | 19 | 20 | # Set up the transaction 21 | transaction = { 22 | 'to': recipient_address, 23 | 'value': w3.toWei(0, 'ether'), # Set the amount of Ether to send 24 | 'gas': 100000, 25 | 'gasPrice': w3.toWei('50', 'gwei'), 26 | 'nonce': w3.eth.getTransactionCount(sender_address), 27 | 'data': '0x' + message_hex, # Include the message as hexadecimal data 28 | } 29 | 30 | # Sign the transaction 31 | signed_transaction = w3.eth.account.signTransaction(transaction, sender_private_key) 32 | 33 | # Send the transaction 34 | transaction_hash = w3.eth.sendRawTransaction(signed_transaction.rawTransaction) 35 | 36 | print(f'Transaction hash: {transaction_hash.hex()}') 37 | 38 | #https://testnet.bscscan.com/tx/0x2803ab01415414661a1ab5bb235d591748affd369fd2a30048c9f76a6f8b028f -------------------------------------------------------------------------------- /BNB Chain/Wallet/BuywithMultipleWallets.py: -------------------------------------------------------------------------------- 1 | #To Do -------------------------------------------------------------------------------- /BNB Chain/Wallet/Hd-wallet.py: -------------------------------------------------------------------------------- 1 | "Generate Wallet from Mnemonic" 2 | 3 | from web3 import Web3 4 | from mnemonic import Mnemonic 5 | from web3 import Web3 6 | import secrets 7 | from eth_account import Account 8 | """ 9 | Please note the public key might differ when importing the mnemonic phrase into different wallet services 10 | like TrustWallet or SafePal because these services might use different derivation paths. 11 | 12 | Popular derivation paths include: 13 | 14 | BIP44: m/44'/coin_type'/account'/change/address_index 15 | BIP49: m/49'/coin_type'/account'/change/address_index 16 | BIP84: m/84'/coin_type'/account'/change/address_index 17 | 18 | """ 19 | 20 | w3 = Web3(Web3.HTTPProvider("https://bsc-dataseed1.binance.org/")) 21 | 22 | mnemo = Mnemonic("english") 23 | words = mnemo.generate(strength=256) 24 | 25 | extra_security= secrets.token_hex(32) 26 | 27 | w3.eth.account.enable_unaudited_hdwallet_features() 28 | #Generated Acct from Mnemonic 29 | acct = Account.from_mnemonic(words,passphrase=extra_security) 30 | acct_privatekeys =w3.toHex(acct.privateKey) 31 | accout = w3.eth.account.privateKeyToAccount(acct_privatekeys) 32 | 33 | account_publickey = accout.address 34 | account_privatekey= accout.privateKey 35 | # print("MNEMONIC ADDRESS-- Public Key",acct.address) 36 | # print("MNEMONIC PRIVATE KEY---[KEEP PRIVATE]",w3.toHex(acct.privateKey)) 37 | print("MNEMONIC PHRASE--[KEEP PRIVATE]",words) 38 | 39 | print('Public Key', account_publickey) 40 | print("Private_Key---[KEEP PRIVATE]",w3.toHex(account_privatekey)) -------------------------------------------------------------------------------- /BNB Chain/Wallet/MonitorMultipleWallets.py: -------------------------------------------------------------------------------- 1 | """Monitor Multiple Wallets 2 | Keep track of their Nonce and current Balance 3 | 4 | 5 | """ 6 | 7 | ## TODO -------------------------------------------------------------------------------- /BNB Chain/Wallet/MonitorPriceandSell.py: -------------------------------------------------------------------------------- 1 | #To do -------------------------------------------------------------------------------- /BNB Chain/Wallet/SendBNB-MultipleWallets.py: -------------------------------------------------------------------------------- 1 | "Send BNB to Multiple wallets " -------------------------------------------------------------------------------- /BNB Chain/Wallet/addresses_and_keys.crypto: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BitFancy/Solana-Trading-Bot/c5bf9b933bc01278b6d292052a744f2ca4969f3b/BNB Chain/Wallet/addresses_and_keys.crypto -------------------------------------------------------------------------------- /BNB Chain/Wallet/create-multiple-BSCaddress.py: -------------------------------------------------------------------------------- 1 | 2 | from web3 import Web3 3 | import secrets 4 | import csv 5 | import os 6 | 7 | # Connect to the Binance blockchain using the Infura node 8 | web3 = Web3(Web3.HTTPProvider("https://bsc-dataseed1.binance.org/")) 9 | 10 | # Define the number of addresses to generate 11 | num_addresses = 10 12 | 13 | # Define the filename 14 | filename = "addresses_and_keys.csv" 15 | 16 | # Check if the file exists; if not, create it and write the header row 17 | if not os.path.exists(filename): 18 | with open(filename, "w", newline='') as csvfile: 19 | csvwriter = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) 20 | csvwriter.writerow(['Enumeration', 'Address', 'Private Key']) 21 | 22 | # Open the CSV file in append mode to store the new addresses and private keys 23 | with open(filename, "a", newline='') as csvfile: 24 | # Create a CSV writer object 25 | csvwriter = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) 26 | 27 | # Get the current enumeration value from the file 28 | with open(filename, "r") as csvfile_read: 29 | enumeration = sum(1 for _ in csvfile_read) - 1 # Subtract 1 for the header row 30 | 31 | # Generate the addresses and private keys 32 | for i in range(num_addresses): 33 | extra_security = secrets.token_hex(32) 34 | # Generate a new Binance address and private key 35 | address = web3.eth.account.create(extra_security) 36 | 37 | # Print the address and private key 38 | print(f"Address: {address.address}") 39 | print(f"Private key: {address.privateKey.hex()}") 40 | 41 | # Write the enumeration, address, and private key to the CSV file 42 | csvwriter.writerow([enumeration + i + 1, address.address, address.privateKey.hex()]) 43 | 44 | 45 | 46 | 47 | 48 | """Object Oriented Implementation """ 49 | 50 | # from web3 import Web3 51 | # import secrets 52 | # import csv 53 | # import os 54 | # 55 | # 56 | # class BinanceAddressGenerator: 57 | # def __init__(self, num_addresses=10, filename="addresses_and_keys.csv"): 58 | # self.web3 = Web3(Web3.HTTPProvider("https://bsc-dataseed1.binance.org/")) 59 | # self.num_addresses = num_addresses 60 | # self.filename = filename 61 | # 62 | # def generate_address(self): 63 | # extra_security = secrets.token_hex(32) 64 | # return self.web3.eth.account.create(extra_security) 65 | # 66 | # def save_addresses_to_csv(self, addresses): 67 | # if not os.path.exists(self.filename): 68 | # with open(self.filename, "w", newline='') as csvfile: 69 | # csvwriter = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) 70 | # csvwriter.writerow(['Enumeration', 'Address', 'Private Key']) 71 | # 72 | # with open(self.filename, "a", newline='') as csvfile: 73 | # csvwriter = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL) 74 | # 75 | # with open(self.filename, "r") as csvfile_read: 76 | # enumeration = sum(1 for _ in csvfile_read) - 1 77 | # 78 | # for i, address in enumerate(addresses): 79 | # csvwriter.writerow([enumeration + i + 1, address.address, address.privateKey.hex()]) 80 | # 81 | # def generate_and_save_addresses(self): 82 | # addresses = [self.generate_address() for _ in range(self.num_addresses)] 83 | # self.save_addresses_to_csv(addresses) 84 | # return addresses 85 | # 86 | # 87 | # if __name__ == "__main__": 88 | # generator = BinanceAddressGenerator(num_addresses=10) 89 | # generated_addresses = generator.generate_and_save_addresses() 90 | # 91 | # for address in generated_addresses: 92 | # print(f"Address: {address.address}") 93 | # print(f"Private key: {address.privateKey.hex()}") 94 | -------------------------------------------------------------------------------- /Ethereum/DEX/CheckIfLiquidity_IsAdded.py: -------------------------------------------------------------------------------- 1 | import json 2 | from web3 import Web3 3 | import time 4 | import datetime 5 | import requests 6 | 7 | 8 | 9 | class style(): # Class of different text colours - default is white 10 | BLACK = '\033[30m' 11 | RED = '\033[31m' 12 | GREEN = '\033[32m' 13 | YELLOW = '\033[33m' 14 | BLUE = '\033[34m' 15 | MAGENTA = '\033[35m' 16 | CYAN = '\033[36m' 17 | WHITE = '\033[37m' 18 | UNDERLINE = '\033[4m' 19 | RESET = '\033[0m' 20 | 21 | 22 | 23 | 24 | def getTimestamp(): 25 | while True: 26 | timeStampData = datetime.datetime.now() 27 | currentTimeStamp = "[" + timeStampData.strftime("%H:%M:%S.%f")[:-3] + "]" 28 | return currentTimeStamp 29 | 30 | 31 | web3 = Web3(Web3.HTTPProvider("https://eth-mainnet.g.alchemy.com/v2/lTlatSTYDZmCv6wVLRIDff7S3kZhL2dq")) 32 | if web3.is_connected(): 33 | print(getTimestamp()," Ethereum Node successfully connected") 34 | 35 | contract_address = input("Enter Token Address: ") 36 | WETH= "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" 37 | 38 | pancake_factory = '0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f' # Testnet #0x6725F303b657a9451d8BA641348b6761A6CC7a17 39 | pancake_factory_abi = json.loads('[{"inputs":[{"internalType":"address","name":"_feeToSetter","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token0","type":"address"},{"indexed":true,"internalType":"address","name":"token1","type":"address"},{"indexed":false,"internalType":"address","name":"pair","type":"address"},{"indexed":false,"internalType":"uint256","name":"","type":"uint256"}],"name":"PairCreated","type":"event"},{"constant":true,"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"allPairs","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"allPairsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"}],"name":"createPair","outputs":[{"internalType":"address","name":"pair","type":"address"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"feeTo","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"feeToSetter","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"getPair","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_feeTo","type":"address"}],"name":"setFeeTo","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_feeToSetter","type":"address"}],"name":"setFeeToSetter","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"}]') 40 | contract = web3.eth.contract(address=pancake_factory, abi=pancake_factory_abi) 41 | lp_abi = '[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint112","name":"reserve0","type":"uint112"},{"indexed":false,"internalType":"uint112","name":"reserve1","type":"uint112"}],"name":"Sync","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":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"_reserve0","type":"uint112"},{"internalType":"uint112","name":"_reserve1","type":"uint112"},{"internalType":"uint32","name":"_blockTimestampLast","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"kLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"price0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"skim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount0Out","type":"uint256"},{"internalType":"uint256","name":"amount1Out","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"sync","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]' 42 | 43 | 44 | 45 | 46 | 47 | def get_liquidity_balance(lp_address): 48 | lp_contract = web3.eth.contract(address=lp_address, abi=lp_abi) 49 | reserves = lp_contract.functions.getReserves().call() 50 | balance = reserves[0] 51 | return balance 52 | 53 | def check_liquidity(lp_address): 54 | balance = get_liquidity_balance(lp_address) 55 | if balance > 0: 56 | print(f"{getTimestamp()} Liquidity balance detected' {balance}") 57 | #buy() # We can set up buy as soon as liquidity is added 58 | else: 59 | print('No liquidity balance detected') 60 | 61 | 62 | 63 | def run_lp_check(): 64 | lp_address = contract.functions.getPair(contract_address, WETH).call() 65 | if lp_address != web3.to_checksum_address('0x0000000000000000000000000000000000000000'): 66 | print('LP address detected:', lp_address) 67 | check_liquidity(lp_address) 68 | return True 69 | else: 70 | print('No LP address found') 71 | return False 72 | 73 | while True: 74 | print("Starting Check") 75 | run_lp_check() 76 | time.sleep(1) 77 | break 78 | 79 | -------------------------------------------------------------------------------- /Ethereum/Decoding/Example_1.py: -------------------------------------------------------------------------------- 1 | from eth_abi import abi 2 | from web3 import Web3 3 | # ABI for the transferFrom function 4 | transfer_from_abi = ['address', 'address', 'uint256'] 5 | web3 = Web3(Web3.HTTPProvider('ENTER YOUR NODEURL')) 6 | 7 | txn_hash="0xfdc9939cb6bd71bdec1f86eccd44dc7faa79f98c82dac2ae1910e383971fbe8d" 8 | 9 | tx_log = web3.eth.get_transaction_receipt(txn_hash).logs 10 | topics= tx_log[1]['topics'] # 5th log is the swap 11 | #print(topics) 12 | first_topic = web3.to_hex(topics[1]) 13 | second_topic = web3.to_hex(topics[2]) 14 | third_topic = web3.to_hex(topics[3]) 15 | 16 | DATA = topics[1] + topics[2] + topics[3] 17 | decodedABI = abi.decode(transfer_from_abi, DATA) 18 | print(decodedABI) 19 | 20 | -------------------------------------------------------------------------------- /Ethereum/Decoding/Example_2.py: -------------------------------------------------------------------------------- 1 | from web3 import Web3 2 | from eth_abi import abi 3 | tx_hash = '0xb9ae909908fc911f547845c853422832538ef97ff2c569ac403ecbd252840c6e' 4 | web3 = Web3(Web3.HTTPProvider('Enter your node url')) 5 | 6 | txn_log = web3.eth.get_transaction_receipt(tx_hash).logs 7 | topics = txn_log[5]['topics'] # 5th log is the swap log 8 | first_topic = web3.to_hex(topics[1]) 9 | second_topic = web3.to_hex(topics[2]) 10 | third_topic = web3.to_hex(txn_log[5]['data']) 11 | 12 | # Print the values of topics 13 | # print("First Topic:", first_topic) 14 | # print("Second Topic:", second_topic) 15 | # print("Third Topic:", third_topic) 16 | 17 | DATA = topics[1] + topics[2] + txn_log[5]['data'] 18 | 19 | decodedABI = abi.decode(['address', 'uint256', 'uint256', 'uint256','uint256','address'], DATA) 20 | print(decodedABI) 21 | -------------------------------------------------------------------------------- /Ethereum/Evaluate ERC20 Token/EvaluateToken_HoneypotAPI.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | #TODO Add additional checks based on research 4 | class style(): # Class of different text colours - default is white 5 | BLACK = '\033[30m' 6 | RED = '\033[31m' 7 | GREEN = '\033[32m' 8 | YELLOW = '\033[33m' 9 | BLUE = '\033[34m' 10 | MAGENTA = '\033[35m' 11 | CYAN = '\033[36m' 12 | WHITE = '\033[37m' 13 | UNDERLINE = '\033[4m' 14 | RESET = '\033[0m' 15 | 16 | def check_token_honeypot(): 17 | token_address= input("Enter Token Address: ") 18 | # API endpoint URL 19 | url = "https://api.honeypot.is/v2/IsHoneypot" 20 | 21 | # Construct the query parameters 22 | params = { 23 | "address": token_address, 24 | } 25 | 26 | # Make the GET request 27 | response = requests.get(url, params=params) 28 | 29 | if response.status_code == 200: 30 | data = response.json() 31 | is_honeypot = data['honeypotResult']['isHoneypot'] 32 | honeypot_reason = data['honeypotResult'].get('honeypotReason', None) 33 | 34 | simulation_results = { 35 | "BUY TAX": f"{data['simulationResult']['buyTax']:.2f}%", 36 | "SELL TAX": f"{data['simulationResult']['sellTax']:.2f}%", 37 | "TRANSFER TAX": f"{data['simulationResult']['transferTax']:.2f}%", 38 | "BUY GAS": data['simulationResult']['buyGas'], 39 | "SELL GAS": data['simulationResult']['sellGas'], 40 | "SOURCE CODE": "OPEN SOURCE", 41 | } 42 | 43 | recent_holders_analysis = { 44 | "HOLDERS ANALYSED": data['holderAnalysis']['holders'], 45 | "CAN SELL": data['holderAnalysis']['successful'], 46 | "CAN'T SELL": data['holderAnalysis']['failed'], 47 | "SIPHONED": data['holderAnalysis']['siphoned'], 48 | "AVERAGE TAX": f"{data['holderAnalysis']['averageTax']:.1f}%", 49 | "HIGHEST TAX": f"{data['holderAnalysis']['highestTax']:.1f}%", 50 | "AVERAGE GAS": f"{data['holderAnalysis']['averageGas']:,}", 51 | "EXTREMELY HIGH TAX HOLDERS": data['holderAnalysis']['highTaxWallets'], 52 | } 53 | 54 | column_width = 30 55 | 56 | if is_honeypot: 57 | print(style.RED + f"EXECUTION REVERTED\n{honeypot_reason}\n" + style.RESET) 58 | if float(simulation_results["BUY TAX"][:-1]) > 50 or float(simulation_results["SELL TAX"][:-1]) > 50: 59 | print("WARNINGS") 60 | print( 61 | "The taxes on this token are extremely high. You will get significantly less from a trade than expected, be careful!") 62 | print("The average tax is very high. Be careful!\n") 63 | print("SIMULATION RESULTS") 64 | for key, value in simulation_results.items(): 65 | print(f"{key:{column_width}}{value:{column_width}}") 66 | print(f"BUY LIMIT:{'NONE DETECTED':{column_width}}SELL LIMIT:{'NONE DETECTED':{column_width}}") 67 | print("EXTREMELY HIGH TAX HOLDERS\n" + data['holderAnalysis']['highTaxWallets']) 68 | print("\nRECENT HOLDERS ANALYSIS") 69 | for key, value in recent_holders_analysis.items(): 70 | print(f"{key:{column_width}}{value:{column_width}}") 71 | else: 72 | print(style.GREEN + "NOT A HONEYPOT" + style.RESET) 73 | print("SIMULATION RESULTS") 74 | for key, value in simulation_results.items(): 75 | print(f"{key:{column_width}}{value:{column_width}}") 76 | print(f"BUY LIMIT:{'NONE DETECTED':{column_width}}SELL LIMIT:{'NONE DETECTED':{column_width}}") 77 | print("EXTREMELY HIGH TAX HOLDERS\n" + data['holderAnalysis']['highTaxWallets']) 78 | print("\nRECENT HOLDERS ANALYSIS") 79 | for key, value in recent_holders_analysis.items(): 80 | print(f"{key:{column_width}}{value:{column_width}}") 81 | 82 | 83 | check_token_honeypot() 84 | -------------------------------------------------------------------------------- /Ethereum/Evaluate ERC20 Token/GetLocktime.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | # Unix timestamp 4 | timestamp = int(input("Enter unix timestamp: ")) 5 | 6 | # Convert the timestamp to a date 7 | date = datetime.datetime.fromtimestamp(timestamp) 8 | 9 | # Get the current date 10 | current_date = datetime.datetime.now() 11 | 12 | lock_date = f"{current_date:%d-%m-%Y %H:%M:%S}" 13 | 14 | # Calculate the difference from current date 15 | difference = date-current_date 16 | locktime= difference.days 17 | print(current_date) 18 | print(locktime) 19 | print("Tokens are locked till: ",lock_date) 20 | print("Months Lock",locktime//30) 21 | print("Years Lock",locktime//365) 22 | -------------------------------------------------------------------------------- /Ethereum/Evaluate ERC20 Token/Token-Early-Transactions.py: -------------------------------------------------------------------------------- 1 | "Focus on buys immediately after liquitidy is added" 2 | 3 | import requests 4 | import json 5 | 6 | 7 | api_key = 'QSD4D9KG1NYTX3Y6CPAR62G9FBW16UZ81Z' 8 | 9 | # Prompt user to input the token contract address and number of wallets 10 | contract_address = input("Enter the token contract address: ") 11 | num_wallets = int(input("Enter the number of wallets to display: ")) 12 | 13 | # Define the BscScan API URL 14 | url = f"https://api.etherscan.io/api?module=account&action=tokentx&contractaddress={contract_address}&apikey={api_key}" 15 | 16 | # Send a request to BscScan API and parse the JSON response 17 | response = requests.get(url) 18 | data = json.loads(response.text) 19 | 20 | 21 | if data['status'] == "1": 22 | transactions = data['result'] 23 | 24 | # Filter transactions and get the first 'num_wallets' wallet addresses 25 | wallets = [] 26 | print(f"\nThe first {num_wallets} wallets that bought the token after liquidity was added:\n") 27 | for tx in transactions: 28 | #if tx['from'] != contract_address and tx['to'] != contract_address: 29 | if tx['from'] not in wallets: 30 | wallets.append(tx['from']) 31 | print(f"{len(wallets)}. Wallet: {tx['from']}, TxHash: https://etherscan.io/tx/{tx['hash']}") 32 | 33 | if len(wallets) >= num_wallets: 34 | break 35 | # elif tx['to'] == contract_address.lower(): #and len(wallets) == 1: 36 | # print(f"Liquidity added transaction: TxHash: {tx['hash']}\n") 37 | else: 38 | print("Error fetching transactions. Please check the contract address and try again.") 39 | -------------------------------------------------------------------------------- /Ethereum/GasFees/gas_fees.py: -------------------------------------------------------------------------------- 1 | from web3 import Web3 2 | 3 | # Replace 'YOUR_NODE_URL' with the URL of your Ethereum node 4 | web3 = Web3(Web3.HTTPProvider('Enter your Node URL')) 5 | latest_block = web3.eth.get_block('latest') 6 | 7 | # Ensure connection to the node 8 | if web3.is_connected(): 9 | # Get the latest block 10 | latest_block = web3.eth.get_block('latest') 11 | #latest_block= 18792112 12 | gas_used = 300000 # Replace with the actual gas used by your transaction 13 | 14 | # Extract gas limit and base fee 15 | gas_limit = latest_block['gasLimit'] 16 | base_fee = latest_block['baseFeePerGas'] 17 | print(f"Latest Block: {latest_block['number']}") 18 | print(f"Gas Limit: {gas_limit}") 19 | print(f"Base Fee: {base_fee}") 20 | base_fee_gwei = base_fee / 10**9 21 | print(f"Base Fee (GWEI): {base_fee_gwei}") 22 | # Calculate transaction cost in Ether 23 | transaction_cost_ether = (gas_used * base_fee_gwei) / 10 ** 9 24 | print(f"Transaction Cost (Ether): {transaction_cost_ether}") 25 | gas_price_estimate = web3.eth.gas_price 26 | print(f"Gas Price Estimate (Wei): {gas_price_estimate}") 27 | 28 | # Convert gas price to Gwei for a more readable output 29 | gas_price_gwei = web3.from_wei(gas_price_estimate, 'gwei') 30 | print(f"Gas Price Estimate (Gwei): {gas_price_gwei}") 31 | print(f"Block status: {len(latest_block['transactions'])}") -------------------------------------------------------------------------------- /Ethereum/GoogleCloudSetUp/Instructions.md: -------------------------------------------------------------------------------- 1 | ###Instructions on how to host your crypto bot on the cloud -------------------------------------------------------------------------------- /Ethereum/JarethFromSubway/jareth_copytrade.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BitFancy/Solana-Trading-Bot/c5bf9b933bc01278b6d292052a744f2ca4969f3b/Ethereum/JarethFromSubway/jareth_copytrade.py -------------------------------------------------------------------------------- /Ethereum/JarethFromSubway/uniswapAnalytics.py: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Ethereum/Launchpads/All_LaunchpadsEvents.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BitFancy/Solana-Trading-Bot/c5bf9b933bc01278b6d292052a744f2ca4969f3b/Ethereum/Launchpads/All_LaunchpadsEvents.py -------------------------------------------------------------------------------- /Ethereum/Memepool/DecodingExecuteFunction.py: -------------------------------------------------------------------------------- 1 | from web3 import Web3 2 | import requests 3 | 4 | from uniswap_universal_router_decoder import RouterCodec 5 | 6 | 7 | trx_input="0x3593564c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000064a20d9f00000000000000000000000000000000000000000000000000000000000000020b080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000008e1bc9bf04000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000008e1bc9bf040000000000000000000000000000000000000000000000000027f13b0836f656fb7a00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000073ae4ba01e38ba5da762e3e65eeb9b03a732dcd9" 8 | codec = RouterCodec() 9 | decoded_trx_input = codec.decode.function_input(trx_input) 10 | 11 | path = decoded_trx_input[1]['inputs'][1][1]['path'] 12 | 13 | # print(decoded_trx_input) 14 | print(path) -------------------------------------------------------------------------------- /Ethereum/Memepool/simple.py: -------------------------------------------------------------------------------- 1 | 2 | 3 | from web3 import Web3 4 | import time 5 | 6 | w3 = Web3(Web3.HTTPProvider("https://eth-mainnet.g.alchemy.com/v2/lTlatSTYDZmCv6wVLRIDff7S3kZhL2dq")) 7 | 8 | uniswap_contract_address = '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D' # Replace with Uniswap contract address 9 | 10 | def handle_new_block(block): 11 | for tx_hash in block['transactions']: 12 | 13 | try: 14 | tx = w3.eth.getTransaction(tx_hash) 15 | 16 | if tx['to'].lower() == uniswap_contract_address.lower(): 17 | # Process the transaction 18 | print("Transaction interacting with Uniswap:", w3.toHex(tx['hash'])) 19 | print("Input", tx['input']) 20 | except Exception as e: 21 | print("An error occurred while processing a transaction:", e) 22 | 23 | 24 | def setup_block_filter(): 25 | new_block_filter = w3.eth.filter('latest') 26 | 27 | while True: 28 | for block_hash in new_block_filter.get_new_entries(): 29 | block = w3.eth.getBlock(block_hash) 30 | handle_new_block(block) 31 | 32 | # Sleep for a certain interval before checking for new blocks again 33 | time.sleep(1) 34 | 35 | # Set up the block filter 36 | setup_block_filter() -------------------------------------------------------------------------------- /Ethereum/Miscellaneous/Block_logs.py: -------------------------------------------------------------------------------- 1 | 2 | from web3 import Web3 3 | w3 = Web3(Web3.HTTPProvider("https://eth-mainnet.g.alchemy.com/v2/lTlatSTYDZmCv6wVLRIDff7S3kZhL2dq")) 4 | 5 | 6 | 7 | 8 | block = w3.eth.get_block(17828184) 9 | 10 | 11 | block_number = 17828184 # Replace this with the block number you want to fetch 12 | 13 | 14 | for transaction_hash in block['transactions']: 15 | transaction = w3.eth.get_transaction(transaction_hash) 16 | transaction_receipt = w3.eth.get_transaction_receipt(transaction_hash) 17 | 18 | if transaction_receipt and 'logs' in transaction_receipt: 19 | logs = transaction_receipt['logs'] 20 | 21 | for log in logs: 22 | # Process the log data as needed 23 | print(f"Transaction Hash: {transaction_hash.hex()}, Log: {log}") -------------------------------------------------------------------------------- /Ethereum/Miscellaneous/GetEventNames.py: -------------------------------------------------------------------------------- 1 | import web3 2 | from web3 import Web3 3 | import requests 4 | 5 | contract_abi = "contract_abi_string" 6 | 7 | web3 = Web3(Web3.HTTPProvider("https://eth-mainnet.g.alchemy.com/v2/lTlatSTYDZmCv6wVLRIDff7S3kZhL2dq")) 8 | 9 | # pinkysale ="0x71B5759d73262FBb223956913ecF4ecC51057641" 10 | # unicript = "0x663A5C229c09b049E36dCc11a9B0d4a8Eb9db214" 11 | # trustswap="0xE2fE530C047f2d85298b07D9333C05737f1435fB" 12 | 13 | contract_address =input("Enter Contract Address: ") 14 | 15 | def get_contract_abi(contract_address): 16 | try: 17 | bscscan_api_key = 'QSD4D9KG1NYTX3Y6CPAR62G9FBW16UZ81Z' 18 | url = f'https://api.etherscan.io/api?module=contract&action=getsourcecode&address={contract_address}&apikey={bscscan_api_key}' 19 | response = requests.get(url) 20 | 21 | if response.status_code == 200: 22 | contract_info = response.json() 23 | if 'result' in contract_info and contract_info['result'] and 'ABI' in contract_info['result'][0]: 24 | return contract_info['result'][0]['ABI'] 25 | else: 26 | return None 27 | else: 28 | return None 29 | except Exception as e: 30 | print(f"An error occurred while fetching contract ABI: {e}") 31 | return None 32 | 33 | 34 | contract_tirla = web3.eth.contract(address=contract_address, abi=get_contract_abi(contract_address)) 35 | 36 | event = contract_tirla.events 37 | 38 | 39 | for events in event: 40 | print(events) 41 | 42 | -------------------------------------------------------------------------------- /Ethereum/Miscellaneous/GetTokenPairFromLp.py: -------------------------------------------------------------------------------- 1 | "Get Token Pair from lp address" 2 | 3 | 4 | from web3 import Web3 5 | 6 | 7 | w3 = Web3(Web3.HTTPProvider("https://eth-mainnet.g.alchemy.com/v2/lTlatSTYDZmCv6wVLRIDff7S3kZhL2dq")) 8 | lp_address = input("Enter LP Address: ") 9 | 10 | 11 | uniswap_v2_pair_abi = '[{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Burn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount0In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1In","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0Out","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1Out","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint112","name":"reserve0","type":"uint112"},{"indexed":false,"internalType":"uint112","name":"reserve1","type":"uint112"}],"name":"Sync","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":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"constant":true,"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"MINIMUM_LIQUIDITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"burn","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"getReserves","outputs":[{"internalType":"uint112","name":"_reserve0","type":"uint112"},{"internalType":"uint112","name":"_reserve1","type":"uint112"},{"internalType":"uint32","name":"_blockTimestampLast","type":"uint32"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"}],"name":"initialize","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"kLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"price0CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"price1CumulativeLast","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"skim","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"uint256","name":"amount0Out","type":"uint256"},{"internalType":"uint256","name":"amount1Out","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"swap","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[],"name":"sync","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"payable":false,"stateMutability":"nonpayable","type":"function"}]' 12 | 13 | uniswap_v2_pair = w3.eth.contract(address=lp_address, abi=uniswap_v2_pair_abi) 14 | 15 | 16 | 17 | 18 | 19 | def get_token_from_lp(lpAddres): 20 | uniswap_v2_pair = w3.eth.contract(address=lp_address, abi=uniswap_v2_pair_abi) 21 | 22 | tokenA_address = uniswap_v2_pair.functions.token0().call() 23 | tokenB_address = uniswap_v2_pair.functions.token1().call() 24 | 25 | return f" Token A: {tokenA_address} Token B {tokenB_address}" 26 | 27 | print(get_token_from_lp(lp_address)) 28 | 29 | 30 | -------------------------------------------------------------------------------- /Ethereum/Miscellaneous/SpecificTokenInWallet_PriceInWETHUSDT.py: -------------------------------------------------------------------------------- 1 | 2 | from web3 import Web3 3 | web3 = Web3(Web3.HTTPProvider("https://eth-mainnet.g.alchemy.com/v2/lTlatSTYDZmCv6wVLRIDff7S3kZhL2dq")) 4 | 5 | 6 | tokenAbi = [ 7 | {"constant": True, "inputs": [], "name": "decimals", "outputs": [{"name": "", "type": "uint8"}], "payable": False, "stateMutability": "view", "type": "function"}, 8 | {"constant": True, "inputs": [], "name": "name", "outputs": [{"name": "", "type": "string"}], "payable": False, "stateMutability": "view", "type": "function"}, 9 | {"constant": True, "inputs": [], "name": "symbol", "outputs": [{"name": "", "type": "string"}], "payable": False, "stateMutability": "view", "type": "function"}, 10 | {"constant": True,"inputs": [{"name": "owner", "type": "address"}],"name": "balanceOf","outputs": [{"name": "", "type": "uint256"}],"payable": False,"stateMutability": "view","type": "function"} 11 | ] 12 | 13 | 14 | V2SwapAbi = [ 15 | { 16 | "inputs": [ 17 | {"internalType": "uint256", "name": "amountIn", "type": "uint256"}, 18 | {"internalType": "address[]", "name": "path", "type": "address[]"}, 19 | ], 20 | "name": "getAmountsOut", 21 | "outputs": [{"internalType": "uint256[]", "name": "amounts", "type": "uint256[]"}], 22 | "stateMutability": "view", 23 | "type": "function", 24 | }, 25 | 26 | ] 27 | 28 | V2SwapContract = "0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D" 29 | 30 | 31 | tokenAddress= input("Enter Token Address ") 32 | #tokenAddress=web3.to_checksum_address(tokenAddress) 33 | walletAddress= input("Enter Wallet Address") 34 | walletAddress=web3.to_checksum_address(walletAddress) 35 | 36 | tokenContract = web3.eth.contract(address=tokenAddress, abi=tokenAbi) 37 | 38 | decimals = tokenContract.functions.decimals().call() 39 | tokenName = tokenContract.functions.name().call() 40 | balance = tokenContract.functions.balanceOf(walletAddress).call() 41 | token_balance= balance/10 **decimals 42 | WETH="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" 43 | USDT="0xdAC17F958D2ee523a2206206994597C13D831ec7" 44 | def findMatchingDecimal(token_decimals): 45 | decimalsDict = { 46 | 1: "wei", 47 | 1000: "kwei", 48 | 1000000: "mwei", 49 | 1000000000: "gwei", 50 | 1000000000000: "szabo", 51 | 1000000000000000: "finney", 52 | 1000000000000000000: "ether", 53 | 1000000000000000000000: "kether", 54 | 1000000000000000000000000: "mether", 55 | 1000000000000000000000000000: "gether", 56 | 1000000000000000000000000000000: "tether" 57 | } 58 | 59 | matching_entry = decimalsDict.get(10 ** token_decimals) 60 | return matching_entry 61 | 62 | def getAmountInBNB(tokenAddress, tokenAmount): 63 | tokenAmountWei = web3.to_wei(tokenAmount, findMatchingDecimal(decimals)) 64 | 65 | try: 66 | router = web3.eth.contract(abi=V2SwapAbi, address=V2SwapContract) 67 | amounts = router.functions.getAmountsOut(tokenAmountWei, [tokenAddress, WETH]).call() 68 | if amounts and len(amounts) > 1: 69 | amountInBNBWei = amounts[1] 70 | amountInBNB = web3.from_wei(amountInBNBWei, "ether") 71 | return round(amountInBNB,2) 72 | else: 73 | return None 74 | except Exception as error: 75 | print("Error in getAmountInBNB:", error) 76 | return None 77 | 78 | 79 | def getAmountInUSDT(tokenAmount): 80 | 81 | EthToSell = web3.to_wei(tokenAmount, "ether") 82 | #EthToSell = web3.to_wei(str(tokenAmount), "ether") 83 | #EthToSell = int(tokenAmount * 1e18) # Convert to wei directly 84 | 85 | amountOut = None 86 | 87 | try: 88 | router = web3.eth.contract(abi=V2SwapAbi, address=V2SwapContract) 89 | amountOut = router.functions.getAmountsOut(EthToSell, [WETH, USDT]).call() 90 | #print("Amounts:", amountOut) # Add this line 91 | amountOut = web3.from_wei(amountOut[1], "mwei") 92 | 93 | except Exception as error: 94 | print("Error:", error) # Add this line 95 | 96 | pass 97 | 98 | # if not amountOut: 99 | # return 0 100 | return round(amountOut) 101 | 102 | weth_amount= getAmountInBNB(tokenAddress,token_balance) 103 | print(weth_amount) 104 | if web3.is_connected() and tokenContract: 105 | if balance is not None and decimals is not None: 106 | print(f"Token Balance: {round(token_balance)}") 107 | print(f"Balance in ETH: {getAmountInBNB(tokenAddress,token_balance)}") 108 | print(f"Balance in USDT {getAmountInUSDT(weth_amount)}") 109 | print(f"Token Name: {tokenName}") 110 | 111 | else: 112 | print("Failed to retrieve token balance or decimals.") 113 | else: 114 | print("Web3 connection error or invalid token contract.") 115 | -------------------------------------------------------------------------------- /Ethereum/Monitoring/Monitor-MultipleLp-Concurrently.py: -------------------------------------------------------------------------------- 1 | """Monitor multiple liquidity providers concurrently and send alerts to telegram bot. Have a basis for growth rate and decline rate." 2 | 3 | How can this be intergrated to the evaluabtion bot? 4 | Can you get traction of a token and determine optimal buying point and selling point 5 | 6 | What data do you need to determine the optimal buying point and selling point? 7 | 8 | What is the best way to determine the optimal buying point and selling point? 9 | 10 | """ -------------------------------------------------------------------------------- /Ethereum/Monitoring/MonitorPools-TokenOwned.py: -------------------------------------------------------------------------------- 1 | #Here we monitor pools of a list of token addresses owned by a wallet 2 | #How useful ? Even in your sleep you can trigger sells or buys of a specific pool based on your strategy 3 | -------------------------------------------------------------------------------- /Ethereum/Trading/AddLp_Events.py: -------------------------------------------------------------------------------- 1 | import web3 2 | import time 3 | import requests 4 | import datetime 5 | 6 | from alchemy import Alchemy, Network 7 | from decimal import Decimal 8 | 9 | network = Network.ETH_MAINNET 10 | 11 | api_key = "BLHi-AZvCt6LjvO8W7nFtloBJFZa393M" 12 | 13 | alchemy_ws_url="wss://eth-mainnet.g.alchemy.com/v2/WoUWFd2SYi7sNbmTTaT_fWMPCOUZ8yDI" 14 | alchemy= Alchemy(api_key,network) 15 | 16 | url = "https://eth-mainnet.g.alchemy.com/v2/lTlatSTYDZmCv6wVLRIDff7S3kZhL2dq" 17 | headers = { 18 | "accept": "application/json", 19 | "content-type": "application/json" 20 | } 21 | 22 | printed_values = [] 23 | topic_filter = [ 24 | "0x4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f", 25 | "0x0000000000000000000000007a250d5630b4cf539739df2c5dacb4c659f2488d" 26 | ] 27 | 28 | 29 | 30 | 31 | def getTimestamp(): 32 | while True: 33 | timeStampData = datetime.datetime.now() 34 | currentTimeStamp = "[" + timeStampData.strftime("%H:%M:%S.%f")[:-3] + "]" 35 | return currentTimeStamp 36 | try: 37 | while True: 38 | payload = { 39 | "id": 1, 40 | "jsonrpc": "2.0", 41 | "method": "eth_getLogs", 42 | "params": [ 43 | 44 | { 45 | "topics":[topic_filter] 46 | 47 | } 48 | 49 | ] 50 | } 51 | 52 | 53 | response = requests.post(url, json=payload, headers=headers) 54 | response_data = response.json() 55 | 56 | 57 | if 'result' in response_data: 58 | 59 | for res in response_data['result']: 60 | 61 | if res not in printed_values: 62 | try: 63 | 64 | transaction_hash= res['transactionHash'] 65 | txn_receipt = alchemy.core.get_transaction_receipt(transaction_hash) 66 | c = alchemy.core.get_transaction(transaction_hash) 67 | ether_value=alchemy.from_wei(c['value'], 'ether') 68 | 69 | 70 | token_address= txn_receipt['logs'][0]['address'] 71 | 72 | input_signature = alchemy.to_hex(c['input'][:10]) 73 | 74 | 75 | if input_signature.startswith("0xf305d719"): 76 | print(getTimestamp(),"ADD LP") 77 | print("Token Address: ", token_address) 78 | print("Block Number:", res['blockNumber']) 79 | print("Transaction Hash:", res['transactionHash']) 80 | print("Log Index:", res['logIndex']) 81 | print("Topics:", res['topics']) 82 | print("Data:", ether_value) 83 | print("=======================") 84 | elif input_signature.startswith("0xc9567bf9"): 85 | hex_data = res['data'] 86 | second_number = hex_data[66:] 87 | decimal_value = int(second_number, 16) 88 | wei_value = alchemy.to_wei(decimal_value, 'wei') 89 | eth_value = alchemy.from_wei(wei_value, 'ether') 90 | print(getTimestamp(),"OPEN TRADING") 91 | print("Token Address: ", token_address) 92 | print("Block Number:", res['blockNumber']) 93 | print("Transaction Hash:", res['transactionHash']) 94 | print("Log Index:", res['logIndex']) 95 | print("Topics:", res['topics']) 96 | print("Data:", eth_value) 97 | 98 | 99 | 100 | print("=======================") 101 | 102 | elif input_signature.startswith("0x6e3fa5d1"): 103 | print(getTimestamp(),"CREATE ERC20") 104 | print("Token Address: ", token_address) 105 | print("Block Number:", res['blockNumber']) 106 | print("Transaction Hash:", res['transactionHash']) 107 | print("Log Index:", res['logIndex']) 108 | print("Topics:", res['topics']) 109 | print("Data:", ether_value) 110 | 111 | print("=======================") 112 | elif input_signature.startswith("0x4bb278f3"): 113 | hex_data = txn_receipt['logs'][12]['data'] 114 | second_number = hex_data[66:] 115 | decimal_value = int(second_number, 16) 116 | wei_value = alchemy.to_wei(decimal_value, 'wei') 117 | eth_value = alchemy.from_wei(wei_value, 'ether') 118 | print(getTimestamp(), "Finalize") 119 | print("Token Address: ", txn_receipt['logs'][2]['address']) 120 | print("Block Number:", txn_receipt['blockNumber']) 121 | print("Transaction Hash:", txn_receipt['transactionHash']) 122 | 123 | print("Data:", ether_value) 124 | 125 | print("=======================") 126 | else: 127 | 128 | pass 129 | 130 | 131 | except Exception as e: 132 | print(f"Error {e} {alchemy.to_hex(c['input'][:10])} {transaction_hash}") 133 | pass 134 | 135 | printed_values.append(res) 136 | else: 137 | print(f"No result in response_data {response_data}") 138 | except Exception as e: 139 | print(f"Error {e} {alchemy.to_hex(c['input'][:10])} {transaction_hash}") 140 | print(response_data) 141 | 142 | time.sleep(1) 143 | -------------------------------------------------------------------------------- /Ethereum/Trading/BuyTokenErc20-1inch.py: -------------------------------------------------------------------------------- 1 | "Buy using 1inch aggregator for cheap Gas fees " 2 | #Todo -------------------------------------------------------------------------------- /Ethereum/Trading/CopyAnyWallets-Buy_Sells.py: -------------------------------------------------------------------------------- 1 | "Do you have a list of wallets you wish to follow? Copy Trades of any Wallets Buys and Sells " 2 | -------------------------------------------------------------------------------- /Ethereum/Trading/CopyTrade-IrrespectiveOfRouter.py: -------------------------------------------------------------------------------- 1 | "Irrespective of routers used copy trade list of wallets---BUYS AND SELL-----*******" 2 | 3 | 4 | """-----ADD YOUR WALLETS ON LINE 65 -----""" 5 | #TODO Keep a log of buy amount and sell amount in ETH use Data-Analytic techniques to determine most profitable wallet 6 | #TODO Display Sales profit and keep log for data analysis 7 | 8 | import asyncio 9 | import json 10 | import websockets 11 | from web3 import Web3 12 | import requests 13 | from alchemy import Alchemy, Network 14 | import datetime 15 | 16 | 17 | 18 | class style(): # Class of different text colours - default is white 19 | BLACK = '\033[30m' 20 | RED = '\033[31m' 21 | GREEN = '\033[32m' 22 | YELLOW = '\033[33m' 23 | BLUE = '\033[34m' 24 | MAGENTA = '\033[35m' 25 | CYAN = '\033[36m' 26 | WHITE = '\033[37m' 27 | UNDERLINE = '\033[4m' 28 | RESET = '\033[0m' 29 | 30 | 31 | 32 | api_key = "Enter Your Alchemy API" 33 | network = Network.ETH_MAINNET 34 | alchemy_ws_url="wss://eth-mainnet.g.alchemy.com/v2/"+api_key 35 | alchemy= Alchemy(api_key,network) 36 | WETH="0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" 37 | provider_url = "wss://eth-mainnet.g.alchemy.com/v2/"+api_key 38 | 39 | 40 | 41 | 42 | 43 | 44 | def getTimestamp(): 45 | while True: 46 | timeStampData = datetime.datetime.now() 47 | currentTimeStamp = "[" + timeStampData.strftime("%H:%M:%S.%f")[:-3] + "]" 48 | return currentTimeStamp 49 | 50 | 51 | def format_hex(original_hex): 52 | hex_without_prefix = original_hex[2:] 53 | 54 | desired_length = 64 55 | 56 | padded_hex = hex_without_prefix.zfill(desired_length) 57 | 58 | final_hex = "0x" + padded_hex 59 | 60 | return final_hex.lower() 61 | 62 | 63 | 64 | queue = asyncio.Queue() 65 | 66 | addresses = [ 67 | # "0xae2Fc483527B8EF99EB5D9B44875F005ba1FaE13", 68 | # "0x6b75d8AF000000e20B7a7DDf000Ba900b4009A80", 69 | "0x0f894fc241C8f211C9a6B6Cd01108D1C878845E4", 70 | "0x82E00E14288012C9033cDc6ce2AF0fe7b135EDB3", 71 | "0x66e3e90A4Cf3742c212Cf7c30603cE22F9Fa9c94", 72 | "0x3A52F0Aeef21b3EF1C92F4Be10e6b0738C829Dba", 73 | "0xfcDCAC15c9b2A4227A00BF050d31486fA8652FB8", 74 | "0x7b1184bF2aB8a2F0fB2522C3C8BA726A7ae44c1A", 75 | "0xFa9BeC18fB25E26320518F90eD63B68CB3A11671", 76 | "0xe267727A0c8614800A9CA10C1f135dCa094657c9", 77 | "0x1831322f48dBd8a9323b72d304d6018Cf37dD40E", 78 | "0x876cD87bF451b1764880fDf14Ee49212AE2a4d0f", 79 | "0x45107f30fbf5752c5767b1c70b03c41fc0f4b507", 80 | "0xe6C5e38110d841608DC44096c6673D69EbB681EB", 81 | "0x2e52c65e3Ffc8E87A13263867E042bf59A9ca6BD", 82 | "0x7e8D45eec0613731517E3E62e52755634711DbfC", 83 | "0x9660259A30Bb8ae9Bbcf28241d745b2D581280C1", 84 | "0x516449F7a5c75238326F6f770567D97F5c3F9b11", 85 | "0x0Ea06e9d6Be66e3E1fC67685F4797Ff7fc849667", 86 | "0x2C1433fA8dD5d550b8CEd8dD5C9eC065C124538b", 87 | "0x4D4368A6eB8262BC7C57aBeA1CB7f8Cf18397440", 88 | "0x0203458eE55e240140aE61B5DaFAF5605D1E011D", 89 | "0x0f894fc241C8f211C9a6B6Cd01108D1C878845E4", 90 | "0x89a976060B464bf41d7632E0C459bdA8Ae211D36", 91 | "0xb238e7a094E7f4fE6CCC9af2ef24d7c2184621b0", 92 | "0x609F4Da674397d16BF0422288B5e18b09572e863", 93 | "0x0Db098Ab5217dbd31aBc417dD71a2a8676398A79", 94 | "0xbd579c4f7886bfdDA1b5e3459f2FFB77d3741132", 95 | "0xAC12785Bf910513FD47192A34E23D4533312FB46", 96 | "0xFdfBeA492bcB16deb4b1390eA1A3c41464806cBE", 97 | "0x8A2955394DEC47d14AbaE7F506E7D183C37cF39e", 98 | "0x3fA027c1718AcD863eAaEeC33Ef33fC2377F4c88", 99 | "0x740De8cC9E916049CC493BEcAf186063d3F14ec5", 100 | "0xC7B9433D4E856e34F7519AEF92a9f8e9d9759330", 101 | "0xD1469EdA328e7E9cE63Ad704731C92CD69c475bC", 102 | "0x006f0537ED493f7F84340dc6c417a8381C6B1035", 103 | "0xe076A42bf0eFb5259AaE29e71A1F1abEd3206319", 104 | "0xD2d7cFcD0b4c6DC48a059B0b7Dd5819075C36345", 105 | "0x81021704a53630963159E14f467304218d86bE43", 106 | "0xcDA31b98131B059FE6464963F1F474De6e13eB2b", 107 | "0xb6380198D5D96D9a950714f9eFF9EBF283307180", 108 | "0x7ce9dA83253aFA7677c18815747a1adB271F92cA", 109 | "0x2f6fc19d5Da153F9610EBcaBA3E770b94F29f362", 110 | "0xdC449654E3fB063c0C6932CBF169Fb43fa8e2DD9", 111 | "0xa98D3AE9312192956be5F98DBdD87963ede57687", 112 | "0x3ba9692Bc12562eE15DC88B3F3e55339bd51C5b3", 113 | "0x9Fc5389C66bBfAC23b77bDef85700672928De555", 114 | "0x8d3B36AB2c9eF588d3472c8de0950796Ac8A2443", 115 | "0x42fc2073d081bea5Cea3cce9b05507Fb6d3c2a63", 116 | "0x4F8c93faD9282eA50A8b7e73ed5ef44c8c60BD4d", 117 | "0x3Ca9eC53D076784dcA3d8BB467e7ff78c29C73c4", 118 | "0xc03D38F89b175596859C99eaB231d31e1808358c", 119 | "0xAb819462df33618b383fe402f875260b683F11ac", 120 | "0xEE06aAc8BAc0d7a3A3B4A8554e8bF4E348a92700", 121 | "0x9fc4Baf5C37f23C3875c7bE693682EeAe6d632eD", 122 | "0xF891bF97f1a51D57bD4D2568f94A9f8882162050", 123 | "0x2d007C5C757cEf2fb53c593242331f50b159a72D", 124 | "0x6F7a0B2F75be0b106aAD8b355D6b59D93624DCA4", 125 | "0x7C7A2AD5037701593D76Fad7fb0AB0902366EFA3", 126 | "0x02Cf562FA7503C4743AE6A38737CFbC227466deE", 127 | "0x81d882e41D8d0b594aa7636f1303Cb9A5a4B4b2E", 128 | "0x691598900ceC00B6CBdb32aE821c4f8Fc0C727d4", 129 | "0xebb8c8e5FBdc556Eedab7757f4E26F79Df8E2269", 130 | "0xc03D38F89b175596859C99eaB231d31e1808358c", 131 | "0xbaA56bE07Be167D0eFaFFdEFD08689B77C7524fE", 132 | "0xfDA68F66824Ef2695DF85a5aaAc94097587D2893", 133 | "0x238FdfEF295EEa7296bb6CDb5FB14c9D0DCd8B93", 134 | "0xFCe2ceCbb4EF3439664A3E8Da7Dba922F988A86d", 135 | "0xF36445d62EE61a296bA58F118D6Aa001a98FD51a", 136 | "0x0000DD10e16fD09E41cE5BBb263e70f743dA882E", 137 | "0xaBe4702cA08A9B9732E534Bca4E65b4B2f1f1FC3", 138 | "0xc4E1549543C31A3B86Ce04F071CDe2B64451bcd4", 139 | "0xc21524df508dfB9A5f183fe536dCC57227149b0F", 140 | "0x60C530171A6B38Eb0712C12bDD7B5a164b2EA710", 141 | "0x202b029C2Ff6096c33c72B54c56381C46A8483D6", 142 | "0x07b6692dC260C0C140d7BAA6947166f0420F3Fc9", 143 | "0x7F2827620907dC8b2861839D60916d7Bd575Cdee", 144 | "0x83a46c5b87ABEb4Df5e4d03DDD117824a549a346", 145 | "0x15952737622Dd0b09CC69A5089FC67A0aB7C0903", 146 | "0xd05965c9FD9c3bE171071f382615D39D7A19377f", 147 | "0x8f81DE2419feF279451BfeF2E2ca2ffAa2783dC0", 148 | "0x0015FCe9235e359EFf59890F9ff23352c876235d", 149 | "0x0eD382D36d29f932153107637ADba858f6417413", 150 | "0x1C01EE7741c3152a6B5Aa764747748130127E56A", 151 | "0xAcc71d0F7B18bB2c8e9c53e82C47e10Ab367F902", 152 | "0x7eD06C84F061DBF012D6AEc932762d2937d35f88", 153 | "0x1b38690Bf9C22604cDDad1764eEE6edd94dd3d1E" 154 | 155 | ] 156 | 157 | monitored_wallets_hex = [format_hex(address) for address in addresses] 158 | async def process_transaction(transaction_hash): 159 | try: 160 | receipt = alchemy.core.get_transaction_receipt(transaction_hash) 161 | #print(receipt) 162 | transfer_details = alchemy.core.get_transaction(transaction_hash) 163 | 164 | from_address=transfer_details['from'] 165 | 166 | txn_hash= alchemy.to_hex( transfer_details['hash']) 167 | block_num= transfer_details['blockNumber'] 168 | 169 | print("=======================") 170 | 171 | if receipt['status'] == 1: 172 | eth_value = None 173 | 174 | for logs in receipt['logs']: 175 | if logs['address'] == WETH and alchemy.to_hex(logs['topics'][0]) == "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": 176 | hex_value = alchemy.to_hex(logs['data']) 177 | integer_value = int(hex_value, 16) 178 | eth_value = alchemy.from_wei(integer_value, 'ether') 179 | eth_value= '{:.4f}'.format(eth_value) 180 | 181 | if eth_value is not None: 182 | for logs in receipt['logs']: 183 | if logs['address'] != WETH: 184 | if alchemy.to_hex(logs['topics'][ 185 | 0]) == "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef": 186 | if alchemy.to_hex(logs['topics'][2]) in monitored_wallets_hex: 187 | 188 | print(f" {getTimestamp()} {style.RED}{block_num}{style.RESET} {style.GREEN} TOKEN BOUGHT: {logs['address']} {style.RESET} {style.MAGENTA} WALLET_ADDRESS: {from_address}{style.RESET} For {eth_value}ETH",style.RESET) 189 | print(f"TxnHash: https://etherscan.io/tx/{txn_hash} ") 190 | print(style.CYAN + "====BUYING TRADE SIMULATION======", style.RESET) 191 | 192 | elif alchemy.to_hex(logs['topics'][1]) in monitored_wallets_hex: 193 | print(f" {getTimestamp()} {style.RED}{block_num}{style.RESET} {style.YELLOW}TOKEN SOLD: {logs['address']} {style.RESET} {style.MAGENTA} WALLET_ADDRESS: {from_address}{style.RESET} For {eth_value} ETH", style.RESET) 194 | print(f"TxnHash: https://etherscan.io/tx/{txn_hash} ") 195 | print(style.MAGENTA+"====SELLING TRADE SALE SIMULATION=====",style.RESET) 196 | elif logs['address'] != WETH: 197 | if alchemy.to_hex( 198 | logs['topics'][0]) == "0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925": 199 | if alchemy.to_hex(logs['topics'][1]) in monitored_wallets_hex: 200 | print(f"{getTimestamp()} {style.RED}{block_num}{style.RESET}{style.MAGENTA} TOKEN APPROVED: {logs['address']}{style.RESET}{style.MAGENTA} WALLET_ADDRESS {from_address}{style.RESET} ",style.RESET) 201 | print(f"TxnHash: https://etherscan.io/tx/{txn_hash}") 202 | print(style.MAGENTA+"====APPROVED TRANSACTION=====",style.RESET) 203 | queue.task_done() 204 | 205 | 206 | 207 | 208 | except Exception as e: 209 | queue.task_done() 210 | 211 | 212 | 213 | 214 | async def subscribe_to_pending_transactions(): 215 | print("Connecting to WebSocket...") 216 | async with websockets.connect(alchemy_ws_url) as websocket: 217 | print("WebSocket connection established.") 218 | ws_url = alchemy_ws_url 219 | subscription_data = { 220 | "jsonrpc": "2.0", 221 | "method": "eth_subscribe", 222 | "params": ["alchemy_minedTransactions", 223 | {"addresses": [{"from": address} for address in addresses], "includeRemoved": False, 224 | "hashesOnly": True}], 225 | "id": 1 226 | } 227 | 228 | async with websockets.connect(ws_url) as websocket: 229 | await websocket.send(json.dumps(subscription_data)) 230 | while True: 231 | response = await websocket.recv() 232 | response_data = json.loads(response) 233 | if "params" in response_data and "result" in response_data["params"]: 234 | transaction_hash = response_data["params"]["result"]['transaction']['hash'] 235 | queue.put_nowait(transaction_hash) 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | async def process_queue(): 244 | print(style.GREEN+"=====Monitoring Targets Wallets To Copy Transaction======",style.RESET) 245 | while True: 246 | if queue.qsize() <= 3: # Check if there are more than 3 transactions in the queue 247 | wait_time =3 # Wait for 3 seconds 248 | else: 249 | wait_time = 1 # Default wait time for less than or equal to 3 transactions 250 | 251 | transaction_hash = await queue.get() 252 | print(getTimestamp(),transaction_hash) 253 | await asyncio.sleep(wait_time) # Wait for the determined wait_time 254 | await process_transaction(transaction_hash) 255 | 256 | if __name__ == "__main__": 257 | asyncio.gather(subscribe_to_pending_transactions(), process_queue()) 258 | asyncio.get_event_loop().run_forever() 259 | 260 | 261 | -------------------------------------------------------------------------------- /Ethereum/Trading/CopyWalletTrade.py: -------------------------------------------------------------------------------- 1 | # Test on testnet 2 | 3 | import asyncio 4 | from web3 import Web3 5 | import json 6 | import requests 7 | 8 | class style(): # Class of different text colours - default is white 9 | BLACK = '\033[30m' 10 | RED = '\033[31m' 11 | GREEN = '\033[32m' 12 | YELLOW = '\033[33m' 13 | BLUE = '\033[34m' 14 | MAGENTA = '\033[35m' 15 | CYAN = '\033[36m' 16 | WHITE = '\033[37m' 17 | UNDERLINE = '\033[4m' 18 | RESET = '\033[0m' 19 | 20 | 21 | """ 22 | Scenario Explanation 23 | I want to copy a wallet trades this wallet can interact with different router's depending on the 24 | Dex Exchange used Assuming trades are done via a dex and not via a smart contract 25 | 26 | I scan the memepool for transaction involving that wallet 27 | If trade traced in the memepool is a Buy based on the swap function used 28 | I will proceed to make a buy too 29 | 30 | 31 | """ 32 | 33 | #Goerli Testnet RPC 34 | #w3 = Web3(Web3.HTTPProvider("https://eth-goerli.g.alchemy.com/v2/demo")) 35 | w3 = Web3(Web3.HTTPProvider("https://eth-mainnet.g.alchemy.com/v2/lTlatSTYDZmCv6wVLRIDff7S3kZhL2dq")) 36 | 37 | 38 | #TODO ADD -Aggregation Router 0x1111111254EEB25477B68fb85Ed929f73A960582 39 | 40 | #This list is to check for all interaction of target wallets with any of these routers 41 | uniswap_router_addresses = [ 42 | '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D', #Uniswap-V2 Router 43 | '0xE592427A0AEce92De3Edee1F18E0157C05861564', #Uniswap-V3 Router 44 | '0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45', #Uniswap-V3 02 Router 45 | '0xEf1c6E67703c7BD7107eed8303Fbe6EC2554BF6B', #OldUniversal-Router 46 | '0x3fC91A3afd70395Cd496C647d5a6CC9D4B2b7FAD', #Universal-Router 47 | 48 | ] 49 | 50 | if w3.is_connected(): 51 | #print(style.GREEN+"Connected To Goerli Testnet") 52 | print(style.GREEN + "Connected To Mainnet Testnet") 53 | 54 | # print(w3.eth.get_block('latest')) 55 | 56 | check_Buy_functions = {"swapETHForExactTokens": True, "swapExactETHForTokens": True, 57 | "swapExactETHForTokensSupportingFeeOnTransferTokens": True, 58 | 'multicall': True, 'execute': True} 59 | 60 | #Here is the wallet Address I wish to copy 61 | Target_WalletAddress= "0xb6007a21D1c890742bd9a3A4E2C0CA8Df646b0Be" 62 | 63 | 64 | 65 | count= 0 66 | async def handle_new_block(block): 67 | global count 68 | for tx_hash in block['transactions']: 69 | try: 70 | tx = w3.eth.get_transaction(tx_hash) 71 | 72 | 73 | for router_address in uniswap_router_addresses: 74 | 75 | if tx['from'] == Target_WalletAddress and tx['to'] == router_address: 76 | hash= tx['hash'] 77 | tx_hash = w3.to_hex(hash) 78 | # function_name = decode_input_data(tx['input'], tx['to']) 79 | # if function_name is not None: 80 | # count += 1 81 | 82 | 83 | 84 | count+=1 85 | print(count,style.YELLOW + "Tx_Hash: ", 86 | "https://etherscan.io/tx/"+w3.to_hex(hash)) 87 | 88 | # print(style.GREEN+f"{function_name}") 89 | print(style.RED+"------------------") 90 | #break 91 | else: 92 | 93 | continue 94 | 95 | except Exception as e: 96 | print("An error occurred while processing a transaction:", e,w3.to_hex(tx_hash)) 97 | 98 | async def track_new_blocks(): 99 | current_block_number = w3.eth.block_number 100 | 101 | 102 | while True: 103 | latest_block = w3.eth.get_block('latest') 104 | latest_block_number = latest_block['number'] 105 | 106 | if latest_block_number > current_block_number: 107 | for block_number in range(current_block_number + 1, latest_block_number + 1): 108 | block = w3.eth.get_block(block_number) 109 | await handle_new_block(block) 110 | 111 | current_block_number = latest_block_number 112 | 113 | # Delay between checking for new blocks 114 | await asyncio.sleep(5) 115 | 116 | # Run the event loop 117 | async def main(): 118 | await track_new_blocks() 119 | 120 | if __name__ == '__main__': 121 | loop = asyncio.get_event_loop() 122 | loop.run_until_complete(main()) -------------------------------------------------------------------------------- /Ethereum/Trading/GaslessApprove.py: -------------------------------------------------------------------------------- 1 | "Gasless approve for faster selling Txn Via Uniswap V2" 2 | -------------------------------------------------------------------------------- /Ethereum/Trading/MonitorPriceOfBoughtToken.py: -------------------------------------------------------------------------------- 1 | ""Monitor Price of bot token and automatically trigger sale"" 2 | -------------------------------------------------------------------------------- /Ethereum/Trading/MonitorPriceandSell.py: -------------------------------------------------------------------------------- 1 | #Monitor Price of a token and gain on the price volatility 2 | -------------------------------------------------------------------------------- /Ethereum/Trading/Monitor_TokenLiquidityTxn.py: -------------------------------------------------------------------------------- 1 | "Monitor transactions involving Removing liquidity and sell before it occurs" -------------------------------------------------------------------------------- /Ethereum/Trading/SnipeOnSameBlock.py: -------------------------------------------------------------------------------- 1 | #Todo 2 | #Ensure your first buy occurs on the same block be it for copytrading or Snipping 3 | -------------------------------------------------------------------------------- /Ethereum/Trading/Subscribe.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | import json 3 | from web3 import Web3 4 | from websockets import connect 5 | 6 | """ 7 | Subscribes to pending transactions 8 | https://community.infura.io/t/web3-py-how-to-subscribe-to-pending-ethereum-transactions-in-python/5409 9 | """ 10 | 11 | infura_ws_url="wss://mainnet.infura.io/ws/v3/d617b8c04ea349faa0ccb45aa2b8ad72" 12 | infura_http_url = 'https://mainnet.infura.io/v3/d617b8c04ea349faa0ccb45aa2b8ad72' 13 | web3 = Web3(Web3.HTTPProvider(infura_http_url)) 14 | 15 | # Used if you want to monitor ETH transactions to a specific address 16 | account = 'Enter Address' 17 | 18 | async def get_event(): 19 | async with connect(infura_ws_url) as ws: 20 | await ws.send('{"jsonrpc": "2.0", "id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]}') 21 | subscription_response = await ws.recv() 22 | print(subscription_response) 23 | 24 | while True: 25 | try: 26 | message = await asyncio.wait_for(ws.recv(), timeout=15) 27 | response = json.loads(message) 28 | txHash = response['params']['result'] 29 | print(txHash) 30 | # Uncomment lines below if you want to monitor transactions to 31 | # a specific address 32 | # tx = web3.eth.get_transaction(txHash) 33 | # if tx.to == account: 34 | # print("Pending transaction found with the following details:") 35 | # print({ 36 | # "hash": txHash, 37 | # "from": tx["from"], 38 | # "value": web3.from_wei(tx["value"], 'ether') 39 | # }) 40 | pass 41 | except: 42 | pass 43 | 44 | if __name__ == "__main__": 45 | loop = asyncio.get_event_loop() 46 | while True: 47 | loop.run_until_complete(get_event()) -------------------------------------------------------------------------------- /Ethereum/Trading/TrackLockEvents.py: -------------------------------------------------------------------------------- 1 | 2 | #Todo 3 | # How to track lock events of Popular locked Contracts, TrustSwap Security, Pinky, UNICRYPT Security 4 | # If lock > 100Year Buy Token 5 | # Write function to find contract address from LP -Addess 6 | # Inspired by Test Token -------------------------------------------------------------------------------- /Ethereum/Wallet/BuyWithMultipleWallets.py: -------------------------------------------------------------------------------- 1 | #Todo -------------------------------------------------------------------------------- /Ethereum/Wallet/Hd-wallet.py: -------------------------------------------------------------------------------- 1 | "Generate Wallet from Mnemonic" 2 | 3 | from web3 import Web3 4 | from mnemonic import Mnemonic 5 | from web3 import Web3 6 | import secrets 7 | from eth_account import Account 8 | 9 | 10 | w3 = Web3(Web3.HTTPProvider("Enter Infura Node")) 11 | 12 | mnemo = Mnemonic("english") 13 | words = mnemo.generate(strength=256) 14 | 15 | extra_security= secrets.token_hex(32) 16 | 17 | w3.eth.account.enable_unaudited_hdwallet_features() 18 | #Generated Acct from Mnemonic 19 | acct = Account.from_mnemonic(words,passphrase=extra_security) 20 | acct_privatekeys =w3.toHex(acct.privateKey) 21 | accout = w3.eth.account.privateKeyToAccount(acct_privatekeys) 22 | 23 | account_publickey = accout.address 24 | account_privatekey= accout.privateKey 25 | 26 | print("MNEMONIC PHRASE--[KEEP PRIVATE]",words) 27 | print('Public Key', account_publickey) 28 | print("Private_Key---[KEEP PRIVATE]",w3.toHex(account_privatekey)) -------------------------------------------------------------------------------- /Ethereum/Wallet/MultisignatureWallet.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BitFancy/Solana-Trading-Bot/c5bf9b933bc01278b6d292052a744f2ca4969f3b/Ethereum/Wallet/MultisignatureWallet.py -------------------------------------------------------------------------------- /Ethereum/Wallet/create-multiple-ETHaddress.py: -------------------------------------------------------------------------------- 1 | 2 | from web3 import Web3 3 | import secrets 4 | 5 | # Connect to the Ethereum blockchain using the Infura node 6 | 7 | web3 = Web3(Web3.HTTPProvider("https://eth-mainnet.g.alchemy.com/v2/lTlatSTYDZmCv6wVLRIDff7S3kZhL2dq")) 8 | 9 | # Define the number of addresses to generate 10 | num_addresses = 10 11 | 12 | # Generate the addresses and private keys 13 | for i in range(num_addresses): 14 | extra_security = secrets.token_hex(32) 15 | # Generate a new Ethereum address and private key 16 | address = web3.eth.account.create(extra_security) 17 | 18 | # Print the address and private key 19 | print(f"Address: {address.address}") 20 | print(f"Private key: {address._private_key.hex()}") -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Henry Tirla 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Learning Resources/myLearningResources.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | #Books I found Useful On my starter Journey 4 | 5 | ##Trading Books 6 | How to DeFi: A Practical Guide to Decentralized Finance (DeFi) by CoinGecko 7 | 8 | Cryptocurrency - A Trader's Handbook: A Complete Guide On How To Trade Bitcoin And Altcoins by Marvin Neuefeind 9 | 10 | 11 | ##Blockchain Books/ Programming Books 12 | 13 | Mastering Bitcoin: Programming the Open Blockchain by Andreas M. Antonopoulos 14 | 15 | Mastering Ethereum: Building Smart Contracts and DApps by Andreas M. Antonopoulos 16 | 17 | 18 | 19 | ....... -------------------------------------------------------------------------------- /Notes/Todo.txt: -------------------------------------------------------------------------------- 1 | Write articles on how to use these script and get the best out of it 2 | henrytirla.medium.com add comment of article on each script 3 | 4 | -Number of lines of code ? A--T R<---T 5 | - Diff Checker--Check against scam contracts 6 | - How many wallets bought on the block liquidity was added and how much percentage of the token do they hold? 7 | - Was a whitelist present to prevent external wallets from buying on a specific time ie during the first minutes of the life of a token. 8 | - Use Subgraphs to get Live onchain data -Track Traction Filter Scams and Buy 9 | Make youtube Videos explaining scripts and how they can be relevant. 10 | 11 | 12 | # Host Script on GCP - Automate Trading Process - Write article 13 | 14 | #Create UI for memepool script and after LP 15 | 16 | Make UI of copy trade scripts BNB and Ethereum Network 17 | 18 | Evaluate tokens while scanning memepool - Categorize tokens in categories 19 | 20 | Build API for erc20 tokens checking for honeypots 21 | 22 | Build tool able to read the logic of a smartcontract and detect contract base scams that pass all technical properties.Eg Token Approval Scam 23 | 24 | Script to evaluate the profitability of a wallet 25 | 26 | -Make a concise list of scams and write code to counter it at least to a certain degree. Test and measure against time how good these scripts perform 27 | 28 | -binary buying criteria 29 | 30 | - Add in evaluaton metric + Number of buys occuring in the same block that liquidity was added ie how many unique wallets bought and how much percentage of the token 31 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |