The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [events]

Solidity events and logging problems. Events allow the convenient usage of the EVM logging facilities, which in turn can be used to “call” JavaScript callbacks in the user interface of a dapp, which listen for these events.

Filter by
Sorted by
Tagged with
3
votes
2answers
1k views

How to Listen to Contract Events in Drizzle

Let's take the example of the SimpleStorage contract that comes with the truffle box drizzle-box How can we listen to the event StorageSet and console.log it to the JS console? drizzleOptions.js ...
3
votes
1answer
531 views

Is it possible to have a struct within an Event?

I have something like this in solidity: struct Bid { ... } event BidEvent(Bid bid) but when I try to read this event in Javascript, there's no data inside that I can access — no bid variable, ...
3
votes
1answer
689 views

`web3.py`: AttributeError: 'Contract' object has no attribute 'eventFilter'

Update: For web3 v5.x.x, Event Log Filters is as follows: event_filter= myContract.events.<event_name>.createFilter(fromBlock="latest", argument_filters={'arg1':10}) event_filter....
3
votes
1answer
228 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
434 views

Is it possible to use events to implement server-like functionality?

In the documentation and suggested links and this question, it is mentioned that events are bound to methods and fire when a method is called (via a transaction). There is an example of a contract: ...
3
votes
1answer
757 views

How to read responses from calls to contract methods made using web3.js?

I have built a contract which provides a simple method for storing some data in a property of my contract on the blockchain. I can interface with my contract using web3.js and I have no issue doing ...
3
votes
1answer
39 views

How is The Graph a decentralised solution?

I understand that querying for data on Ethereum is a pain in the neck and that The Graph indexes events so that developers can more easily get their most precious blockchain data. However, I'm not ...
3
votes
2answers
583 views

What is the difference between getPastEvents() vs events.MyEvent({ fromBlock: 0})?

What is the difference between using myContract.getPastEvents() to get past events and using myContract.events.MyEvent({ fromBlock: 0, }) ? Also, if I pass to fromBlock a block number that has not ...
3
votes
1answer
619 views

Watched events not registering as expected

I have created a simple contract with one event. I use web3 via MetaMask to watch for these events, however I can see the transactions on Etherscan but the Javascript callback is not being fired for ...
3
votes
2answers
409 views

Events dont fire when called too quickly

I have a very simple solidity function that just calls an event: function sendMessage(int id, string title, string message){ Message(id, method, parameters); } When I call it using ...
3
votes
1answer
727 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
323 views

Could event watch() traverse from latest block number(tail) to head?

In general, I assume events traverse from smaller to larger block number. Example: contractDeployedBlockNumber = 10000 fromBlock: contractDeployedBlockNumber, toBlock: 'latest' [Q] Could event ...
3
votes
1answer
331 views

How to improve events watching?

Happy new year to everyone. Watching my contract events is quite time consuming (more than 15 sec to find the first event). I'm using this kind of command in my geth console : mEvents = myContract....
3
votes
1answer
1k views

Printing into console: Events TypeError - 'watch' is not a function

Printing into console I need to print out values like these green lines: 1) Tried returning When I call a function that returns a string, the hexa transaction address gets printed instead of the ...
3
votes
1answer
293 views

How to reduce eth.filter.watch delay?

I have a test contract that emits events. I'd like to create a web app that shows a list of all created events + new ones as they arrive. I'm using Meteor app connected to geth 1.4.10 through rpc. The ...
3
votes
0answers
206 views

The sendSignedTransaction function does not activate the on('receipt') event at an appropriate time

console.log(transacting...); web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', receipt => { log(receipt); log(`https://ropsten.etherscan.io/tx/${receipt....
3
votes
2answers
83 views

is it possible to get events from transactions that are in the `txpool`?

Is it possible to see the events that will be emitted in the txpool, or is only the transaction information available? For example, can I search in either the queued or pending transactions and ...
3
votes
1answer
23 views

web3JS filter.get() result data Structure

Im trying to get all the past event log based on filter criteria using filter.get() and then transform data to show in a table. However, I'm not able to figure out how to retrieve the data from the ...
3
votes
1answer
245 views

How to access non-indexed event arguments from Go types.Log?

The Go bindings have a type called Log that has the following fields type Log struct { // Consensus fields: // address of the contract that generated the event Address common.Address `...
3
votes
1answer
3k views

Listening to Events from another smart contract [duplicate]

I want to listen to an event from inside another (deployed) smart contract. I am a complete noob to Ethereum and Solidity. So please excuse me for stupid questions, I might have misunderstood ...
3
votes
0answers
560 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
753 views

ERC20 Transfer Event error or intended?

I'm trying to get an Event "Transfer" for the ERC20 Token with web3 function getTransactionReceipt event Transfer(address indexed _from, address indexed _to, uint256 _value) You can see the term ...
3
votes
0answers
117 views

Contract works fine in Solidity-browser but not against private node

I have been testing a contract using the Solidity Browser, but when I deploy the same contract on my private node, it doesn't seem to work the same as in the Solidity Browser. I have tried manually ...
3
votes
0answers
74 views

Can a solidity event be logged successfully before a throw? [duplicate]

If I have the following code in a solidity contract function: event_logEvent(); throw; Does the event get logged correctly into the blockchain or does the throw also revert all the events?
3
votes
0answers
25 views

No event after a struct push in solidity [duplicate]

I am testing a contract with Truffle, which code is : Contribution[] public contributions; struct Contribution { address participantAddress; string name; uint timestamp; uint amount;...
3
votes
3answers
118 views

How to setup 'topics' for function getPastLogs ()?

Sir, I want to read the past event log by using getPastLogs(),but I got the whole log.I hope I can filter some log. I find I can setup the 'topics' in getPastLogs(),but it always fails. How ...
3
votes
1answer
463 views

Event signature on 'watch' callback

I'm trying to monitor events using web3.js, with the allEvents() method. Is there a way to get a unique identifier for the event that was called? When calling watch, the things you get from the ...
2
votes
3answers
910 views

Event tracking and decoding from ethereumj

I have an event in the contract , and upon the event fires I could able to see by a java listener as below public void onTransactionExecuted(TransactionExecutionSummary summary) { List<LogInfo&...
2
votes
1answer
2k views

Uncaught Error: Returned values aren't valid, did it run Out of Gas?

I'm listening to events of my deployed contract. Whenever a transaction gets completed and event is fired receiving the response causes following error: Uncaught Error: Returned values aren't valid,...
2
votes
1answer
795 views

Web3 events not working

As per the web3 doc, I'm using following code to watch the events from a contract: contractInstance.eNonIssueDeposits({}, {fromBlock: 0, toBlock: 'latest'}, (error, result) => { if (!error) { ...
2
votes
1answer
706 views

What does “Topics” mean in “Event log”? [duplicate]

When we invoke an event as follows : event MyEvent(uint256 indexed _id, bytes32 _action, bytes32 _player, bytes32 _actionState, address _owner); emit MyEvent(uint256(_public_id), bytes32(_action), ...
2
votes
2answers
790 views

How to get events emitted by a transaction with web3.js

I'm writing a user interface in Javascript and I'm using the web3.js library. I have the transaction hash of a confirmed transaction. I would like to get an array of all events emitted by that ...
2
votes
1answer
942 views

Where is storing events log? [duplicate]

I can't understand where are these events log data is stored? I can access to my logs by myContract.allEvents({ fromBlock: 2139049, toBlock: 'latest' }, function(error, event){ ...
2
votes
1answer
829 views

Can somebody please explain the concept of Event Indexing?

Here is what the doc says: Up to three parameters can receive the attribute indexed which will cause the respective arguments to be searched for: It is possible to filter for specific values of ...
2
votes
1answer
1k views

When watching events using web3, does .stopWatching() block the code running?

this is a sample code in web3 document : var myEvent = myContractInstance.MyEvent({some: 'args'}, {fromBlock: 0, toBlock: 'latest'}); myEvent.watch(function(error, result){ ... }); ...
2
votes
1answer
228 views

Can I query event logs for substrings?

Using web.js, I can query the event logs of a contract using the "web3.eth.filter" method. The documentation states that this method accepts an object with a "topics" property, which is says are "An ...
2
votes
1answer
344 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 ...
2
votes
1answer
392 views

Any way to execute a Windows/Linux command from geth?

I am watching an event from a contract in geth, using the callback function, such as: MyEvent.watch(function(err,result),{...}) Once the event is detected, I would like to execute an external ...
2
votes
1answer
74 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
66 views

Is there any point in adding msg.sender to an event?

I am asked to provide the value of msg.sender as part of an event emitted in a function. It is something like: contract MyContract { event MyEvent(address indexed sender, uint256 input, uint256 ...
2
votes
3answers
281 views

Event firing before data is actually set

Let's say this is my smartcontract: event NewUser( address userAddress, uint amount ); function addUser() public payable{ require(msg.value <= maxValue && msg.value > ...
2
votes
1answer
837 views

Remix error : Function declared as view but this potentially modifies state

This code is inside a view function and gives the error : Function declared as view but this potentially modifies state. if ( auction.iS == false){ //check if such auction exists emit ...
2
votes
1answer
888 views

Best way to track block transactions as they happen

I found this repo, which retrieves recent gas prices using web3: https://github.com/ethgasstation/gasstation-express-oracle/blob/master/gasExpress.py I'd like to write a similar script that would ...
2
votes
3answers
932 views

can not receive the event?

My web3 version is web3@1.0.0-beta.26, I am deploying the contract on the localhost:8545. Here is my contract example. pragma solidity ^0.4.18; contract LocalEthereum { address public owner; ...
2
votes
2answers
351 views

The quickest method to receive new blocks

Please excuse my lack of knowledge on some aspects of how Ethereum works. I'm creating a DAPP that uses web3 to communicate with the blockchain. I have the need to receive events from a certain ...
2
votes
1answer
604 views

Calling a smart contract in response to an external event

I am trying to log all access operations on a file storage in Ethereum. The access operations are read, write, update and delete. Every time, a user does any of these operations on the file storage, I ...
2
votes
1answer
96 views

Are events only useful for real-time listening by dapps?

Why would I need to use events when I can access a contract's variables through the automatic accessor functions? Please explain the use of and/or need for events.
2
votes
1answer
258 views

Is there a way to view all events on all blocks for Eris Blockchain?

is there a way to view all events on all blocks for Eris Blockchain? Currently I've managed to just subscribe a particular event Contract contract IdisContractsFTW { uint storedData; string name;...
2
votes
1answer
967 views

Event result documentation

The current documentation does not go into detail about the structure of the result returned by an event. In this thread and this question, there are mentions about the fields of the result returned ...