I'm trying to understand block time and speed of transaction. For now I'm testing on Binance Smart Chain and then I will go to ethereum network.
I have a simple code in nodejs using web3 library, I'm connected to a node via websocket :
- I subscribe to 'newBlockHeaders' events
- Once I get a new block I use web3.eth.accounts.signTransaction and web3.eth.sendSignedTransaction to send a test transaction
My transaction is ALWAYS 2 blocks after the received block event. I want it to be 1 block after.
Looks like confirmation time is about 6 sec so 2 blocks makes sense. But how to place my transaction on just 1 block after the event received?