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.

134 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
237 views

Web3.js event.get not firing, whereas event.watch gives correct values

I am trying to do a simple test for events. Following is solidity code. Values received from chgEvent.watch are always correct. But in chgEvent.get, results1 is empty. chgEvent.get does not get ...
0
votes
2answers
208 views

Solidity event function not appearing in web3

I have a contract with the following event (using 0.4.24): event UpdateProgress(bool _gameInProgress); I am registering the contract like this: import Web3 from 'web3'; import address from './...
0
votes
1answer
33 views

Subscribing to multiple Transfer events of various ERC20s

I need to suscribe to Transfer events of couple of different ERC20s in order to catch transfers to my contract. And here is the question: to catch all those events I need to create instance of each ...
0
votes
1answer
112 views

About getPastLogs usage

"getPastLogs" can get past event log. I check the web3 documentation: fromBlock - Number|String: The number of the earliest block ("latest" may be given to mean the most recent and "pending" ...
0
votes
1answer
38 views

Problem watching events without invoke functions in the Smart Contract

I have an event which is sent each time when a contract is deployed. It is launched in the constructor. I have a Dapp where I want to watch this event to send a tx each time that a smart contract is ...
0
votes
0answers
31 views

Events show up on mined, disappear after

I have a function that fires an event at the end, I have more than one that works like this to create some kind of lifecycle through events. I get the full event history for every event as excpected,...
0
votes
0answers
39 views

How to read ALL logs of a certain event

When I read event logs like this: myContract.getPastEvents('myEventLogName', { fromBlock: 0, toBlock: 'latest' }) .then(function(events){ console.log(events) // same results as the ...
0
votes
1answer
476 views

Proper way of using allEvents()

I'm trying to get all events for a contract: let events = token.allEvents({fromBlock: creationBlock, toBlock: 'latest'}, (err, res) => { try { let result = events.get(); ...
0
votes
0answers
58 views

can't read past event logs

const event = contractInst.Transfer({},{fromBlock: 0, toBlock: 'latest'}); events.get(function (error, result) { if (!error) { console.log(result); } }); The get ...
0
votes
1answer
322 views

How to get only past 2 days events using getPastEvents everytime?

How can the following query be modified to only fetch the past two days worth of events: const events= await MyContract.getPastEvents("eventName", { fromBlock: 0, toBlock: "latest" });
0
votes
1answer
373 views

How to see event name in etherscan.io transaction event log?

In etherscan.io, I want to be able to see the event name (signature) in the transaction page event log, like here. Currently, I don't see it here. I'll note that the transaction is indeed sent to a ...
0
votes
0answers
214 views

Listen to filtered events using web3js 0.19 (provided by infura)

I am working on a uport dApp. uPort by default uses web3 from rinkeby.infura.io which is web3 version 0.19. So no WebSocket available. I tried ZeroClientProvider but that leads to this error: Error ...
0
votes
0answers
48 views

Events firing but bool variable not changing in value

Given a contract with an event as follows contract test { event LogEvent( address a, bool result ); function testInputs(some parameters) public (){ .... ...
0
votes
0answers
137 views

Unable to catch contract event using parity websockets

I have a contract deployed on ropsten which emits event when ether amount is deposited in it. I can see the event appearing in etherscan. this.web3Socket = new Web3(new Web3.providers....
0
votes
0answers
85 views

When exactly do events fire

I have a web3J application that is supposed to deploy a contract (by calling a function on another contract) then listen for the contractCreatedEvent that is fired by the factoryContract and then call ...
0
votes
2answers
442 views

Do Etherscan stores all the events and transaction history?

To get the history of a transactions for an account, we have to traverse the whole chain everytime, but etherscan provides the entire history of all the accounts instantly. Similarly it does the same ...
0
votes
1answer
887 views

How to use events to retrieve data from a transaction? PRIVATE CHAIN

i am using GETH for the architecture and deployment of my contract on a private chain and it works pretty fine, but unfortunately i want to return data from a transaction function and this makes me ...
0
votes
1answer
273 views

Why myContract.events.MyEvent([options][, callback]) does not return “data” and “logs”?

We have an event as follows : event LogNewObject(address sender, bytes32 indexed id, bytes32 sub_states_types, bytes32 sub_states_values, address owner); This event is called in following function : ...
0
votes
1answer
46 views

A common error at time of using web3 options

When i use some web3 options as follows, I receive a common error i.e. TypeError: web3.[option] is not a function For example : TypeError: web3.toAscii is not a function web3.toAscii(...
0
votes
0answers
594 views

Truffle Test Sell Event Assertion Error

When I test my selling event in truffle.So, the following error comes:- The solidity code is :- event Sell(address _buyer, uint256 _amount); // Buy token function buyTokens(uint256 _numberOfTokens) ...
0
votes
2answers
413 views

How to find the block, when contract was deployed

I have contract address, and I want to find the block number, when it was deployed, to use it for loading events for this contract. Is it possible?
0
votes
0answers
589 views

Listen to emitted event from front-end

Could somebody please provide me code that works to listen to an event from your front-end. It was working for me and there are a few tutorials that I've tried now to fix it but it still persists with ...
0
votes
1answer
287 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':...
0
votes
0answers
130 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 ...
0
votes
0answers
67 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
133 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 ...
0
votes
1answer
151 views

Iterating through events

I have events (fired some time ago by the contract) containing numbers. I need to load them all, and then to draw a chart. What I do: contract.getInitBlock(function(error, value) { var ...
0
votes
1answer
77 views

Can not see Solidity events

I can see events in a private net, but when I connect to "real" net, I can not see them. Meaning .watch(function(err, result) is never called. My theory is I am using lightning, and it probably means ...
0
votes
2answers
518 views

Events with string argument not working (not indexed)

I am trying to listen to an event on rinkeby test which I run locally. Every thing works fine when my argument is int such as event EventTester(int values); When I change the event argument to string ...
0
votes
0answers
128 views

Using events and logs to get function returned value with a simple example

My question is related to this one: Can a contract function both change the state and return a value when it's called externally Question: How to read event/log content? I have a contract like:...
0
votes
1answer
133 views

Watching for events returns 0 blocknumber

I am trying to listen for recently mined events from a live smartcontract(EtherDelta). //https://github.com/praneethmendu/ethualizer/blob/master/backnd.js tradeEvent = contractIns.Trade(...
0
votes
1answer
491 views

Simple event watching with testrpc - unexpected output

Working with this example, I've been attempting to utilise event watching from the web js api. Window 1 (a testrpc instance with filled account): testrpc -a 1 Window 2 geth attach rpc:http://...
0
votes
0answers
573 views

Regarding Event Generation Cost

Lets say events are invoked from all the methods of a contract. Each event is storing some data. The methods where only computation or data fetching logic is applied will it cost ether if any event is ...
-1
votes
1answer
59 views

Capture Solidity Emit Events without Web3 — E.g., Calling via Postman

Is there some way to capture Solidity Emit Events without the use of Web3? For example, I am calling via Postman JSON RPC eth_sendTransaction. How to capture the returned results?