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
1
vote
1answer
21 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
12 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
25 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
21 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
41 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
32 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
48 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
64 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
23 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
159 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 ...
2
votes
3answers
905 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
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" ...
3
votes
1answer
88 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
108 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
64 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
458 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
155 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
112 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
35 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 ...
0
votes
0answers
40 views

How to filter MyEvent({ },{ }) to retrieve only the latest transaction in the array?

My code: instance.MyEvent({}, {fromBlock: 0, toBlock: 'latest'}).watch(function(error, event) { if (!error) { console.log(event); $('#events').html(event.transactionHash); } else { ...
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 ...
0
votes
1answer
21 views

watch event for each iteration in forloop - Contract Function

I have a contract function in private network with a for loop and emitting event inside the loop. Following is the code : pragma solidity ^0.4.20; contract Eventsloop{ event loopidx(uint idx,uint ...
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
0answers
25 views

web3.eth.getBlock in order

I am a beginner for Javascript & web3(0.20). I am using Metamask for watching allevents, and I need to get timestamp. I use getBlock.timestamp. Due to Javascript, timestamps are not inorder. I ...
0
votes
2answers
26 views

Different events for revert types or one event and then on the client/backend figure the reason why it reverted from emitted data?

Let's say I have 3 conditions which can lead to revert(). which way should I handle it? 3 types of events or one event with extra parameters? 3 events types: if condition A: emit causeA(dataA1, ...
1
vote
1answer
103 views

Solidity triggered event that shows a message to everyone who is currently in the site

Just a small question regarding how solidity event works. Let's say I have a function buyCandy(). At the end of the function I attached event: emit LogBuyCandy(msg.sender); event LogBuyCandy(address ...
1
vote
3answers
102 views

Reading the result of a function that change state by using events in Solidity

I would like to get the result of a function by listening its emitted event. These are two pieces of code of my contrats CONTRACT 1: function createTradeableContract() public stopInEmergency ...
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 ...
1
vote
0answers
32 views

Trying and failing to switch my dapp from local node to infura, please help? [closed]

I have a nodejs 'server' running that listens for events on the blockchain. Currently I have this line in my code: var provider = new Web3.providers.HttpProvider("http://localhost:8545"); But I'm ...
1
vote
1answer
32 views

Infura event listening [duplicate]

I am using Infura, Ropsten Test network, Web3@0.20 in the back-end of my Express website. I want to listen events in my ERC20 contract. I tried a lot of methods, but still failed. How do I revise it? ...
0
votes
1answer
136 views

How to get EVENT name from event signature hash?

I fount that some developers can get event_signature_hash for a event's name MyEvent(uint256) by using bellow code: event_signature_hash = w3.sha3(text='MyEvent(uint256)').hex() But vice versa, I ...
0
votes
1answer
37 views

Why do my events not emit the correct value?

When testing a contract with Truffle, I have found that the variables that are emitted by the event do not match the values that are passed into the event emission. Why does the event not return the ...
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
0answers
12 views

How can I use the parameters of an event as a function input?

how can I use the indexed parameter of a triggered event as a input for a function called in response to that event triggered? This is the event: event LogOfferAccepted( uint _id, ...
1
vote
1answer
180 views

How to stop listening to all events of contract

I am using the JavaScript API in my truffle tests to get the events from the contract: https://github.com/ethereum/wiki/wiki/JavaScript-API#contract-allevents const allEvents = instance....
1
vote
1answer
169 views

Event unique identifier

The web3.js (1.0) docs helpfully list the return values from a contract event subscription. I've noticed that there is an additional return value id that isn't listed there but is returned with the ...
2
votes
1answer
182 views

Reliable way of listening to events on frontend

I make a web application, that needs the events from my contract to initialize it's state. I was using infura websocket provider, but it seems to lag a lot and close the connections unexpectedly ...
5
votes
3answers
4k views

Indexed Event with string not getting logged

I am facing a strange issue in my solidity smart contract using events. I created the event in 2 ways as below:- 1. event Event1(string assetName, address toAdd); 2. event Event1(string indexed ...
0
votes
0answers
75 views

Can I subscribe to events emitted by another contract?

I am trying to subscribe to an event emitted by an existing library's smart contract. I've found examples of how to subscribe to events emitted by my contract using web sockets and my contract ABI as ...
0
votes
1answer
33 views

How to display the value of a variable using remix debugger and emit

pragma solidity ^0.5.1; contract test { event test_value(uint256 indexed value1); uint256 value_test; function test_f() public { //value_test processing emit test_value(...
2
votes
1answer
24 views

Event and method different address type

This is my contract pragma solidity ^'0.5.2'; contract MyContract { address[] public contracts; event ContractCreated(address newAddress); constructor() public { } function ...
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 ...