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
2
votes
1answer
270 views

Can we call two contracts in web3.eth.filter method?

I have two contract address and I want to check events on both in one call. I mean, can we pass two contract address in one option param like i do below? let web3 = new Web3(); web3.setProvider(...
2
votes
1answer
485 views

Implementing Events in Solidity (Remix)

I have a test code on Remix and have been getting ParseError: Expected Primary Expression. The error happens in function Enquiry -- at event definition - line. ParserError: Expected primary ...
2
votes
2answers
238 views

Can we apply modifier to an event in solidity just like function?

Let's say as per business I want to restrict certain users(addresses) from seeing the logs for a contract. I know there is "modifier" which can be set to function, to give access rights but Can we do ...
2
votes
1answer
275 views

convert padded topics address to valid address string

I am parsing some information from the topics array. I receive 32bit padded addresses in some indexes. Is there a web3 utility function or useful helper method to get these back into normal sized ...
1
vote
2answers
621 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 ...
1
vote
1answer
1k views

Contracts will not compile using truffle with the “emit” keyword included in front of events [duplicate]

I notice there has been changes made to solidity and that the word emit is now to be used in front of event triggers (to distinguish from functions being called). However when I include these in ...
1
vote
1answer
39 views

Am I hashing the data in the file itself, or just the reference?

I am attempting to create an app where I upload a file to a website and then I submit a hash of that file onto Ethereum. I am unsure whether I am hashing the actual file below or just the reference to ...
1
vote
1answer
407 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
237 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
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
70 views

Web3js 1.0 events: closing the contract.events “socket”

My code is the following: contract.events.Deposit({}, function (err, event) { if (err) { console.error; } else { console.log(event.blockNumber); } }) .on('data', ...
1
vote
1answer
709 views

What does “_” mean before a variable name?

I'm a beginner, just recently started reading the docs for Solidity. I can't seem to find this anywhere on google. What does the underscore mean when placed with the indexed keyword? Examples: _from ...
1
vote
1answer
222 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
3answers
2k 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
543 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
517 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
38 views

Event Names not showing up on Etherscan

For some reason Event Names associated with transactions to my contracts aren't being shown in their Event Logs on Etherscan. Worth noting, this event in particular is not indexed. Any thoughts as to ...
1
vote
1answer
344 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
75 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
102 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
148 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
40 views

Do events get emitted when calling selfdestruct()?

Are event emitted when a contract calls selfdestruct?
1
vote
1answer
611 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
151 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
2k 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
89 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
1answer
596 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
515 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
1answer
322 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
358 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
744 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
324 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
2k 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
86 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
226 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
368 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
424 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
3k views

Web3.js Filter Events

My Dapp needs to dynamically deploy contracts. As such, I need to store the addresses of these contracts somewhere and opted for the following solution: Log creation event Retrieve contracts based on ...
1
vote
1answer
238 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
418 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
24 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 ...
1
vote
1answer
71 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
191 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
55 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
137 views

How can I send an Anonymous event (In ABI, anonymous==true) in Solidity?

Here's my contract code, now in the ABI I have an anonymous entry and I'm not sure what is that and how can I emit anonymous event. pragma solidity ^0.4.24; contract TestContract { event Start(...
1
vote
1answer
153 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
203 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
158 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
60 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
225 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 3 4 5 6 7 11