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

Events firing but bool variable not changing in value

Given a contract with an event as follows contract test { event LogEvent( address a, bool result ); function testInputs(some parameters) public (){ .... ...
4
votes
1answer
187 views

web3.py createFilter: filter => SyntaxError: positional argument follows keyword argument

Web3.py version 4.2.1 geth version: 1.8.0-unstable I have followed web3.py guide for filtering. Through the contract instance api: event_filter = mycontract.events.myEvent.createFilter(fromBlock='...
4
votes
4answers
767 views

Web3.js/1.0: How to wait/loop until new event show up like watch()?

On Web3.js/1.0 there is no watch() function for the contracts to retrieve events. I have followed the following guide, web3.eth.Contract - Events - getPastEvents - example, and answer to retrieve ...
1
vote
0answers
49 views

Is there any specification for Decentralized Token Exchange?

Is the way of doing decentralized token exchange (DEX) on Ethereum blockchain specified in some ERC ? Exploring event data in Etherscan I found that there are many types of events: event Order(...
2
votes
1answer
90 views

I'm getting an error when i have more than 3 indexed arg for an event

I want to add all the arguments for my event to be indexed event TokenPurchase( address indexed purchaser, address indexed beneficiary, uint256 indexed value, uint256 indexed amount, ...
0
votes
0answers
119 views

Unable to catch contract event using parity websockets

I have a contract deployed on ropsten which emits event when ether amount is deposited in it. I can see the event appearing in etherscan. this.web3Socket = new Web3(new Web3.providers....
0
votes
0answers
77 views

When exactly do events fire

I have a web3J application that is supposed to deploy a contract (by calling a function on another contract) then listen for the contractCreatedEvent that is fired by the factoryContract and then call ...
0
votes
2answers
336 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
1answer
396 views

Subscribing to event using web3j

I'm trying to subscribe to a smart contract event from my java app using web3j. I deployed my contract to truffle, here it is: pragma solidity ^0.4.24; contract MyContract { string message; ...
1
vote
2answers
225 views

Not able to export to csv all transfer events of a specific contract on Ethplorer.io

I'm able to use the Export to csv function, but it's only giving me the most recent 1000 events. Any suggestions on how to get ALL (2100+) of the events in a csv file? https://ethplorer.io/address/...
0
votes
1answer
62 views

Cannot watch any event on Ropsten

I'm not able to watch and log event sent by smart contract using the Ropsten test network. The same code works on local test network. Contract Event code: event CreateOptionEvent(address indexed ...
1
vote
1answer
76 views

Function 'sendTransaction' - can any error occur before the 'transactionHash' event?

Function web3.eth.sendTransaction can throw an error. For example: Transaction gas is too low Transaction execution error But can it possibly throw an error before emitting the transactionHash ...
1
vote
1answer
74 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
1answer
752 views

Solidity | Web3 | Subscribing events

I'm finding a way to subscribe the specific event in the Smart Contract and there is a web3.eth.subscribe to subscribe an event. [Web3.js 1.0.0] The web3.eth.subscribe function lets you subscribe ...
2
votes
1answer
370 views

Web3 events not working

As per the web3 doc, I'm using following code to watch the events from a contract: contractInstance.eNonIssueDeposits({}, {fromBlock: 0, toBlock: 'latest'}, (error, result) => { if (!error) { ...
2
votes
1answer
96 views

Deploy contract with truffle, how to call in Nethereum?

I am currently deploying my ChangeManager contract in truffle and I want to call the contract later in Nethereum. For this I need the contract address in Nethereum. I figured I could just create an ...
1
vote
1answer
54 views

Are event logs secure?

Should events logged by smart contracts be trusted as a source of truth? Or are there any known ways to exploit them?
1
vote
2answers
739 views

How to see events in Remix - Solidity

I am new to solidity and trying to deploy a contract to see whether the address is EOA or Smart Contract. The code is listed below. I am not able to see the boolean value when I executed the contract ...
0
votes
1answer
143 views

using event in contract vs web3 on 'receipt' event

whats the difference between using events in my contract to execute something if event is emitted or executing the function when the transaction is mined? Is there any case in which event may be ...
0
votes
1answer
207 views

How to use async to get event logs in the for loop?

I want to get event log to do other thing, so I try to use for loop to get the event log in the websjs. I try to use async and await, but order is wrong. Here is my web3js sample code ...
2
votes
2answers
221 views

How do I use filter EVM log events by an indexed field in web3j?

I've looked through the documentation, but there doesn't seem to be this scenario listed. What I want to do is filter the Ethereum event log of a specific contract by an indexed field with Web3j. ...
0
votes
1answer
60 views

Watch contract events without heaving to set up na api key or MetaMask?

I really just need to listen for events coming from the smart contract. Metamask works good on pc but it wont work on mobile and other circumstances. I was thinkng about an open api from infura but ...
0
votes
1answer
75 views

Oraclize random number only works once, then doesn't trigger events and requires a lot of ETH

So I am using the following code contract Damble is usingOraclize{ function Damble() { getRandomNumber(); } function __callback(bytes32 _queryId, string _result, bytes _proof) { if (...
0
votes
0answers
19 views

Using two identical events with different names - does it have any additional cost?

More specifically, here is the dilemma that I'm facing: I have the following event: event MyEvent(address indexed addr, bool indexed state); Sometimes I emit it with false, and sometimes I emit it ...
3
votes
1answer
22 views

web3JS filter.get() result data Structure

Im trying to get all the past event log based on filter criteria using filter.get() and then transform data to show in a table. However, I'm not able to figure out how to retrieve the data from the ...
1
vote
3answers
148 views

Event firing before data is actually set

Let's say this is my smartcontract: event NewUser( address userAddress, uint amount ); function addUser() public payable{ require(msg.value <= maxValue && msg.value > ...
1
vote
1answer
280 views

Events not being received in nodejs, using truffle, ganache and metamask

I'm using web3 1.0, lets say this is my smartcontract: contract Foo { event NewUser( address userAddress, uint amount ); function addUser() public payable{ emit ...
1
vote
1answer
33 views

Verifying that an event did happen

I want my contract to check that a claimed event was indeed logged. Assuming I know how to follow a merkle path from a recent block and find the bit patterns of a log entry, how in solidity do I get ...
2
votes
1answer
435 views

What does “Topics” mean in “Event log”? [duplicate]

When we invoke an event as follows : event MyEvent(uint256 indexed _id, bytes32 _action, bytes32 _player, bytes32 _actionState, address _owner); emit MyEvent(uint256(_public_id), bytes32(_action), ...
0
votes
0answers
36 views

Are Event Logs mandatory and specified in ERC-20 or how to get transactions?

How do I get the transactions on ERC-20 contracts? What kind of information do I get and which is not included in event logs? Can I use same logic for reading logs of all erc-20 contracts or do I need ...
0
votes
0answers
127 views

How to watch erc20 transactions for many accounts and multiple tokens

I need do track customer deposits on a multitude of addresses with various tokens I want do to this with Logs web3.eth.subscribe('logs'.. or web3.eth.getPastLogs - which one is better? how do I ...
0
votes
1answer
99 views

Cann`t deploy contract using pragma solidity 4.21 (after solidity 4.20)

I cant call me a pro at all. Rather newbie than pro, wishing to learn and develop. I`m sincerely asking you to help me. I have the token and crowdsale contract (testing) which I deploy and initialize ...
0
votes
0answers
64 views

Listen for Solidity Event With X Number of Confirmations

I presume Solidity events are fired the moment the block that includes its transaction is mined -- please correct me if I'm wrong. I need to sync the transaction status locally but wish to only save ...
0
votes
1answer
444 views

Truffle-contract: how to subscribe to certain event

I am using truffle-contract for connecting between frontend and smart contract. Currently, I can call method on smart contract. But now I want to subscribe to certain events on smart contract. How can ...
2
votes
1answer
317 views

Is it possible to have a struct within an Event?

I have something like this in solidity: struct Bid { ... } event BidEvent(Bid bid) but when I try to read this event in Javascript, there's no data inside that I can access — no bid variable, ...
2
votes
1answer
153 views

It's possible to listen contract event without knowing contract address?

I have a smart contract with an event where an account address is stored/indexed, and I want to get/advise about this event each time the account address is trigger by the event. By eg, my solidity ...
1
vote
1answer
234 views

Show an event with nodejs

in my Smart Contract I have a function such that it fires an event at the end of its code. function sendTran(arguments) public { *code* emit Event(argument 1,argument 3,argument 3,...
0
votes
1answer
490 views

How to use events to retrieve data from a transaction? PRIVATE CHAIN

i am using GETH for the architecture and deployment of my contract on a private chain and it works pretty fine, but unfortunately i want to return data from a transaction function and this makes me ...
0
votes
2answers
646 views

How to store hash of an Excel file in Blockchain? [closed]

I'm sorry if this question does not seem to be logic. I want to store hash of an Excel file in Blockchain by following function : //byte fileHash; event LogsetFileHash(byte _hashValue); ...
2
votes
1answer
198 views

Healtcheck on Websocket

I've looked through the documentation and haven't found that to be helpful. I would like to know the best way to do a healthcheck on my websocket connection to geth (Yesterday, I found out that I did ...
1
vote
1answer
24 views

How do events influence a transaction's gas?

Since events are stored in the transaction receipts trie they should influence the gas a transaction costs since storage costs, right?
0
votes
3answers
930 views

Infura .watch Error: Invalid JSON RPC response: “” [duplicate]

I’m trying to use the .watch() command on an event in my contract. Whenever I run the .js file, I’m presented with the following: Error: Invalid JSON RPC response: “” I’m not at my computer and can’...
2
votes
1answer
35 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....
0
votes
1answer
104 views

Why Event log is NOT shown in HTML page?

I want to see Event logs in UI. And for this, I use following code in JavaScript : var EnergyEvent = Coursetro.setEnergyEvent({}, {fromBlock: 0, toBlock: 'latest'}); EnergyEvent.watch(...
0
votes
1answer
258 views

Transaction receipt contains all log entries, but only the last two are decoded by web3

I have a flow which yields 4 events. When I obtain the transaction hash via web3.js, I can see that all 4 events are included in the receipt logs, but only the last 2 events are in the decoded logs (...
0
votes
1answer
655 views

How to watch events on smart contract? [duplicate]

All the existing questions explains to catch the event on client end or server. How to catch the event on smart contract itself? Here's what I'm looking for: Contract A emits the event Contract B ...
0
votes
0answers
131 views

web3 event filter got Error: Invalid JSON RPC response: “” [duplicate]

i ran web3js code var Web3 = require('web3'); var fs = require('fs'); web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/xxxx")); let contractAddr = "...
1
vote
1answer
69 views

`emit ThisHappened` vs `ThisHappened` do we need to write `emit`?

From my experience you can declare events with capital letter. eg: ThisHappened(address user, bytes32 act); Then you can call it by just writing: ThisHappened(user, "ATE_HAMBURGER"); But recently I ...
1
vote
2answers
233 views

How to check if an event is confirmed?

When an event is triggered, you get something like this: { "address": "0x0a7a177321f3b3b6e2299e621eb32e892b141b4b", "topics": [ "0x0d332ed5c7d6f1999116748c0eb99c740f276d879d025a5be6435fcf177785de"...
2
votes
1answer
132 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 ...