eth_newFilter - Create event filter
Create NeuroWeb event filter. Log subscription.
Neuroweb RPC endpoint: endpoint URLs, plans and pricing.
Creates a filter object, based on filter options, to notify when the state changes (logs) on the Neuroweb network. This method is essential for tracking smart contract events and state changes.
curl -X POST https://api-neuroweb.n.dwellir.com/YOUR_API_KEY \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "eth_newFilter",
"params": [{
"fromBlock": "0x1",
"toBlock": "0x2",
"address": "0x8888f1f195afa192cfee860698584c030f4c9db1",
"topics": [
"0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b"
]
}],
"id": 1
}'Implementation Example
Advanced Usage
Monitor Multiple Contracts
{
"params": [{
"fromBlock": "latest",
"address": [
"0x1234567890abcdef1234567890abcdef12345678",
"0xabcdef1234567890abcdef1234567890abcdef12"
]
}]
}Complex Topic Filtering
{
"params": [{
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", // Transfer event
null, // Any sender
[ // Specific recipients
"0x0000000000000000000000001234567890abcdef1234567890abcdef12345678",
"0x000000000000000000000000abcdef1234567890abcdef1234567890abcdef12"
]
]
}]
}Monitor All Events from Latest Block
{
"params": [{
"fromBlock": "latest",
"toBlock": "latest"
}]
}Workflow Example
// 1. Create filter
const createFilter = await fetch(url, {
method: 'POST',
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_newFilter',
params: [{ fromBlock: 'latest' }],
id: 1
})
});
const { result: filterID } = await createFilter.json();
// 2. Poll for changes
const getChanges = await fetch(url, {
method: 'POST',
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_getFilterChanges',
params: [filterID],
id: 2
})
});
const { result: logs } = await getChanges.json();
// 3. Clean up
const uninstall = await fetch(url, {
method: 'POST',
body: JSON.stringify({
jsonrpc: '2.0',
method: 'eth_uninstallFilter',
params: [filterID],
id: 3
})
});Notes
- Block Range Limits: Free plans typically limited to 5 blocks, paid plans up to 10,000 blocks
- Filter Timeout: Filters expire after ~5 minutes of inactivity - poll regularly with
eth_getFilterChanges - Topics Order: Topics are order-dependent; the first topic is usually the event signature hash
- Filter Management: Always uninstall filters when done to free up resources
- Performance: Create specific filters to reduce the amount of data processed
Need help? Contact our support team or check the Neuroweb documentation.