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
1answer
25 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', ...
0
votes
2answers
39 views

Indexed Variables On Event Not Being Decoded

I'm currently returning back all events with no filter and all the indexed variables are being returned but they are encoded. The other none indexed variables are visible and being retrieved fine and ...
1
vote
1answer
61 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
votes
1answer
105 views

How to call Sell event and buy token function with help of web3.py?

I am new to ethereum block-chain. I created a ERC20 token and crow-sale smart contract in solidity. I also deployed these smart contract with the help of web3.py. I created a contract instance. ...
1
vote
1answer
113 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
106 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
2answers
251 views

How to decode data parameter under logs in transaction receipt?

I went through many questions but I couldn't get my answer. web3 version -- 0.20.6 According to documentation event's parameters which are not indexed store in data parameter under logs. I want to ...
0
votes
0answers
33 views

How to read ALL logs of a certain event

When I read event logs like this: myContract.getPastEvents('myEventLogName', { fromBlock: 0, toBlock: 'latest' }) .then(function(events){ console.log(events) // same results as the ...
4
votes
2answers
35 views

Block archived event inside blockchain

I want to write a gambling smart contract, that will be based on time (on block number in the ethereum blockchain). What is the best way to do some work when current network block will archive some ...
0
votes
1answer
77 views

Event handling confusing

Given is: pragma solidity ^0.4.24; contract changeSomVal{ address owner; bool test; event showBool(bool showBool); constructor() public { owner = msg.sender; } ...
1
vote
2answers
25 views

Do events get emitted when calling selfdestruct()?

Are event emitted when a contract calls selfdestruct?
1
vote
2answers
327 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()....
2
votes
1answer
26 views

Can ethereum logs be present while transaction is being mined, then disappear later?

Question about the ethereum blockchain: If I walk the blockchain like so: for block in blockchain: for transaction in block: receipt = getTransactionReceipt(transaction) for log ...
1
vote
0answers
32 views

What is the most preferred way to listen to events

After studying about solidity events, my understanding is that receiving an event doesn’t guarantees that the transaction is final. Transaction may yet to be included into the block. And even if it ...
1
vote
2answers
65 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, ...
2
votes
1answer
123 views

Reliable way of listening to events on frontend

I make a web application, that needs the events from my contract to initialize it's state. I was using infura websocket provider, but it seems to lag a lot and close the connections unexpectedly ...
1
vote
1answer
112 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
3answers
79 views

Reading the result of a function that change state by using events in Solidity

I would like to get the result of a function by listening its emitted event. These are two pieces of code of my contrats CONTRACT 1: function createTradeableContract() public stopInEmergency ...
3
votes
4answers
134 views

Can anyone explain what is the main purpose of events in solidity and when to use it?

pragma solidity ^0.4.24; contract assignment2{ event ageread(address,int); function getage(address peridentifier) public returns(uint){ human = mystruct("adam",10); //using struct mystruct ...
1
vote
1answer
32 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 ...
2
votes
1answer
39 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 ...
1
vote
0answers
64 views

Watch Events with same Name but different params

using web3@0.0.xx is there a way to get Events overloaded (with the same name, but different params) ? I found contract.Transfer[‘address,address,uint256,address,bytes’]({ fromBlock: 0, ...
3
votes
2answers
229 views

Does it make a difference to index an event with one parameter?

Is there any difference between the two? event NewEvent(address addr) event NewEvent(address indexed addr)
0
votes
1answer
247 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 ...
0
votes
1answer
25 views

Complete a transaction outside of Solidity

Example for my e-commerce site: uint public PO; function () { emit Purchase(PO++, msg.sender, msg.value, msg.data); // first param is indexed } The code above is for illustrative purpose only. ...
1
vote
1answer
154 views

How to unsubscribe logs / events?

There are two ways to subscribe/watch to logs/events: Subscribe: var subscription = web3.eth.subscribe('logs', { address: '0x123456..', topics: ['0x12345...'] }, function(error, result){ ...
1
vote
1answer
121 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 ...
0
votes
1answer
75 views

How to set a timer in web3 event watcher? [closed]

I have a web3 event watcher set up in a Javascript file as such: var a; contract.events.allEvents(function(error, event){ if (event.event == "Set") { a = event.returnValues['val']; } });...
4
votes
1answer
58 views

Different outputs on event log subscription

These are the two ways I found to track events on the Ethereum blockchain. One of them doesn't contain the data I need. Why not? Way 1 does NOT contain the data I need Result: subscription = web3wss....
0
votes
0answers
22 views

Can't call contract functions from a separate contract deployed on same local testrpc (two separate Truffle projects)

I have two Truffle projects on my local machine and the contracts in them compile and deploy properly (no errors are raised and in my ganache-cli I get receipts with their addresses). I'm trying to ...
0
votes
0answers
243 views

“Invalid JSON RPC response” using web3.getPastEvent

I am using web3js to query a remote geth node (Geth/v1.8.14-unstable-35fcd2f4/linux-amd64/go1.10.3) for a particular event Ping emitted by a smart contract. myinstance = new web3.eth.Contract(myABI, ...
0
votes
1answer
243 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 ...
0
votes
1answer
81 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; ...
0
votes
1answer
45 views

Are the parameters fromBlock and toBlock of getPastEvents() and events.MyEvent() inclusive or exclusive of the block number?

Using Web3, are the parameters fromBlock and toBlock of getPastEvents() and events.MyEvent() inclusive or exclusive of the block number?
-1
votes
1answer
33 views

Capture Solidity Emit Events without Web3 — E.g., Calling via Postman

Is there some way to capture Solidity Emit Events without the use of Web3? For example, I am calling via Postman JSON RPC eth_sendTransaction. How to capture the returned results?
0
votes
1answer
31 views

Are events only useful for the frontend components?

I'm seeing more and more ways as I learn where functions can be run on the client side. I'm looking at events. Does the Ethereum client (say, Metamask) load all the events from a contract when I open ...
3
votes
2answers
208 views

What is the difference between getPastEvents() vs events.MyEvent({ fromBlock: 0})?

What is the difference between using myContract.getPastEvents() to get past events and using myContract.events.MyEvent({ fromBlock: 0, }) ? Also, if I pass to fromBlock a block number that has not ...
0
votes
1answer
243 views

Proper way of using allEvents()

I'm trying to get all events for a contract: let events = token.allEvents({fromBlock: creationBlock, toBlock: 'latest'}, (err, res) => { try { let result = events.get(); ...
0
votes
1answer
82 views

How to get EVENT name from event signature hash?

I fount that some developers can get event_signature_hash for a event's name MyEvent(uint256) by using bellow code: event_signature_hash = w3.sha3(text='MyEvent(uint256)').hex() But vice versa, I ...
0
votes
1answer
138 views

Contract event - transactionIndex and logIndex

I need to monitor contract events and perform off-chain processing. How do I uniquely identify a contract event? Can I use a combination of these fields? - transactionHash - transactionIndex - ...
0
votes
0answers
45 views

can't read past event logs

const event = contractInst.Transfer({},{fromBlock: 0, toBlock: 'latest'}); events.get(function (error, result) { if (!error) { console.log(result); } }); The get ...
1
vote
0answers
77 views

Parity warp sync doesn't return event logs

Our Dapp uses events as a form of storage. For connection to blockchain we use local Parity node. A couple of days ago I needed to resync it after the server failure. After the resync all methods ...
0
votes
1answer
196 views

How to get only past 2 days events using getPastEvents everytime?

How can the following query be modified to only fetch the past two days worth of events: const events= await MyContract.getPastEvents("eventName", { fromBlock: 0, toBlock: "latest" });
0
votes
1answer
199 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
0answers
187 views

Listen to filtered events using web3js 0.19 (provided by infura)

I am working on a uport dApp. uPort by default uses web3 from rinkeby.infura.io which is web3 version 0.19. So no WebSocket available. I tried ZeroClientProvider but that leads to this error: Error ...
1
vote
0answers
77 views

Filtering blocks on basis of transaction logs in web3j

I want to filter blocks on the basis of a log present inside transactions. How can I do that? I don't have any contract address and want to filter all the blocks generated by all the contracts. ...
3
votes
2answers
677 views

How to Listen to Contract Events in Drizzle

Let's take the example of the SimpleStorage contract that comes with the truffle box drizzle-box How can we listen to the event StorageSet and console.log it to the JS console? drizzleOptions.js ...
2
votes
1answer
192 views

How to filter indexed events and watch callback return value using Web3.py

For example, I have an event where using clusterAddress as key, I want to find the other arguments (storageID, desc, etc.), only having the clusterAddress indexed. I added the indexed keyword for the ...
1
vote
1answer
166 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
0answers
82 views

Why would an Infura/MetaMask watch of a contract's allEvents() that works on Rinkeby fail sporadically on Mainnet

I have some code that immediately sets up an allEvents watch for the contract, then leaves that running and uses it to handle various events generated by the contract. I've been running it on Rinkeby ...