Chain scan paced for the nodereal public key (burst 12, 1.1/s) and the three log filters run side by side; website scan reads named contract pages and site code context; PolHunter missions prepared (not live)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+21
-2
@@ -15,7 +15,7 @@ from concurrent.futures import ThreadPoolExecutor
|
||||
NODEREAL = 'https://bsc-mainnet.nodereal.io/v1/64a9df0874fb4a93b9d0a3849de012d3'
|
||||
CHAINS = {
|
||||
'bsc': {'id': 56, 'name': 'BNB Chain', 'native': 'BNB', 'explorer': 'https://bscscan.com',
|
||||
'rpcs': ['https://bsc-dataseed.bnbchain.org', 'https://bsc-rpc.publicnode.com', NODEREAL, 'https://bsc-dataseed1.defibit.io', 'https://bsc-dataseed2.ninicoin.io'],
|
||||
'rpcs': ['https://bsc-dataseed.bnbchain.org', 'https://bsc-rpc.publicnode.com', 'https://bsc-dataseed1.defibit.io', 'https://bsc-dataseed2.ninicoin.io'],
|
||||
'log_providers': [(NODEREAL, 49000), ('https://bsc.rpc.blxrbdn.com', 5000)],
|
||||
'archive_rpcs': [NODEREAL], 'block_secs': 0.45,
|
||||
'tokens': {'USDT': '0x55d398326f99059ff775485246999027b3197955', 'USDC': '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', 'BUSD': '0xe9e7cea3dcd96aee6a24b63ae6d6e53fba8a9b56'}},
|
||||
@@ -37,6 +37,20 @@ CHAINS = {
|
||||
}
|
||||
TRANSFER = '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef'
|
||||
APPROVAL = '0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925'
|
||||
# nodereal's public key allows a burst of about 20 calls, then about 1 call a second (measured 2026-11-16): pace it, never hammer it
|
||||
LIMITS = {NODEREAL: (1.1, 12)}
|
||||
|
||||
|
||||
class Bucket:
|
||||
def __init__(self, rate, burst): self.rate, self.cap, self.tokens, self.t, self.lock = rate, burst, burst, time.time(), threading.Lock()
|
||||
def take(self):
|
||||
while True:
|
||||
with self.lock:
|
||||
now = time.time(); self.tokens = min(self.cap, self.tokens + (now - self.t) * self.rate); self.t = now
|
||||
if self.tokens >= 1: self.tokens -= 1; return
|
||||
wait = (1 - self.tokens) / self.rate
|
||||
time.sleep(wait)
|
||||
BUCKETS = {u: Bucket(*v) for u, v in LIMITS.items()}
|
||||
S = requests.Session()
|
||||
S.headers.update({'user-agent': 'webworthit-readonly-scan/1'})
|
||||
|
||||
@@ -47,6 +61,7 @@ class RPC:
|
||||
|
||||
def _post(self, u, method, params, timeout=60):
|
||||
with self.lock: self.calls += 1
|
||||
if u in BUCKETS: BUCKETS[u].take()
|
||||
return S.post(u, json={'jsonrpc': '2.0', 'id': 1, 'method': method, 'params': params}, timeout=timeout).json()
|
||||
|
||||
def call(self, method, params, tries=6, urls=None):
|
||||
@@ -93,7 +108,11 @@ class RPC:
|
||||
if time.time() > deadline: raise TimeoutError()
|
||||
y = min(x + span - 1, b)
|
||||
qq = dict(q); qq['fromBlock'] = hex(x); qq['toBlock'] = hex(y)
|
||||
j = self._post(u, 'eth_getLogs', [qq], timeout=45 if pi == 0 else 20)
|
||||
for _ in range(6):
|
||||
j = self._post(u, 'eth_getLogs', [qq], timeout=45 if pi == 0 else 20)
|
||||
if 'error' in j and isinstance(j['error'], dict) and j['error'].get('code') in (-32005, 429) and time.time() < deadline:
|
||||
time.sleep(3); continue
|
||||
break
|
||||
if 'error' in j: raise Exception(j['error'])
|
||||
out += j['result']
|
||||
return out, True
|
||||
|
||||
Reference in New Issue
Block a user