L0vdL0vd

eth_newBlockFilter

Creates a filter that reports new block hashes; poll it with eth_getFilterChanges.

curl https://eth.l0vdinfra.com/YOUR_KEY \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_newBlockFilter","params":[]}'

Пример ответа

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": "0x050000000000000025ecda100596be70"
}
Параметры и свой эндпоинт

Параметры

У метода нет параметров.

Возвращает

string Filter ID.

Когда использовать

Get notified of new blocks by polling, for example to trigger work on every new head.

Как читать ответ

Filter ID; eth_getFilterChanges then returns the hashes of blocks added since the last poll.

Советы

  • Polling eth_blockNumber is an equally good, stateless alternative.

Связанные методы