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
2answers
580 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 ...
1
vote
1answer
28 views

Can't find address in abi encoded data of event

I have an event with the signature Event(address, uint256, string) which my smart contract emit from time to time. I am testing said contract on a ganache test net where when the Ganache picks up ...
1
vote
1answer
50 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
99 views

getPastEvents on localhost is not a function error

Now, I'm working on an Ethereum Blockchain project to transfer the ownership of stored devices by using local web3 provider at the truffle environment. Truffle v5.0.27 (core: 5.0.27) Solidity v0.5....
0
votes
1answer
25 views

Etherscan event retrieval. Topic

Here's the contract events I want to pull from the ropsten network. Here's how I constructed the event request event_request = ("https://api.etherscan.io/api?module=logs&action=getLogs"+ ...
0
votes
1answer
33 views

Creating complex queries from events emitted by a smart contract

I need to create complex queries from events emitted by a smart contract. For example, I need to make a kind of "sql join" between data from different events. I know a simple solution would be to ...
0
votes
0answers
24 views

web3.js function contract.once() not working on Kovan, but working on ganache

I am subscribing to an event (just once, queued after an update) of a contract to reload the data like this on my react frontend: const instance = new web3.eth.Contract(abi, address) instance.once( ...
0
votes
0answers
23 views

Unable to hear emitted events

I'm using Infura as my provider. From what I've read online, it seems that using a websocket with infura instead of http is the first step to being able to hear events however I only get an empty list ...
0
votes
0answers
8 views

Setting up listener using web3py

I'm setting up a proof of work contract. When a solution is found, the contract emits a Transfer event and the number that gets hashed with future solutions changes. I need to set up a listener so ...
2
votes
1answer
64 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)); ...
3
votes
1answer
18 views

Why are etherscan ENS events so old?

When I go to https://etherscan.io/ens, and then go to the "More" menu, and from there the "ENS Events" menus, all of the events listed are more than 320 days old. Is there a way to get recent events ...
1
vote
2answers
632 views

Does Etherscan store 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 ...
1
vote
0answers
34 views

listening for solidity event with Javascript

I am attempting to make a simple guessing game. Game rules: Player 1 initiates the game with a contract address, upper bound, lower bound and answer. Player 2 has 10 guesses to guess the answer or ...
0
votes
1answer
20 views

Event propagation from imported contracts

Im implementing a contract with imported subcontracts of my own. I'm trying to understand if I can receive the events emitted by the imported contracts, but since contracts can be inherit other ones ...
0
votes
1answer
15 views

Web3.JS 1.2.6 reporting PastEvents but not new events

relevant code: token.getPastEvents('Approval', { fromBlock: 0, toBlock: 'latest' }, function (error, events) { console.log("ETHEREUM past events " + JSON.stringify(events)); }); token.events....
5
votes
0answers
787 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: '...
1
vote
1answer
69 views

Watching events with truffle test

Given following solidity code: pragma solidity ^0.5.1; contract Foo { event FooInc(uint256 _a); uint256 a; constructor() public { a = 42; } function inc() public ...
0
votes
0answers
19 views

How to listen and get events in solidity [duplicate]

I'm using a smart contract that create posts , and i want to trigger the creation of a post , i want to listen to an event and pass the result to a node js server This is my event : event ...
0
votes
0answers
46 views

Timeout when try to connect over websocket in web3.py

I am trying to listen for events emitted by a simple Solidity contract. I am not able to connect using ws though I can commit transactions using http. Here's my code for event listening - import ...
0
votes
0answers
17 views

How unique are the event log ids?

I am using log_ids of events to keep track of which events I've processed. Log ids are formed using the word log followed by 8 hexadecimal characters i.e. log_d758eda8 The possible combinations of ...
0
votes
1answer
35 views

How can I extract a wallet address from event data?

I have a contract that returns event data including the sender's address: event Result( address indexed _walletAddress, string _name, uint256 _amount ) And in my Node.js app I try to ...
1
vote
2answers
255 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....
0
votes
1answer
42 views

How do I get all logs for all time for a given contract using web3?

This answer worked when filter.get was not deprecated, but now I am not sure how to do the same thing with subscribe - web3.eth.subscribe hears new events and acts on them after I create the ...
1
vote
1answer
43 views

How does web3 handle new longest chains?

I have a Dapp which subscribes to events using web3. I'm wondering how I can detect that the longest chain has changed or rather how I can make sure the events that I've received are canonical. The ...
0
votes
1answer
39 views

How can I turn this into a human readable output? [closed]

I have this buy function but the output gives me a transaction Nr. or whatever this is async function buy() { var a = document.getElementById("amount").value; var accounts= await web3.eth....
1
vote
1answer
546 views

How to see event name in etherscan.io transaction event log?

In etherscan.io, I want to be able to see the event name (signature) in the transaction page event log, like here. Currently, I don't see it here. I'll note that the transaction is indeed sent to a ...
0
votes
2answers
32 views

Sending data outside the blockchain

Once a transaction is committed to the blockchain is there a way to let an entity outside the blockchain (i.e. An entity that is not a node in the blockchain) know that a particular transaction has ...
0
votes
1answer
39 views

Listen to a solidity event from a smart contract function [duplicate]

I have the following event: event WaitingPlayer2(address indexed player2); Which I call through: function partecipateAsPlayer2(address player2) public{ emit WaitingPlayer2(player2); } Is ...
0
votes
0answers
107 views

Efficient way to save and retrieve hash in blockchain

I am learning Ethereum using Geth. I have a private blockchain and I am saving hashes through a REST API (python web service). I have readed I can save hash values using maps (mapping data type) and ...
0
votes
2answers
32 views

Returning a value from an external function

I have in a contract: function createCourt() external returns (uint256) { uint256 _id = ++nonce; courtOwners[_id] = msg.sender; return _id; } Now, when I try to call ...
0
votes
1answer
203 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 ...
1
vote
0answers
51 views

How does function getPastEvents works? It's too quick

I'm trying to understand how .getPastEvents function works. When given block range to search is {fromBlock:0, toBlock: 'latest'} it finds my events almost instantaneously. Shouldn't filtering all 7M ...
0
votes
0answers
19 views

How to filter ERC721 events?

I got inspired by cryptozombies to start working with ERC721 and give them a try. Now that I have my collectable idea set up, I want to allow people doing exchanges but for erc20s. Notice that this ...
49
votes
3answers
32k views

What is an Event?

What is an Event? Are they only used in Solidity? How are events defined? How are events initiated? Is there a standard term for an event's invocation (do you say an event "happened", "was called",...
0
votes
1answer
25 views

How can I find the result of a function using Events?

Consider the following basic solidity smart contract event BattleResult(string result,uint playerResult, uint enemyResult); mapping(address => uint)playerChoice; function setChoice(...
0
votes
2answers
72 views

Is the range of a FilterQuery inclusive up to ToBlock?

I'm looking to use this function: func (ec *Client) FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) but I'm unsure if the range of the FilterQuery is inclusive or ...
9
votes
1answer
594 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' ...
2
votes
2answers
92 views

assertEventEmitted from new contract construction call

At present there is no way I can see or is documented to be able to easily use something like this with the truffle framework: So using chai and writing a test to deploy a contract with something ...
0
votes
0answers
16 views

0x event extra data fields

I'm looking at events on the exchange contract address: https://etherscan.io/address/0x61935cbdd02287b511119ddb11aeb42f1593b7ef#events with a topic_0 equal to ...
1
vote
1answer
29 views

Garbage in string parameters of events

I have an event defined like this: event Created( address indexed target, string indexed name ); I do emit Created(..., _name); // called function with _name = "comment" which gives ...
21
votes
5answers
18k views

How to listen for contract events in JavaScript tests?

I'm trying to trigger events in my solidity contract to output some debug information in my javascript tests. However the events seem to get never caught. That's the relevant contract code: pragma ...
2
votes
1answer
172 views

Error trying to get events in web3.py via Infura

I was trying to get all events from my smart contract (in Ropsten) via Infura node. The problem is that I know that Infura does no support creating filters, but I don't know how to get events by ...
3
votes
2answers
2k 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
0answers
12 views

How do I get the value from the event to be displayed on the webpage? [duplicate]

I can connect and console.log the event. But can't bring the value to display on the webpage. I don't know what to do. Front-end import React from 'react'; import logo from './logo.svg'; import './...
1
vote
1answer
123 views

What data is in 'calldataload'?

I want to parse event logs that are generated by the contract shown below, which assigns different sections of calldataload to the 4 Topics, and the Data section, of the event logs. Topic 0 receives ...
1
vote
1answer
38 views

List of ALL Ethereum Contract Events, for ex: Transfer, Mint, etc

A very simple question, yet couldn't find a simple answer. Where can I find a list of all event types such as Transfer, Mint, etc? Is this stored anywhere, for ex: online database or historically ...
3
votes
2answers
106 views

dYdX event log signature hash

dYdX has an event called LogDeposit(address indexed accountOwner, uint256 accountNumber, uint256 market, BalanceUpdate update, address from) within their SoloMargin contract. I am trying to get the ...
7
votes
1answer
3k views

Current methods to send encrypted messages from contracts

I am trying to understand if there currently exists a method to send a message from a contract to another contract or a private address? What would the Solidity code for this look like? Perhaps events ...
3
votes
3answers
2k 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 ...
17
votes
3answers
5k views

How to check events in Truffle Tests?

What's the best way to check that events were fired in a Truffle test?

1 2
3
4 5
11