Sabrebar

time between blocks bsc

Jul 21st, 2021 (edited)
291
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. from web3 import Web3
  2. import time
  3.  
  4.  
  5. infura_url = "https://bsc-dataseed.binance.org/"
  6. w3 = Web3(Web3.HTTPProvider(infura_url))
  7.  
  8.  
  9. print(time.time())
  10. lastb = w3.eth.block_number
  11. lastt = time.time()
  12. while True:
  13.     t = time.time()
  14.     b=w3.eth.block_number
  15.     if lastb == b-1:
  16.         print(t-lastt)
  17.         lastb = b
  18.         lastt = t
  19.  
Add Comment
Please, Sign In to add comment