curl --request POST \
--url https://aurora-mainnet.core.chainstack.com/6df1a1b3061097e66349993a96b8e535 \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getFilterChanges",
"params": [
"0xbdc5b4b99ca699e1d734fc4202afee79"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
"<string>"
]
}curl --request POST \
--url https://aurora-mainnet.core.chainstack.com/6df1a1b3061097e66349993a96b8e535 \
--header 'Content-Type: application/json' \
--data '
{
"jsonrpc": "2.0",
"method": "eth_getFilterChanges",
"params": [
"0xbdc5b4b99ca699e1d734fc4202afee79"
],
"id": 1
}
'{
"jsonrpc": "<string>",
"id": 123,
"result": [
"<string>"
]
}eth_getFilterChanges method.
eth_getFilterChanges in this page, first create a new filter using one of the following:Then use the fresh filter ID as the parameter for eth_getFilterChanges.string — the filter ID of the filter for which you want to retrieve the changesarray — an array that represents the changes that have occurred on the blockchain since the last time the filter was polled:
eth_newBlockFilter:
blockHash — the hashes of the new blocks since the last time the filter was polled.eth_newPendingTransactionFilter:
transactionHash — the hashes identifying new pending transactions since the last time the filter was polled.eth_newFilter, the following event logs:
address — the contract address from which the event originated.topics — an array of 32-byte data fields containing indexed event parameters.data — the non-indexed data that was emitted along with the event.blocknumber — the block number in which the event was included. null if it is pending.transactionhash — the hash of the transaction that triggered the event. null if pending.transactionindex — the integer index of the transaction within the block’s list of transactions. null if it is pending.blockhash — the hash of the block in which the event was included. null if it is pending.logindex — the integer identifying the index of the event within the block’s list of events. null if pending.removed — the boolean value indicating if the event was removed from the blockchain due to a chain reorganization. True if the log was removed. False if it is a valid log.eth_getFilterChanges code examplesweb3.eth.filter methods have been deprecated and replaced with the web3.eth.subscribe in web3.js. See web3.js subscriptions.const ethers = require('ethers');
const NODE_URL = "CHAINSTACK_NODE_URL";
const provider = new ethers.JsonRpcProvider(NODE_URL);
async function getFilterChanges(filter) {
try {
const changes = await provider.send('eth_getFilterChanges', [filter]);
console.log(changes); // Log the with the new data
} catch (err) {
console.error(err); // Handle errors that may occur
}
}
const filterId = '0x4e7ef166cd43f188b0f8f9e218966a8f' //'YOUR_FILTER_iD'
getFilterChanges(filterId)
eth_getFilterChanges method can poll a filter to periodically retrieve new data. You can, for example, create a blocks filter using eth_newBlockFilter and periodically poll it to get new blocks.Was this page helpful?