参数
此方法没有参数。
返回值
string Block number, hex.
适用场景
Get the latest block number: health checks, polling for new blocks, and choosing a fixed block for consistent reads.
如何解读结果
Hex integer: parseInt(result, 16).
提示
- Read the head once, then pass that number to every call in the same job so all answers come from one consistent state.
- Cheap, but not free: poll every block time (about 12 seconds on Ethereum), not in a tight loop.