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
1answer
339 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,...
1
vote
3answers
226 views

How to get “event logs” similar to “remix”?

I have an event as follows : event LogNewObject(address sender, bytes32 indexed id, bytes32 sub_states_types, bytes32 sub_states_values, address owner); And this event is used in following function :...
1
vote
1answer
402 views

Understanding what events are doing in Solidity

CONTEXT OF THE QUESTION: The references at the end of this post gave me the following understanding of events: Whenever a transaction takes place that is meant to alter information in the ...
1
vote
1answer
1k views

Subscribe to all token transfers for entire blockchain

I am looking how to subscribe to all token transfer events within entire blockchain. I wonder how is this is implemented on etherscan.io https://ropsten.etherscan.io/tokentxns I searched thought ...
1
vote
1answer
186 views

Decoding Contract Log's “Data” field With eth-abi Throws Error: “Padding bytes were not empty: b'0x0000000000'”

I used this guide to create the code below. I suspect the error is somewhat related to the encoding processes I do to the strings, as that is the only place where I deviate from the guide. Here is my ...
1
vote
1answer
453 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
504 views

is there a java library to access or respond to an ethereum contract events?

We are building a java backend that is expected to interact with an ethereum node. So far I have only seen and tried web3.js api but it seems difficult to run it from java code. Is there a way to ...
1
vote
1answer
218 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 ...
1
vote
1answer
55 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 ...
1
vote
1answer
93 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 ...
1
vote
1answer
115 views

Scalability of using getPastLogs

In order to have a list of the instances of the same contracts created, one method used is to emit an event for each instance created. To query the events(or called logs), we can use web3.eth....
1
vote
2answers
33 views

Do events get emitted when calling selfdestruct()?

Are event emitted when a contract calls selfdestruct?
1
vote
1answer
506 views

Listen to solidity events server-side

I have a following contract: pragma solidity ^0.4.17; contract FileDetail { struct File{ string fileName; string fileHash; } File[] private files; event Uploaded( string ...
1
vote
1answer
134 views

NewEventDTO is not a valid Event Type

The solidity code pragma solidity ^0.4.24; event NewEvent(uint32 tag, uint32 idx); My Nethereum code public class NewEventDTO { [Parameter("uint32", "tag", 1, false)] public uint Tag { get; ...
1
vote
1answer
1k 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 ...
1
vote
1answer
83 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
3answers
1k 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 ...
1
vote
1answer
480 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 (...
1
vote
2answers
417 views

When does a ERC-20 token transfer should be considered confirmed?

I'm wondering when you should consider that a transfer of ERC-20 tokens is confirmed. At the beginning I thought that just making sure the transaction calling transfer is confirmed successfully was ...
1
vote
2answers
138 views

Event not found in Contract

I am trying to access an event from my contract to observe in Javascript. I expect to get c.QuantumPilotKeyPurchased but that is undefined var web3 = new Web3(new Web3.providers.HttpProvider("http://...
1
vote
1answer
299 views

Mapping an address to a balance with keeping history of transactions

I have a balance as follows such that after changing its value, I want to keep the history of previous transactions, for example, for the first time, value of Energy_Balance is 5 and for the second ...
1
vote
3answers
302 views

Emit event in view function or

Is it possible to emit event in view function (via event or logi)? Or is it possible to return value to javascript without(before) mining in a transaction function? My aim is to avoid wait due to ...
1
vote
1answer
685 views

Web3 handling of contract events

It seems that there is an issue with handling of contract events and I am not sure if it is at the EVM level or just web3js. I have 2 contracts "SomeCoin" and "SomeConcert". Both contracts emit "...
1
vote
1answer
305 views

Does fast sync download all past event logs?

If I do a fast sync when connecting to Ethereum the first time, will all past Events (written into smart contracts) be downloaded along with the block headers?
1
vote
3answers
1k views

Find topic[0], topic[1], topic[2]

As suggest in What is topics[0] in Event logs? I am trying to find out 'Event hash' but it's not matching the output for below transaction. Input Data Function: transfer(address _to, uint256 _value)...
1
vote
1answer
84 views

How to download array of strings

EOS requires token holders to generate public keys and register them, by using their "register" function in their smart contract. Here's the function (copied from Etherscan): mapping (address => ...
1
vote
1answer
219 views

How to find out how events are implemented in Solidity (event TokenPurchase)?

https://github.com/OpenZeppelin/zeppelin-solidity/blob/master/contracts/crowdsale/Crowdsale.sol I am trying to implement a presale contract, I saw the above link. I am confused by this line - ...
1
vote
1answer
330 views

Events in failed transactions

Can anybody say for sure, if the events that occur in failed transactions (i.e. before "throw") will not be logged?
1
vote
1answer
415 views

nodejs continues to watch an Event, even geth is killed on the background

I am running a script to watch my events as follows: run.js: var fs = require('fs'); Web3 = require("web3"); web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); address="...
1
vote
1answer
1k views

Is there way to get all of a contract's events as an array instead of each one separately?

I'm using Web3's allEvents() method to get all the events on a specific contract, and it's working great, except each event pops into the callback separately. That turns into a bit of a pain when I ...
1
vote
1answer
233 views

One event works the other does not work

I have a simple code with 2 events in 2 different functions. However, one event is generated and the second one not. pragma solidity ^0.4.9; /* Contract accepting ethers during 10 minutes */ ...
1
vote
1answer
414 views

How to watch for a transaction send by Node A from another Node B?

What I am struggling to achieve is the following: Node A sends a transaction. Node B starts watching for this transaction. When Node B sees the transaction in the latest block (ie not as a pending ...
1
vote
1answer
36 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?
1
vote
1answer
21 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
1answer
64 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 ...
1
vote
1answer
159 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 ...
1
vote
1answer
133 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
942 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> ...
1
vote
1answer
48 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 ...
1
vote
1answer
189 views

Getting all ERC721 transactions by an account

My approach here was to listen for Transfer event for a contract (e.g. Cryptokitties) filtered by the indexed from account. var contract = new web3.eth.Contract(kittyABI, kittyContractAddress, {from:...
1
vote
1answer
845 views

Solidity event listener

This web3js event listener is part of a Voting Dapp. The listener listens for a transactions and re-renders the page to show updates. listenForEvents: function() { App.contracts.Election.deployed()....
1
vote
2answers
101 views

Events loading too slow

I have a dapp running on rinkeby at the moment, you can try it now on cryptogol.io, but I am facing a problem when reading events from the Blockchain. For example, yesterday I make the events happens, ...
1
vote
1answer
130 views

Contract calling own function emit event?

Does a contract calling a function defined within itself cause an Event to be emitted? Etherscan is not showing events emitted when a function is called using sendSignedTransaction(), despite the fact ...
1
vote
1answer
245 views

How to read “allevents” using Python web3 (there's capability in web3.js)?

Is there a mechanism to create a listener for all events being emitted from a smart contract for the python web3 library. There is a way to do it in web3.js: myContract.events.allEvents([options][, ...
1
vote
1answer
189 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
39 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 ...
1
vote
1answer
41 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?
1
vote
1answer
124 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
424 views

How to check if an event is confirmed?

When an event is triggered, you get something like this: { "address": "0x0a7a177321f3b3b6e2299e621eb32e892b141b4b", "topics": [ "0x0d332ed5c7d6f1999116748c0eb99c740f276d879d025a5be6435fcf177785de"...
1
vote
1answer
307 views

How filter event based on a value?

I have this solidity event : event ValidateData( address professorAddr, address studentAddr, bytes32 data ); in Javascript I want watch the event only when the ...