I use python 3.7 and own Node.
So i want to receiving every last block from own Node immediately after it was mined.
from web3 import Web3 WEB3_WS_URI = 'ws://node_url:8546' w3 = Web3(Web3.WebsocketProvider(WEB3_WS_URI))
After that how i should use
w3 for establish connection to receive every new block with transactions immediately after it was mined?
I can use:
def run(): while True: last_block = w3.eth.block_number print(last_block) time.sleep(45)
but i'm sticking to my own time interval of 45 sec which is not very good because the real interval before to emerge new block can be more or lees. I need get new block only after new event was done - block was mined and ready for parce.