Questions tagged [filters]

filter for the logs fired by contract's events

Filter by
Sorted by
Tagged with
52
votes
2answers
15k views

What does the indexed keyword do?

What does the "indexed" keyword do in the below line of code? I'm guessing it just tells the event object that the following input should be logged? Can we use it other places ie outside of events? ...
16
votes
2answers
2k views

How do I retrieve the Voted events from TheDAO?

This question was asked by @Pablo Yabo in the comment section of the question How can I view The DAO proposals including the current voting status?.
14
votes
1answer
4k views

How can I create a listener for new transaction with Ethereum RPC calls?

I am trying to create mini-service which would allow me to subscribe for incoming Ethereum transactions (coinbase example). I thought that in Ethereum it could be done with eth_newFilter and ...
14
votes
2answers
1k views

Filters: what's “latest” and “pending”?

I want to monitor accounts for incoming transactions (RPC/IPC API) and call a function whenever any one of a number of monitored accounts receives ether which is "confirmed", as in, "sufficiently many ...
10
votes
2answers
1k views

How can I trigger a PHP script when a transaction is received?

My goal is to have a PHP script be invoked whenever a transaction is received by a given address. I know Javascript but this is my first sally into Node.js. I think the right approach is to run a ...
7
votes
1answer
2k views

Why use filters - eth_getLogs vs eth_newFilter

It seems to me eth_getLogs is much simpler than eth_newFilter + eth_getFilterLogs. eth_getLogs has no need for installation, got same parameters, catches events retrospectively. What are use cases ...
7
votes
1answer
196 views

What's the maximum number of filters geth can hold and what happens when this maximum is met?

Obviously, we should be calling uninstall on the filters we create on the node. However, assuming someone didn't uninstall them, how many are stored in memory and would there be a circular buffer to ...
6
votes
1answer
2k views

Understanding web3.eth.filter parameters

I have been looking through that web3.eth.filter function, and ran into a bit of a wall: var options = { fromBlock: "pending", toBlock: "latest", address: "...
5
votes
1answer
813 views

Cannot create filter on Infura via web3.py

I have an Infura account and I have the following code: ... web3 = Web3(HTTPProvider("https://ropsten.infura.io/mytoken") ) web3_pending_filter = web3.eth.filter('pending') ... when line ...
5
votes
3answers
766 views

How can I read log/events that have been triggered in the past?

I have a smart contract with an event. event NewContractCreated(address _callerAddress, address _newContractAddress); I know how to actively listen for new events: var newContractEvent = ...
5
votes
1answer
584 views

How to check if a filter has timed out?

According to the JSON RPC docs, filters timeout when they aren't polled with eth_getFilterChanges for a period of time. eth_getFilterChanges(ID) seems to return the same result {"jsonrpc"=>"2.0", "...
5
votes
1answer
317 views

Filtering logs for entries greater than a specific value

I know that you can filter logs in web3 by topic using: web3.eth.filter({ topics: ["0x00..."] }).watch(console.log) Is it possible to filter for a topic value greater than a given value?
5
votes
1answer
259 views

Cannot catch every event (logs) from contract - catch a couple of random events instead

My contract has a transaction which fires an event. I was able to catch every event when I was sending transactions manually. But now I'm sending 100 transactions in cycle and get only 2..5 events. ...
4
votes
3answers
3k views

filter indexed events from browser using web3.js

I Have a contract defined which logs 2 events : myEvent(string data, uint32 indexed id), myEvent1(string data, uint32 indexed id). I want to filter all the events on the browser using web3 by ...
4
votes
1answer
1k views

How do I filter an event by the hash of the transaction that generated the event?

I read the following in Andreas Olofsson's answer: Events can also be filtered by the hash of the transaction that generated the event Would someone please post an example of how to do this with ...
4
votes
1answer
240 views

web3.py createFilter: filter => SyntaxError: positional argument follows keyword argument

Web3.py version 4.2.1 geth version: 1.8.0-unstable I have followed web3.py guide for filtering. Through the contract instance api: event_filter = mycontract.events.myEvent.createFilter(fromBlock='...
4
votes
1answer
954 views

What is 'the last add pending transaction' in web3 filter?

I run this code using MetaMask to inject web3 object: var filter = web3.eth.filter('pending'); filter.watch(function (error, log) { console.log(log); }); From web3 api docs: When using the "...
4
votes
1answer
998 views

Are events in a contract triggered after that particular transaction is mined?

Let's say I have an event notify() in a function called buy(). event notify(); buy(){ //... notify(); } Problem here is that my the notify watch handle is triggered only after that ...
3
votes
2answers
987 views

Retrieving logs using filter is not working?

web3 has been connected to Infura node, can send signed transactions but web3.eth.filter is not working(405 error)?
3
votes
1answer
3k views

How to watch for 12th confirmation with web3 filters

It doesn't seem possible to update the options in web3.eth.filter() dynamically, so how would one watch for a transaction involving a particular account appearing on the 12th latest block?
3
votes
1answer
347 views

Why cannot catch events retrospectively using filter (eth_newFilter)?

I've put the same filter with eth_newFilter before and after a set of transactions. The one which is installed after transactions catched 0 events. Is it how events work? Is there any other way to ...
3
votes
1answer
584 views

web3.eth.getFilterChanges(web3_filter.filter_id) throws 'filter not found'

I am listening ethereum network through local geth node. I connected to geth through web3.py. I started a job in python code that periodically gets new blocks from filter. Here is the code: def main()...
3
votes
1answer
233 views

Events filtering with OR operator

I want to get all user's transactions from ERC20 compatible tokens. I can get all incoming transactions using this code: const to = token.Transfer({_to: account}, {fromBlock: 0, toBlock: 'latest'}); ...
3
votes
1answer
1k views

How to extract all event logs from the blockchain?

I'm trying to extract all event logs from the blockchain, this is how I called an Event in the smart contract. function rateBook(uint id, uint rating, string comments) onlyMember { if (id > ...
3
votes
1answer
737 views

Filtering events by contract address and sender address

I need to watch events by two parameters: address of token contract and sender address. I found how to watch contract address, but not sure how to watch also by sender address? Shoud I specify address ...
3
votes
1answer
292 views

Best way to watch for contracts created from a given account

I want to watch the blockchain for new contracts created from some given account. I’ve got an Ethereum node with RPC enabled. I think, it should be something like this: Call eth_newBlockFilter() and ...
3
votes
1answer
129 views

Are both the eth_newFilter from/to fields inclusive?

Does anyone know if the fields are inclusive? The documentation doesn't specify, and I would assume that they are probably inclusive fields unless otherwise stated, but it would be nice to confirm ...
3
votes
1answer
342 views

filter for non-contract addresses?

If I set up a filter to receive changes, I only seem to receive transactions for addresses that are contract addresses. How to put a filter to receive transactions that are sent to an address that is ...
3
votes
0answers
564 views

Web3 Event Filtering timeout

This is the code I use to get all events from a certain contract. Solidity: event NewEvent(address indexed contractAddress, address newBOPAddress, address payer, uint commitThreshold, bool ...
3
votes
0answers
1k views

web3 filter option not working

var filter = web3.eth.filter({fromBlock: 350000, toBlock: 'latest',address:"0x075da4ebae466b80d451b0627296d5d38b3e99c1"}); var myResults1 = filter.watch(function (error, log) { console.log(error);...
2
votes
1answer
947 views

Asynchronously querying the block chain

This question is related to this one or this one. There is a tutorial here that shows some filtering examples but it doesn't get into transaction level granularity. Can we query the block chain by ...
2
votes
1answer
80 views

NEthereum, Number of indexes don't match the number of topics

I would like to get all Transfer events for a specific interval of blocks. When I call GetAllChanges with the following parameters, I get this error message: 'Number of indexes don't match the ...
2
votes
1answer
895 views

Should I use Infura with Web3j for Event filter?

I'm using Web3j with Infura for smart contract deployment, calling contract method and transactions. Now I want to use Filter contract event from log. Should I use Infura for this? Is Web3j filter ...
2
votes
2answers
686 views

how to use filter from web3.js properly

I want to get the block number based on the transactionhash from filter,however, when I add the following codes to my project,I found it strange because sometimes it automatically transfer the money ...
2
votes
1answer
164 views

How is a filter ID generated?

If I create a filter with the same parameters twice in a row, I get different filter IDs. Is the ID deterministic? If so, how is it generated?
2
votes
1answer
520 views

What is being watched by filter.watch?

I'm interacting with the blockchain using MetaMask. Here's my JS code: var filter = web3.eth.filter('latest'); filter.watch(callback) function callback(error, result){ console.log(result); }...
2
votes
1answer
237 views

Listing filters in geth. Do they timeout and expire?

Suppose I make a JSON-RPC call to create a new filter as follows (from the documention page): // Request curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"topics":["...
2
votes
1answer
2k views

web3.eth.filter({ fromBlock:1, toBlock: “latest” }).get() not working

web3.eth.filter({ fromBlock:1, toBlock: "latest" }).get() is not working on my geth console. I downgraded my geth from 1.5.9 to 1.3.5 to resolve this but it's still not working. Strange thing is that ...
2
votes
0answers
33 views

Accessing the network through light node

I've been trying, unsuccessfully, to make a web3.py app that needs to catch events, with the use of filters. After hours and hours of testing it appeared the problem was that Infura, which is the ...
2
votes
1answer
81 views

Is it possible Filter events with wildcards based on recorded indexed parameters

Let's say I have a contract that fire an event PersonCreated(uint personId, bytes32 indexed name) every time a person is created. To query for all the past events with name equal to Jason, we can ...
1
vote
1answer
5k views

Using web3.eth.filter

The following link describes some of how the function web3.eth.filter(...) works: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethfilter What I would like to do is get a list of the ...
1
vote
1answer
976 views

Python 3 How to make Event Filter via createFilter web3.py v4.2.1

According to the Web3.py Documentation: http://web3py.readthedocs.io/en/latest/filters.html Quote "event_filter = contract.events.myEvent.createFilter(fromBlock='latest', {'filter': {'arg1':10}})" ...
1
vote
1answer
98 views

Using the same event name in different contracts

Suppose I have two different contracts, and I implement an event in each one of them. If I use the same event name in both contracts, will it make it more difficult (or even impossible) to filter the ...
1
vote
1answer
344 views

Events in failed transactions

Can anybody say for sure, if the events that occur in failed transactions (i.e. before "throw") will not be logged?
1
vote
1answer
415 views

How to watch for a transaction send by Node A from another Node B?

What I am struggling to achieve is the following: Node A sends a transaction. Node B starts watching for this transaction. When Node B sees the transaction in the latest block (ie not as a pending ...
1
vote
1answer
614 views

Managing multiple filters in geth?

In the interactive JavaScript console of geth, I have added some JS snippets(filters) through the loadScript() command and I need to remove/stop executing those filters. Is there any way to do this ...
1
vote
1answer
73 views

How to find all tokens that implements a specific contract

I'm trying to filter all the Tokens that implement a specific contract for a specific public address. I'm using web3 / metamask app. I'm trying to do it on via var options = { .... //address: ".......
1
vote
2answers
821 views

How to get only latest log from my event?

I currently am using Oraclize in my contract and I make a call to a contract function from my front-end and don't want to continue onto the next call until the Oraclize function has returned. So I ...
1
vote
1answer
185 views

How reliable are Ethereum logs?

Do they have a lifespan? Can they be deleted? Have there been any cases of errors with logging or logs not being written? I'd like to know if I can rely on logs and build application logic on top of ...
1
vote
0answers
10 views

Changing from Filter to Subscribe with the current code im using

i'm having difficulties to change this line of code to web3.eth.subscribe anyone know how to write in subcribe for this since i want to change from old ver to new beta ver. const filter2 = web3....