Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

3
votes
1answer
487 views

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

Goal: I want to print logs of the smart contract, like I do on web3.js, using web3.py. On web3.js side, following code piece works: var event = myContract.LogJob({}, {fromBlock:0, toBlock:'latest'});...
0
votes
1answer
130 views

Listening to Events

Can we still listen to an event if it has no indexed variables? What I mean is, if we emit some event such as: emit LogTrueOrFalse(bool TrueOrFalse); Are we able to get the value of the boolean ...
0
votes
1answer
218 views

How to prevent callback event occur twice?

Hi this is my web3 code events.watch(function (error,result){ if (error) { console.log('Error:'+JSON.stringify(error)); res.send({'status':0,'message':...
1
vote
1answer
944 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 ...
1
vote
0answers
87 views

(1) Parity: why does syncing fall behind, (2) Why are events missing events because of (1)

Background: I have multiple parity nodes setup on Digital Ocean and AWS and event watchers attached to these nodes. I also have a service to query block numbers and compare versus etherscan's current ...
2
votes
1answer
176 views

convert padded topics address to valid address string

I am parsing some information from the topics array. I receive 32bit padded addresses in some indexes. Is there a web3 utility function or useful helper method to get these back into normal sized ...
0
votes
2answers
573 views

Watch multiple contracts/events?

Is there a way to watch events from multiple contracts with just one watch-statement (something like [contract1.event, contract2.event, ...].watchAll() ) in Javascript? Code is just for illustration ...
0
votes
1answer
42 views

Can someone explain what this line does?

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner) What is the purpose of this line? https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/...
0
votes
0answers
160 views

How can I test listening to events with web3?

I'm using Web3 in an react app I'm working on and I need something to happen after an event is emitted from a contract. How/where can I deploy the contract so that I can test watching a certain event? ...
1
vote
1answer
397 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 ...
0
votes
1answer
267 views

Geth settings for watching Events?

what are the optimal geth settings if you just want to listen to some events that are fired by smart contracts? I'm having a bit trouble to setup geth properly. Thanks a lot. PS: That is my ...
3
votes
1answer
83 views

Are event logs still accessible after selfdestruct?

Are event logs still retrievable for a contract after selfdestruct? Does fast sync or full sync in geth have any effect on this? Basically, it looks like it would be useful to Ethereum if my ...
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/...
1
vote
2answers
539 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 ...
2
votes
1answer
649 views

Subscribe to events usign geth websocket

I'm trying to subscribe to geth using the websocket api. First step was to start geth: geth --ws --wsport=8456 --wsorigins="*" --fast --cache=512 --rpcport=8455 --rpc --rpcapi="personal,eth,network" ...
1
vote
0answers
530 views

Recommended way to watch events with MetaMask?

I always get in trouble with things like var filter = web3.eth.filter({fromBlock: '5139365', toBlock: 'latest'}); filter.watch(function(_err, _resp){ ... when using MetaMask as provider. What is the ...
0
votes
0answers
51 views

External event from ethereum geth console

I have a smart contract S running on an ethereum private network N1. A function f() of S creates a event E. Now in the geth console for N1 I am able to run a watcher which continuously listens for the ...
2
votes
1answer
573 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 ...
1
vote
1answer
682 views

Web3 Solidity events do not work any more in Chrome?

Ok, it seems like this issue is only present in chrome browser I am working with Version 64.0.3282.140 (Official Build) Built on Ubuntu , running on Ubuntu 16.04 (64-bit) Actually I had some ...
0
votes
1answer
49 views

Dynamically call event with arugments

How do I dynamically call an event with a name? For example, my contract has a few events and based on some conditions I would like to call one of them. I don't want to use a switch or an if ...
0
votes
1answer
141 views

Event cannot trigger when the transaction is done

My contract location is here pragma solidity ^0.4.18; contract Coursetro { string fName; uint age; event Instructor( string name, uint age ); function setInstructor(...
2
votes
1answer
129 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://...
8
votes
2answers
534 views

Why do public and external functions emit strings differently in event logs?

Producing the logs When the same event is logged with the same string argument, the data in the transaction receipt is different, depending on whether the function was external or public. pragma ...
11
votes
2answers
2k views

How to check events in Truffle Tests?

What's the best way to check that events were fired in a Truffle test?
1
vote
2answers
533 views

Get events from Kovan Testnet

I am trying to connect to Kovan testnet from a Node.js server. I have tried to connect in order to retrieve past events. Steps tried so far:- The connection was done via Infura. Tried these steps ...
0
votes
1answer
294 views

How to read past events from the blockchain? [duplicate]

I can read events as they happen with: const eventsWatch = myContract.allEvents(); eventsWatch.watch((err, res) => { if (err) return; console.log("Event:", res.event, res.args); ...
0
votes
2answers
188 views

Testing a function which calls a non-constant function

I have a non-constant function inside a contract: contract InnerContract { event Event(uint256); function func(uint256 val) external returns (uint256) { Event(val); return ...
2
votes
1answer
464 views

Solidity events on react not firing

Simple logic event with firing in function, work perfectly as expected in truffle develop console, but never firing on my Dapp created with create-react-app, it's just seems to not listen/monitor the ...
2
votes
1answer
175 views

Event sender address

In web3JS, when I get past events, I can see the event and the tx hash, I can then do getTransaction on the corresponding tx hash and then see the sender address, but this is wasteful as I have to ...
1
vote
1answer
58 views

event not returning expected data

When I start my app I listen for posts from the latest block. After a post has been made I'm supposed to return author (address), title (string) and an id (uint). But what I get in the author and id ...
3
votes
1answer
4k views

How to listen to events using Web3 v1.0?

I have a problem when listening for events from my contract. Code js : var Web3 = require('web3'); var abi = '...'; var contractAddress = '0x62e7Dd1Af52d5A08D401b1e156cC4CB1d2f89d57'; var eventName =...
2
votes
1answer
738 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 ...
0
votes
0answers
112 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 ...
4
votes
3answers
2k 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
0answers
729 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
0
votes
0answers
56 views

Indexed event parameter only returns 1st character in address

pragma solidity ^0.4.13; contract OwnedI { /** * Event emitted when a new owner has been set. * @param previousOwner The previous owner, who happened to effect the change. * @param ...
0
votes
1answer
111 views

Is it possible to know which Events a given transaction triggered?

I've noticed the GetTransactionReceipt function returns an array of logs that were created as a result of the transaction being processed. However, I wonder if there is a way to get a list of Events ...
0
votes
1answer
493 views

Event not firing

I've seen other similar questions but I can't seem to pinpoint the error In my contract contract Authentication is Killable { event FriendEvent (bytes32 name, bytes32 handle); function login()...
1
vote
1answer
273 views

Does fast sync download all past event logs?

If I do a fast sync when connecting to Ethereum the first time, will all past Events (written into smart contracts) be downloaded along with the block headers?
1
vote
2answers
132 views

How to include the named of the called contract in Event Log

in my code I am using events in order to log some date. I would like to include the name of the contracts I am calling out of my main contract into this event log. Does anyone have an idea how to do ...
2
votes
1answer
39 views

Query events for a topic's max value

My Event outputs an indexed parameter uint id. Can I query the logs for the max value of id, without returning and searching through all log records? I'm guessing not, since indexed values are ...
1
vote
0answers
61 views

Get root data of smart contract

I am deploying a Smart contract with set of fields. Updating some fields using events.Till here is fine. Now here i need to fetch the root data(data while deploying the contract) Please suggest. ...
4
votes
1answer
85 views

Are logs a reliable place to store data long-term?

Are logs a reliable place to store data long-term? From the documentation: "These logs are associated with the address of the contract and will be incorporated into the blockchain and stay there as ...
0
votes
2answers
245 views

Write data or emit Event?

My contract has data that is only for front-ends to read (the contract will never need to reference it again). Is there any reason to write that data to the blockchain, or can Events just be emitted ...
0
votes
1answer
191 views

What happens when a function call fails within my contract method?

I am mostly interested in the following aspects: does the entire stack get unwind? if the entire stack gets unwind does this lead to all the changes made to the state by the contract get reverted? do ...
2
votes
3answers
776 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; ...
0
votes
1answer
117 views

How do I watch Events from multiple contracts

I wrote a script that is able to read events from one contract address and then paste it into a .csv. Now I would like to extend that script listening watching/reading the same event of several ...
5
votes
3answers
2k views

Can't access to contract functions via web3.py

I have already created contract and deployed to ethereum mainnet. Now I wanna read logs. But I can't as calling print(contract_instance.address) and contract_instance.eventFilter('Transfers') show me ...
4
votes
1answer
998 views

How to decode event log info from contract?

I have structure of event in my Solidity code like event test(address investor, uint256 priceinWei). I make a request to etherscan to get all logs from contract on specific addres and get { '...
1
vote
1answer
826 views

Why does calling allEvents work from the Truffle console, but not from my application?

I am trying to retrieve the events associated with the default MetaCoin contract in Truffle. I am able to do this from the Truffle console, but not from within app.js. I am using Truffle 4.0.1 with ...