Creates a filter in the node, to notify when a new block arrives. To check if the state has changed, call eth_getFilterChanges.
Code Examples:
curl http://sample-endpoint-name.network.quiknode.pro/token-goes-here/ \ -X POST \ -H "Content-Type: application/json" \ --data '{"jsonrpc":"2.0","method":"eth_newBlockFilter","params":[],"id":67}'
require 'ethereum.rb' client = Ethereum::HttpClient.new('http://sample-endpoint-name.network.quiknode.pro/token-goes-here/') response = client.eth_new_block_filter puts response["result"]
from web3 import Web3, HTTPProvider w3 = Web3(HTTPProvider('http://sample-endpoint-name.network.quiknode.pro/token-goes-here/')) newBlockFilterId = w3.eth.filter('latest') print(newBlockFilterId)
const ethers = require("ethers"); (async () => { const provider = new ethers.providers.JsonRpcProvider("http://sample-endpoint-name.network.quiknode.pro/token-goes-here/"); const filterId = await provider.send("eth_newBlockFilter"); console.log(filterId); const logs = await provider.send("eth_getFilterChanges", [filterId]); console.log(logs); })();