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
0answers
20 views

How a contract on Ropsten (deployed after fork) emit 3/5 events on the shorter chain while same contract on longer chain emits 5/5 of the events

General info: We have a full-node, which broadcast our txs. We have a EventSource contract which contains 5 events types. The eventSource contract deployed only after Istanbul fork. Our node was ...
0
votes
0answers
28 views

Events using Infura websockets on rinkeby Web3 1.2.1. Returned values aren't valid, did it run Out of Gas?

I am trying to do a simple event listener with NodeJS and Web3 using an Infura endpoint. I have the correct project-id const Web3 = require('web3'); let web3 = new Web3( // Replace YOUR-PROJECT-ID ...
0
votes
1answer
20 views

If for each setter I can get the blockchain state at the moment and make it queryable, will I still need events?

That question came as part of understanding better the role of events in Ethereum. Can the mechanism which index the blockchain state at each setter and makes it queryable for all parties can ...
0
votes
1answer
29 views

Way to create an event?

As soon as a function is called this other function should also be called!! Example: As soon as ether is deposited it should transfer funds into employees wallet. I already have functions deposit() ...
0
votes
0answers
24 views

Error: invalid number/address values

Having trouble with the submitOracleResponse inside the callback below: flightSuretyApp.events.OracleRequest({ fromBlock: 0 }, function (error, event) { if (error) console.log(error); ...
0
votes
0answers
32 views

Problem accessing variables stored in event log

I have succesfully implemented an event in my contract Portfolio: // Define eventlog for myEvent event myEvent(uint indexed eventDate, address indexed sender, myArray[] eventList, uint eventBalance); ...
0
votes
1answer
31 views

Emited Solidity Events not being watched at frontend truffle contract instance

So, I have been reading through A LOT of pages about events in Solidity and how to interact with them on frontend but I am still pretty new to this and it seems like there have been multiple changes, ...
0
votes
0answers
13 views

Listening events

I have a problem I want to solve with watchevent function. I am building a daemon script that submit a transaction when a particular event is emitted. Let's suppose the node that run the script goes ...
0
votes
0answers
26 views

Getting empty events in response of receipt. I am using Infura+web3.js+ropsten

JS code contract.methods .myFunction( "data1", 1568545262, 1568631662, 1568718062, "0xD4496dA2a4b376fC8s4d786EB6B71483436077c4" ) .send({ from: "...
1
vote
1answer
14 views

Event Names not showing up on Etherscan

For some reason Event Names associated with transactions to my contracts aren't being shown in their Event Logs on Etherscan. Worth noting, this event in particular is not indexed. Any thoughts as to ...
0
votes
0answers
29 views

web3 update monitoring

Inside a DAPP, I have been using web3.currentProvider.publicConfigStore.on('update',... to monitoring Metamask activity. But in the new metamask-mobile such method does not exists. There is a ...
0
votes
1answer
70 views

Filters object not working for web3.eth.contract getPastEvents() method

I have referred, Web3 Events, but filters object is not working for me, I've got the same result for events before and after applying filter object. Here's the code: instance.getPastEvents( "...
0
votes
1answer
62 views

How to connect with WebSocket with Web3?

Already referred web3 documentations and other Q-A for web socket connection. Currently using infura as provider.
0
votes
1answer
24 views

Not getting getPastEvents or once function using contract instance

I have followed Web3 documentation to subscribe an evnet, I have created Instance of web3 using infura url as argument. Created contract object using, const contract = web3.eth.contract(abi, ...
0
votes
1answer
42 views

Truffle: 'func.call()' retrieves the return-value of a non-constant function

I've just learned that one can easily obtain the return-value of a non-constant function, by using myContract.func.call() (instead of myContract.func(), which retrieves a response object). Up until ...
0
votes
1answer
38 views

getPastEvents cannot handle multiple requests?

When I send about 100-120 requests in async, it is fine, the event will give me a response. But above 150 or so, I get "Invalid JSON RPC response: "" Web3JS 1.2.1 Geth Info: Version: 1.8.12-stable ...
0
votes
1answer
16 views

Subscribe to events using local geth in light mode?

I've followed this guide to subscribe to events. I succesfully subscribed to the new block headers using Infura provider. But when I try to use local geth node syncing in light mode, it connects, but ...
0
votes
1answer
25 views

Can I use string(or any type) list as an argument of an event?

It`s my event. event Transfer(address sender, address receiver, string[] denoms, uint256[] amounts); And I view an Transfer event with watch() function, It`s the result. { address: "...
0
votes
0answers
16 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
0answers
25 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 ...
0
votes
2answers
44 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
44 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 ...
1
vote
1answer
45 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
1answer
33 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
31 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 ...
1
vote
1answer
27 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
16 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
0answers
24 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
26 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
1answer
53 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(...
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.
0
votes
1answer
68 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
32 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 ...
3
votes
1answer
90 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
140 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
70 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 ...
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
0answers
41 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 { ...
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
1answer
26 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
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
32 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, ...
0
votes
1answer
56 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
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
37 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
47 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
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, ...
0
votes
0answers
110 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
36 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(...