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
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?.
31
votes
4answers
4k views

How can a DApp detect a fork or chain reorganization using web3.js or additional libraries?

Take an example of a voting DApp. A user clicks on a vote button, then behind the scenes a transaction gets mined on the blockchain, and finally the DApp tells the user their vote has been recorded. ...
16
votes
2answers
4k views

Can a contract listen to events of another contract?

I read that to listen to events you need to use web3.js. Are there other ways of doing it? Can a contract even somehow listen to events of another contract? Thanks!
33
votes
6answers
14k views

How do I parse the transaction receipt log with web3.js?

The event parser in web3 provides a nice parsing functionality for events, and I use it for logging all events to a file, but it's very difficult to use for looking at individual events for a ...
30
votes
1answer
10k views

What are event topics?

I know that indexed arguments index the values for those arguments so that filtering will be faster. But what are topics? And what are they used for? I know that signature of an event is a topic. ...
38
votes
6answers
34k views

How do you get a json file (ABI) from a known contract address?

I want to watch a Solidity contract using the Mist browser. I know how to do that and it needs the address and the json. I have the address, but I don't have the json. I do have the source code. Can ...
26
votes
2answers
3k views

Is it a good practice to log an event every time I throw in Solidity?

In Solidity (0.3.2) I am aware that there is no way to throw specific exceptions. (Everything is an invalid JUMP error.) It seems beneficial to have a way to log specific errors. Does it make sense to ...
47
votes
2answers
28k views

What is an Event?

What is an Event? Are they only used in Solidity? How are events defined? How are events initiated? Is there a standard term for an event's invocation (do you say an event "happened", "was called",...
36
votes
3answers
9k views

Where do contract event logs get stored in the Ethereum architecture?

Background on Events: https://github.com/ethereum/wiki/wiki/Solidity-Features Events allow the convenient usage of the EVM logging facilities. Events are inheritable members of contracts. When they ...
30
votes
5answers
18k views

How to access the event log by knowing the contract address (web3)?

How can I access a log stored in one of the tx of the contract via web3? Code example: event newtest(string indexed name, uint indexed idlevel,string indexed multib, string objmulti, uint objnm); ...
26
votes
5answers
14k views

web3: How do I get past events of myContract.myEvent?

I use the following JS code to get notified of Solidity events and it works well for incoming new events: myContract.myEvent().watch((error, result) => { if (error) console.log('Error in ...
21
votes
1answer
2k views

Are events permanently stored and reliably available to contracts in the future?

I've seen this forum post about using Ethereum as an event store: Events in Solidity, using blockchain as eventstore. However, it doesn't seem conclusive. For instance it says: I confirmed with ...
11
votes
3answers
4k views

Confused by internal transactions

Let's say contract A has function F. If someone uses a regular account to call A::F a transaction is laid down on the blockchain. That transaction is easily found on EtherScan for example. If a ...
21
votes
3answers
12k views

What does the Web3 “BigNumber not a base 16 number Error” mean

Is there a known problem with parsing events containing strings in Truffle/Web3? I'm using truffle with the following simple contract contract Board { string foo; event Shout(); event ...
11
votes
2answers
3k views

Ethereum event log maximum size

I'm thinking of storing some data in logs by emitting events but I cannot easily find the answers to the following questions: What is the total size limit of one event? Can I store lots of string32 ...
9
votes
2answers
3k views

How to implement events in solidity

I have an error whenever I add the event line for EVM logging and to notify anyone listening that this transfer took place. function sendCoin(address receiver, uint amount) returns (bool sufficient) {...
1
vote
1answer
132 views

`emit ThisHappened` vs `ThisHappened` do we need to write `emit`?

From my experience you can declare events with capital letter. eg: ThisHappened(address user, bytes32 act); Then you can call it by just writing: ThisHappened(user, "ATE_HAMBURGER"); But recently I ...
21
votes
3answers
21k views

What's the Solidity statement to print data to the console?

Sometimes it would be really helpful to be able to see string representations of variable values in the Geth console, like of argument values in functions. Can I somehow print them to the Geth console?...
7
votes
1answer
3k views

Current methods to send encrypted messages from contracts

I am trying to understand if there currently exists a method to send a message from a contract to another contract or a private address? What would the Solidity code for this look like? Perhaps events ...
4
votes
3answers
3k views

do I need to use ws provider in order to watch events?

I am using web3 version 1.0 version 26, however I can't receive any events from ganache-cli and testrpc. this.Contract.events.Created({},{ fromBlock: 0, toBlock: 'latest' }, function(error, event){...
2
votes
1answer
966 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 ...
7
votes
1answer
1k views

Event result parameters and arguments in console

I read about using events from this source http://solidity.readthedocs.io/en/latest/contracts.html#events I used a simple multiply contract: contract test1{ uint a; event event_res(string msg,...
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? ...
20
votes
5answers
17k views

How to listen for contract events in JavaScript tests?

I'm trying to trigger events in my solidity contract to output some debug information in my javascript tests. However the events seem to get never caught. That's the relevant contract code: pragma ...
25
votes
1answer
2k views

Is searching data stored in event logs prohibitively slow?

Augur uses event logs to store data that never needs to be accessed on-contract, since it is about 10x cheaper than on-contract storage. However, I've noticed that retrieving event logs (e.g., using ...
8
votes
2answers
3k views

Web3j listening to events

I'm tinkering with web3j and most of the things that I want to do succeed, however I seem to not be able to listen to events. I've extended the ballot.sol contract you get with remix by adding an ...
2
votes
2answers
515 views

How can I program my DApp to tell my user that their action/transaction has been confirmed?

Take an example of a voting DApp. A user clicks on a vote button, then behind the scenes the transaction containing the vote gets mined on the blockchain. The DApp then wants to alert('You have ...
8
votes
1answer
591 views

Will I be able to get past contract events through rpc if I use geth --fast?

Or in other words, will geth --fast download the events logs?
8
votes
2answers
2k views

What is topics[0] in Event logs?

Here's a snapshot from etherscan.io
5
votes
1answer
108 views

Getting event history takes a really long time or doesn't work at all

I'm having trouble getting a history of events. I'm unsure if I am misunderstanding how events work, if I'm coding wrong, or if it has anything to do with the recent Ethereum attacks slowing down the ...
4
votes
2answers
4k views

why does new emit event syntax give compiler error

This example returns syntax errors when the emit keyword is used. emit AuctionEnded(highestBidder, highestBid); This is the doc where the example code is. http://solidity.readthedocs.io/en/develop/...
2
votes
3answers
909 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&...
6
votes
1answer
1k views

How can i setup a web3 webservice that listens for events from my smart contract?

I have a smart contract that broadcasts events to web3 clients, upon each event being broadcast, the listening client makes a tx call to my contract. I would like to set up an 'always on' event ...
2
votes
3answers
280 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
343 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 ...
1
vote
1answer
502 views

Transaction receipt contains all log entries, but only the last two are decoded by web3

I have a flow which yields 4 events. When I obtain the transaction hash via web3.js, I can see that all 4 events are included in the receipt logs, but only the last 2 events are in the decoded logs (...
0
votes
0answers
133 views

Testrpc some times not returning event after transaction execution

I am using testrpc to test my contract While executing some functions in my contract I have observed some inconstancy in responses from testrpc, Same function call give me 3 different results at ...
6
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 ...
6
votes
4answers
2k views

Proving the Existence of Logs to the Blockchain

To preface this: I'm not entirely sure this question makes any sense. Just a thought I had that I wanted to check the feasibility of. I'm pretty sure it is possible to use a Merkle proof to show that ...
5
votes
1answer
1k views

How do geth and parity handle notifying clients of events after reorgs?

If you set up an event listener with Geth (I assume also with Parity) you get notifications when a particular event shows up in the event logs. Sometimes a reorg will happen, and the block where that ...
2
votes
1answer
249 views

How to filter indexed events and watch callback return value using Web3.py

For example, I have an event where using clusterAddress as key, I want to find the other arguments (storageID, desc, etc.), only having the clusterAddress indexed. I added the indexed keyword for the ...
6
votes
2answers
2k views

How can I use “eth_sendTransaction” to invoke a contract and get logs?

I have deployed: contract test { function multiply(uint a) returns(uint d) { return a * 7; } } I can call the contract with "eth_call" : mpsp@ubuntu-slave2:~$ curl http:...
5
votes
3answers
1k views

How to properly catch events using MochaJs

Good day, I'm using mochajs to test my Solidity code using truffle and testrpc. In my contract I got the following event and function: contract store{ event MoneyIn (address _from, uint256 ...
4
votes
2answers
69 views

Do logs/events last forever?

https://thegraph.com/ seems to rely on the assumption that events will last forever. But this post: https://www.reddit.com/r/ethereum/comments/a2ocy6/full_notes_from_fridays_eth_1x_sync_call/ seems ...
2
votes
1answer
791 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
391 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 ...
1
vote
1answer
1k views

Contracts will not compile using truffle with the “emit” keyword included in front of events [duplicate]

I notice there has been changes made to solidity and that the word emit is now to be used in front of event triggers (to distinguish from functions being called). However when I include these in ...
8
votes
2answers
2k views

contract event not firing in web3 node console

It appears my events are not being fired in my node application when I transact the contract in the ethereum wallet gui. I deployed a custom contract via ethereum-wallet I have fired up geth attach ...
3
votes
1answer
756 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 ...
2
votes
1answer
159 views

Indexed arguments can't be retrieved, why?

Indexed arguments will not be stored themselves. You can only search for the values, but it is impossible to retrieve the values themselves. This is a quote from the following docs: http://...