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
0
votes
0answers
10 views

How to filter by string parameter , web3 2.0.0-alpha.1 Solidity events?

I'm trying to filter some events , and I noticed since I updated the web3 to version 2.0.0-alpha 1 the event catch is a little bit different. I have a Smart Contract with this event : event ...
0
votes
1answer
29 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
0answers
19 views

No Events After Deploying Another Contract in Remix

I am trying to write an upgradable smart contract in Remix. This involves a Proxy contract, a Logic_0_1_0 contract, and a Logic_0_2_0 contract. I uploaded Proxy and Logic_0_1_0 only, and the ...
1
vote
1answer
110 views

How to handle events using drizzle?

strange that after much searching, i havent found even one piece of info out there which clearly elaborates on how the events are manipulated in drizzle. From what i understand, the event names (and ...
8
votes
1answer
563 views

Filtering on events of the entire blockchain not possible in testrpc via truffle

A contract I wrote has an event in its constructor. Since I want to find it back in the logs it doesn't seem possible to start listening to the latest block. Because the event is already 'fired' ...
1
vote
1answer
19 views

Accessing the Ethereum State Variables using web3js (Java Script)

I'm trying to run the below code to get the state variables using the getIdBytes method of the Smart Contract, and assign it to a java script array variable, but it doesn't seem to work. All I can ...
0
votes
2answers
37 views

Why is storing via sstore more expensive than via events mechanism?

I just do not understand why emit Event(...) is cheaper than a = b. The only difference I noted between events and storage variables is that event logs is not accessible from Solidity. But both of ...
0
votes
1answer
36 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 ...
3
votes
3answers
100 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 ...
0
votes
1answer
15 views

Solidity event not showing up from Web3.js

I'm trying to set up an event in Solidity and listen to it from Web3 but I keep getting a null response. Here's my code: The relevant part of the contract: event NewUser(string userid); function ...
4
votes
1answer
6k 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 =...
1
vote
1answer
22 views

Events in hub/factory contract

I have written a contract with the hub/factory pattern in which I need to capture the address of the contract that is being created, for this I am using events. Contract A Function A1 -- Call ...
0
votes
1answer
29 views

How can I send an Anonymous event (In ABI, anonymous==true) in Solidity?

Here's my contract code, now in the ABI I have an anonymous entry and I'm not sure what is that and how can I emit anonymous event. pragma solidity ^0.4.24; contract TestContract { event Start(...
14
votes
3answers
3k 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
1answer
22 views

How to get timestamp of an event log in emitted event from smart contract

I want to get the timestamp of an event. How can I get time of event fired, if the event data does not contain any time value?
0
votes
2answers
508 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
1answer
25 views

Solidity Events

I'm using Solidity events to interact with my html page, once a change is done in the contract or page the watch function from html reflects back to the contract. My question here is, while checking ...
0
votes
0answers
27 views

Cannot access myContract.events in web3.js version 0.20.7 [duplicate]

It seems that I do not have access to certain tools in web3js that allow me to subscribe to events. When I tried to use contractInstance.once('allEvents', callback) after instantiating a contract, I ...
0
votes
1answer
26 views

getting the latest holders address:balance for a smart contract

I managed to get all the transfer events from any given smart contract, but now I need to reduce that to current holder any idea how I would do this? Here is my code so far: import ERC20ABI from './...
0
votes
2answers
22 views

Can events always be called directly by user accounts? Is there a way to make them internal?

I am using events to fire an order, basically using them as a vehicle for a master/slave connection with an IoT device, through the blockchain. Ideally i want to always verify the right msg.sender is ...
0
votes
1answer
173 views

Call `getPastEvents` with Drizzle raise error: “getPastEvents is not a function”

Calling getPastEvents with Drizzle will cause the exception: TypeError: this.drizzle.contracts.Contract.getPastEvents is not a function How to get all the past events in an array (in-one-shot) ...
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(...
1
vote
1answer
20 views

Can you emit events in a contract constructor?

I have a constructor that is emitting an event, but cannot seem to see/catch/filter that event after deployment.
1
vote
0answers
11 views

How I can get parity logs for non-mainchain blocks?

There's no much info on how parity event log works. What happens to event logs that correspond to block which is not mainchain anymore? Are they unrecoverably lost? For such an occasion, is there any ...
0
votes
1answer
25 views

Web3 event listener - timing issue when immediately retrieving contract values

I'd like to be able to immediately get a struct value from a mapping after calling a function that updates the struct, however, when testing with Ganache, sometimes the event arrives to the listener ...
0
votes
1answer
24 views

Deposit event is not call while contract get token

My contract pragma solidity ^0.5.0; contract Transfereventaction { event Deposit( address indexed _from, bytes32 indexed _id, uint _value ); function deposit(...
0
votes
0answers
19 views

Web3.js doesn't fire event callbacks anymore

I have a small dapp that uses web3.js to interact with a contract. I have one event listener: let activateEvent = nexusContract.events.Activate({ _member: defaultAccount }) activateEvent.watch((...
0
votes
1answer
34 views

In node.js event is not fired

I am using web socket to get event. sending transaction works fine. but event is not fired. also I referred Web3 events not working but it does not work, too. I used eventemitter also. but it did ...
1
vote
1answer
37 views

Filter topic across multiple contracts

Is there something I could add to my contract which allows my application to filter for all the deployed contracts which also included this topic/identifier? The only other option to manage this I ...
0
votes
1answer
27 views

Viewing transaction events by using web3 on geth console

According to https://web3py.readthedocs.io/en/stable/contracts.html#web3.contract.ContractEvents.myEvent web3 allows to extract the pertinent logs from a transaction receipt: tx_hash = contract....
2
votes
1answer
39 views

Unable to print event without JSONstringify

I am trying to understand the difference among following cases while printing the event: At web3.js listenToEvent: function(){ Contract.deployed().then(function(instance){ instance....
8
votes
2answers
2k views

What is topics[0] in Event logs?

Here's a snapshot from etherscan.io
0
votes
1answer
23 views

Is it possible to create a trigger when a state variable contract is i.e. 10?

Let's supose this is my contract: Contract MyContract{ uint a = 0; function myFunction(){ a = 0; } } I want "myFunction" to fire up when "a" value is 10. Thanks.
1
vote
1answer
47 views

Why raise a Created event in a Smart Contract constructor?

Reading through the Bancor code I see this: function SmartToken(string _name, string _symbol, uint8 _decimals) public ERC20Token(_name, _symbol, _decimals) { NewSmartToken(address(this)); ...
0
votes
1answer
60 views

Failed to load events from Block 0 on page refresh in Vue app

I'm trying to get event data from the web3 API using events method. In my Vue app methods, I have a method, newDsoValue, that will watch for the events from the beginning and also for every newly ...
0
votes
1answer
20 views

Return an array of structs using events?

I wan’t my function to spit out an array of structs. I know this is not straightforwardly possible. What is the best way for me to proceed? Should I loop through my array in my function and trigger ...
1
vote
1answer
151 views

Getting all past events in web3JS

I have seen similar questions here, but the answers didn't help so far. I have a JS function in a React component that should parse all the past events of the contract. The function is invoked in ...
29
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); ...
2
votes
3answers
900 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&...
1
vote
1answer
68 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 ...
0
votes
1answer
98 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" ...
3
votes
1answer
84 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 ...
0
votes
3answers
84 views

ParserError: Expected ',' but got identifier

pragma solidity >=0.4.0 <0.7.0; contract NewHello{ struct kullanicilar{ string name; string surname; uint age; } event infoChanged( string name, ...
1
vote
1answer
55 views

How to listen for events at a specific contract

I am new to the world of web3 and trying to learn how to listen for events. I've been googling and reading for a while and can't seem to get something working. I'm able to subscribe to ...
3
votes
1answer
453 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
1answer
153 views

Alternatives to listen Events contract with web3.py?

I'm facing some issue/bug on web3.py, I need to listen my event contract, but event logs are always empty. I know the following issue on Ganach-CLI but may be there is other alternative. I already ...
2
votes
1answer
111 views

Is it possible to have indexed bytes32 argument in an event?

I have an event with two indexed arguments orderId and status. Filtering works fine when I filter the event on orderId which is uint. I am not able to filter the events on the second argument (status)...
0
votes
1answer
33 views

How event in ethereum actually works?

I'm currently working with Ethereum and smart contracts. I see that a contract can define events and emit them. Each event defines no target, so I assume it will be broadcast. But I wonder how to ...
1
vote
1answer
33 views

Am I hashing the data in the file itself, or just the reference?

I am attempting to create an app where I upload a file to a website and then I submit a hash of that file onto Ethereum. I am unsure whether I am hashing the actual file below or just the reference to ...
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 ...