Stack Exchange Network

Stack Exchange network consists of 175 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
2answers
29 views

How do I monitor 50k addresses for incoming ERC20 transactions?

I have a list of 50.000 Ethereum addresses which at any time may receive ERC20 transfers. I know I can create filters but I don't think it scales to send 50.000 RPC calls to an Ethereum node every 20 ...
0
votes
1answer
25 views

Infura Web Sockets doesn't work on Infura

I have a problem with connecting via Websockets to Infura. I am listening on some events from my smart contract, so when some event is dispatched by calling some method from smart contract, I should ...
0
votes
1answer
14 views

Trigger manual DB UPSERTs through smart contract

Can I add a trigger to smart contract to insert/update data to my traditional DB. E.g. Let's say I have students private blockchain where each student has to update their info. Once they insert/update ...
0
votes
0answers
11 views

How do i retrieve the transaction hash to DApp's frontend?

I have a simple DApp that stores data, developed with truffle and deployed on rinkeby, and I want to show the transaction hash in the frontend. I've read a lot about web3.eth.getTransaction() or ...
2
votes
1answer
27 views

How to handle require/revert/assert errors properly

I'm trying to find an easy pattern to revert/rollback a write transaction. The first idea was to log a GenericErrorEvent but then I noticed that it will never be emited if any require/revert/assert ...
0
votes
1answer
32 views

Emit not firing event more than once

I'm experimenting a little bit with the blockchain, I'm currently trying to send from an oracle an address to store on the blockchain through a smart contract. The code (very simple and without checks)...
1
vote
0answers
19 views

How do newHeads and event subscriptions behave on past reorgs?

Based on the geth documentation, I understand that a subscription on both newHeads and logs will emit all new heads and events that come from a reorg. However, I couldn't find what the behaviour is ...
0
votes
1answer
37 views

Solidity events and its's necessity

I don't understand solidity events at all. For example: https://rinkeby.etherscan.io/address/0xc5a79064168c0aa3706c33d70b94a09103e9656b#events Some events show its names, others show methods without ...
0
votes
1answer
17 views

Truffle, getPastEvents synchronously

I try to check that a total of 4 events have been emitted by my contract instance. Next code will fail in the assert.equal line since getPastEvents will process the events in a callback and so the ...
0
votes
0answers
11 views

Event - Filtering a BigInt (or a BigNumber)

I am trying to filter on a BigInt for an event (the number can fit in a uint256). I keep getting an error Error: invalid number value This is what the code looks like.. { filter: {fromID:BigInt(...
0
votes
0answers
23 views

Best way to support restoring of all the keys of a mapping

I have a contract, in which I maintain the keys of a mapping in two different ways: Storing each key in an array Emitting an event for each key I do this in order to be able to restore the keys (and ...
0
votes
0answers
31 views

The sendSignedTransaction function does not activate the on('receipt') event at an appropriate time

console.log(transacting...); web3.eth.sendSignedTransaction('0x' + serializedTx.toString('hex')).on('receipt', receipt => { log(receipt); log(`https://ropsten.etherscan.io/tx/${receipt....
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 ...
1
vote
0answers
14 views

One rpc connection faster than another

I have four synced peer nodes running on two separate machines. Nodes 1-3 have been around since the beginning of the block chain and are all on one machine while Node 4 was just added around block ...
0
votes
0answers
28 views

Private blockchain losing access to older blocks

So, my private blockchain became out of sync and one of the nodes reset to block 0 – it then synced up with the other nodes. The node that went to block 0 is the node that is providing the rpc port ...
0
votes
1answer
24 views

Mapping or indexed event

I want to store data on chain that is not needed within a smart contract but should be retrieved easily and particularly quickly from outside. I know that storing the data within an indexed event is ...
0
votes
1answer
27 views

Event suddenly disapears when i call another function in my contract

So i am doing a factory for an ERC20 token contract, here is my factory code: pragma solidity >= 0.4.0 < 0.6.0; import "./ERC20.sol"; import "./ERC20Interface.sol"; contract Factory { ...
0
votes
1answer
67 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
16 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
1answer
62 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
40 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/...
1
vote
0answers
107 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
23 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
56 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
197 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
59 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
60 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
24 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
29 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
37 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
27 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
89 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
68 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
75 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
92 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
19 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
2answers
61 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
126 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
24 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
57 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
36 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
44 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
23 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
28 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
181 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
63 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
148 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
247 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
144 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 ...