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.

0
votes
1answer
4 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
0answers
3 views

drizzle not updating events properly - duplicate events

I'm facing a peculiar problem while rendering event values in a component using drizzle. When a new event is created and is updated in the events array of drizzle (drizzleState.contracts.MyContract....
0
votes
0answers
9 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 ...
0
votes
1answer
34 views

why several Draw event logs when there is actually one?

I'm looking into the event logs of makerdao's CDP operation, and I'm confused why there are several event logs for 1 cdp operation, like this tx: https://etherscan.io/tx/...
0
votes
0answers
33 views

using events in private blockchain raises leveldb not found error

i'm getting { [Error: Node error: {"code":-32000,"message":"leveldb: not found"}] when trying to use events on a private eth blockhain. What might be the problem? (I've installed Leveldb with brew) ...
2
votes
0answers
15 views

Accessing the network through light node

I've been trying, unsuccessfully, to make a web3.py app that needs to catch events, with the use of filters. After hours and hours of testing it appeared the problem was that Infura, which is the ...
2
votes
1answer
37 views

Ethereum smart contract update, transactions and events

I have a question about versioning of smart contracts in Ethereum. Lots of articles have been written about how to decouple your logic and data, how to use interfaces when referencing other contracts, ...
0
votes
2answers
29 views

How to get events emitted by a transaction with web3.js

I'm writing a user interface in Javascript and I'm using the web3.js library. I have the transaction hash of a confirmed transaction. I would like to get an array of all events emitted by that ...
0
votes
1answer
27 views

Recover solidity funcion event in web3j

EthFilter filter = new EthFilter(DefaultBlockParameterName.EARLIEST, DefaultBlockParameterName.LATEST, userContract.getContractAddress().substring(2)); I am trying to recover the event response that ...
3
votes
2answers
56 views

Do logs/events last forever?

https://thegraph.com/ seems to rely on the assumption that events will last forever. But this post: https://www.reddit.com/r/ethereum/comments/a2ocy6/full_notes_from_fridays_eth_1x_sync_call/ seems ...
0
votes
1answer
21 views

Who Receives An Event?

I have a smart contract that emits an event, and I've set-up a listener in my client-side app that can register this event. But I'm curious, who receives this event? If say 20 different people from ...
0
votes
0answers
13 views

Get the entries of an event by an event filter in web3.py

here is my Solidity Contract: # Solidity source code contract_source_code = ''' pragma solidity ^0.4.1; contract Identities { event ExistProduction(bool); address private owner; mapping(address =&...
2
votes
0answers
22 views

Truffle test to verify events can be queried by the address of the signing user?

I'm trying to write a test which verifies I can query a given type of events by the user/address which sign them. I would like to apply TDD (relevant to say I haven't made the implementation for this ...
0
votes
1answer
20 views

How to interact with events from a smart contract?

can we get access to watch the event and get logged data from them and use it for processing in a smart contract? Like matching an state variable with the data logged by an event .
1
vote
1answer
44 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 ...
0
votes
1answer
41 views

Web3 event listener not reacting to emitter

I'm writing a program in JS/Node that, amongst other things, subscribes to a smart contract event waiting for it to happen. There's a lot going on on the code, so I've got it separated. The main ...
4
votes
2answers
45 views

My contract is not emitting events

This is my contract: pragma solidity ^0.4.22; contract Test { event Deposit( address indexed from, uint amt ); event Withdrawal( address indexed to, uint amt ); address owner; constructor()...
1
vote
1answer
58 views

Web3j how to get event args when parsing logs?

I'm trying to get an event args in web3j version 4.0.1. I use the simple syntax which is explained in the docs. I'm getting the log object but there is no args property or such thing in it. Here is my ...
0
votes
1answer
16 views

Output order changes after the event triggered

I'm new to solidity so for educational purpose I'm developing EVoting application. I've written a smart contract for candidate registration and also developed UI for getting the registered candidate ...
3
votes
0answers
43 views

is it possible to get events from transactions that are in the `txpool`?

Is it possible to see the events that will be emitted in the txpool, or is only the transaction information available? For example, can I search in either the queued or pending transactions and ...
3
votes
1answer
70 views

solidity-coverage adds extra events which make unit-test fail

It seems that when using the latest solidity-coverage (0.5.11), truffle (5.0.0-next.25) ganache-cli (6.2.4-beta.1) and solc (0.5.0) additional events / logs are emitted during tests which make the ...
0
votes
1answer
22 views

Reading Ledger from etherscan API vs Emitting Events

Consider the following function from a solidity Contract: function createProduct(uint _price, string memory _desc) public payable{ emit UserLedgerUpdated(_desc, -1*int(msg.value)); } I want my ...
0
votes
2answers
42 views

Can we assume that Ethereum Events (aka Logs) are in-sequence

Lets consider a simple Contract that is to track a variable. A client App needs to access this variable's history to show a graph. I can create an Array inside the Contract, and push() the value ...
0
votes
1answer
25 views

How to get the timestamp from the latest event on the etherscan.io apis

How to get the timestamp from the latest event on a contract using the etherscan.io api ? I'm using the getLogs call this way: https://api.etherscan.io/api?module=logs&action=getLogs&...
0
votes
1answer
29 views

Logs and events: How are arguments of “watch” defined?

In order to watch an event we can use: var temp; eventx.watch (function(error, result){ temp = result.args.val.toNumber();}); Question 1: What is the role of: function(error, result){ temp = result....
0
votes
1answer
18 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
1answer
18 views

Truffle Exec Return Events

I have set up a JavaScript file that takes in my contract and executes the various functions and then returns the correct events. The file runs through 'truffle exec'. I am using the following line ...
1
vote
1answer
27 views

Event firing before data is actually set [Testnet]

Today I've faced the behavior similiar to this post. Event firing before data is actually set I'm getting events using infura and then checking for the state. I expect to read updated blockchain ...
3
votes
0answers
113 views

Problem with multiple event listeners, duplicated event triggers

In my app i have multiple listeners (watchers) on different events of same contract. Nothing complicated. let songAddedEvent = instance.SongAdded({}, { fromBlock: 'latest', toBlock: '...
0
votes
1answer
36 views

What is the change in smart contract when the 'chain reorganizations'?

Recently I learned about 'chain reorganization'. What is the change in smart contract when the 'chain reorganizations'? for example, contract Contract{ event LOG_Increase(); uint sum = 0; ...
1
vote
1answer
86 views

Emit event while require statement fails

I would like to be able to log a result of a condition: if(time > 5) { emit Result("time is larger than 5"); } else { emit Result("time is less than 5"); } This will work just fine, but ...
1
vote
2answers
151 views

Truffle Tests Events via JavaScript

I am testing my contract via the chai and truffle-assertions libraries from a JavaScript file and am testing if events return the correct values. I have an event called Message. In my function, the ...
0
votes
1answer
80 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
1answer
52 views

What is the difference between writing emit in an event and not using emit? [duplicate]

For example, event CoinTransfer(address sender, address receiver, uint amount); What is the difference between CoinTransfer(msg.sender, receiver, amount); and emit CoinTransfer(msg.sender, receiver, ...
1
vote
1answer
16 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 ...
1
vote
1answer
149 views

How can we parse and deal with BigNumber (BN) args in Solidity events?

In the past, web3 events published numeric events like so: BigNumber { s: 1, e: 17, c: [ 1000 ] } } Now with web3.js 1.0, big numbers come down as objects like this: <BN: de0b6b3a7640000> ...
2
votes
1answer
28 views

Is there any point in adding msg.sender to an event?

I am asked to provide the value of msg.sender as part of an event emitted in a function. It is something like: contract MyContract { event MyEvent(address indexed sender, uint256 input, uint256 ...
1
vote
1answer
103 views

Truffle test, logs do not include an emitted event

I am calling a contract function which emits an event in a transaction. This transaction should include the event and is typically visible via: const receipt = await contractInstance.someFunction() ...
0
votes
2answers
102 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
14 views

Should I maintain an array of all the valid keys in a given mapping?

I have a contract which maintains a map of valid wallets. In this map, the keys are wallet addresses and the values are wallet parameters: struct WalletParams { bool valid; uint x; uint ...
1
vote
1answer
25 views

How can a user be informed of the reason for a revert if there is no event log available?

I presume a typical case of smart contract use is purchasing tokens from a smart contract using Metamask. If the contract is at all complex (such as a tiered pricing sale with various caps) and a ...
0
votes
1answer
21 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 ...
1
vote
2answers
39 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 ...
4
votes
1answer
115 views

List holders and tokens for an ERC-721 contract

Given a contract, I want to map the holders to their token ids. For example, the contract 0xFBeef911Dc5821886e1dda71586d90eD28174B7d is an ERC-721 contract for KnownOriginDigitalAsset. Etherscan ...
0
votes
1answer
41 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
26 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 ...
1
vote
1answer
32 views

Event to track transactions on the backend

I'm currently developing a betting website built on top of Ethereum and am facing the following doubt. In my contract there is an event at the end of the placeBet function which tracks the summary of ...
2
votes
1answer
772 views

Uncaught Error: Returned values aren't valid, did it run Out of Gas?

I'm listening to events of my deployed contract. Whenever a transaction gets completed and event is fired receiving the response causes following error: Uncaught Error: Returned values aren't valid,...
0
votes
0answers
23 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,...
1
vote
1answer
50 views

Using the same event name in different contracts

Suppose I have two different contracts, and I implement an event in each one of them. If I use the same event name in both contracts, will it make it more difficult (or even impossible) to filter the ...