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
136 views

Why does having multiple functions with events prevent proper execution?

I am relatively new to Ethereum, so I apologize if there is an obvious answer to this question. I am running a private blockchain to test contracts on. I have a very simple one, where there is one ...
3
votes
1answer
335 views

Using new operator and TypeError: Cannot read property 'event' of undefined

Here's the code: I compile these two contracts together and deploy Bar contract. After deploying it I have a contract account address where it has been deployed on the blockchain: ...
3
votes
2answers
3k views

How do you get events from a function in another contract?

I have two contracts : // contract #1 contract eXample { // intizializer function eXample{ ..... } //creating the Event event MyEvent(uint x,uint y,uint z); function doSomething{ ........
3
votes
1answer
136 views

What is the standard for listening to ERC20 events?

Hi I am a bit confused here. The official EIP documentation states that event Transfer(address indexed _from, address indexed _to, uint256 _value) is how the Transfer event should look like. If I ...
3
votes
4answers
380 views

Can anyone explain what is the main purpose of events in solidity and when to use it?

pragma solidity ^0.4.24; contract assignment2{ event ageread(address,int); function getage(address peridentifier) public returns(uint){ human = mystruct("adam",10); //using struct mystruct ...
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
694 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
261 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
424 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
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
444 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
789 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
46 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
1answer
643 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
1answer
368 views

Decrease polling interval for web3.myContract.myEvent()

The following seems to poll my Ethereum node every second: web3.eth.contract(contractAbi).at(contractAddress).allEvents(callback); Is there a way to decrease the polling interval?
3
votes
2answers
443 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
831 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
339 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
304 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
1answer
18 views

Why are etherscan ENS events so old?

When I go to https://etherscan.io/ens, and then go to the "More" menu, and from there the "ENS Events" menus, all of the events listed are more than 320 days old. Is there a way to get recent events ...
3
votes
0answers
250 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
111 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
28 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
0answers
453 views

How to use logx in Solidity?

Aim: To log data from a smart contract. Following function is written in accordance with low level interface to Logs in ethereum. However, due to lack of documentation, and being new in Solidity, I ...
3
votes
0answers
1k views

Error :current provider doesn't support subscriptions : using ganache, web3 1.0.0 [duplicate]

how to solve the error : The current provider doesn't support subscriptions: HttpProvider at Subscription.subscribe while using web3 1.0.0 and ganche
3
votes
1answer
286 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
614 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
769 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
119 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
76 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
26 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
247 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
518 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
2k views

Find topic[0], topic[1], topic[2]

As suggest in What is topics[0] in Event logs? I am trying to find out 'Event hash' but it's not matching the output for below transaction. Input Data Function: transfer(address _to, uint256 _value)...
2
votes
1answer
3k 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
3answers
957 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
1k 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
1k 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
1answer
954 views

What does “_” mean before a variable name?

I'm a beginner, just recently started reading the docs for Solidity. I can't seem to find this anywhere on google. What does the underscore mean when placed with the indexed keyword? Examples: _from ...
2
votes
1answer
1k 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
660 views

Understanding what events are doing in Solidity

CONTEXT OF THE QUESTION: The references at the end of this post gave me the following understanding of events: Whenever a transaction takes place that is meant to alter information in the ...
2
votes
1answer
1k 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
1k 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
238 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
1k views

Is there way to get all of a contract's events as an array instead of each one separately?

I'm using Web3's allEvents() method to get all the events on a specific contract, and it's working great, except each event pops into the callback separately. That turns into a bit of a pain when I ...
2
votes
1answer
408 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
115 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 ...

1 2
3
4 5
11