- What I want to do: look through all pairs in pancake V2(currently 1261k pairs), and get token0 and token1 address, thus read their source code through bscscan api, to identify whether its source code has certain specific function.
- How Im doing: Im using web3.py, for the setup:
web3_utity = Web3(Web3.HTTPProvider("https://bsc-dataseed.binance.org/", request_kwargs={'timeout': 50}))
β for the token0 and token1 address, and Im using 5 threads, each thread has a scan(selfm index) function
``` def scan(self, index): pair_addr = self.factory_contract.functions.allPairs(index).call()
pair_contract = self.web3_utity.eth.contract(address=self.web3_utity.toChecksumAddress(pair_addr), abi=self.abi_pair) token0_addr = pair_contract.functions.token0().call() token1_addr = pair_contract.functions.token1().call() sleep(0.3 * random.randint(1, 3))
```
- Problem: after a while(usually about 40-50min), errer: requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='bsc-dataseed.binance.org', port=443): Read timed out. (read timeout=10). Re-run the code doesn't solve the connection err.
- Question: Im assuming this is caused by the server rpc node: 'bsc-dataseed.binance.org', anti-scrap. Note that 'bsc-dataseed.binance.org' is binance's public rpc note, if I buy some other rpc node service, connect to those rpcs, will it solve the connection error? If not, what can I do? Im hoping to find a solution which allows me to scan all pairs smoothly and efficiently in pancake V2. Thanks alot
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments