Warm tip: This article is reproduced from serverfault.com, please click

How to read information from ethereum transaction using transactionHash in web3?

发布于 2020-04-10 10:43:29

Say I had updated a variable x as(x=10) inside the smart contract. I stored the transactionHash. Then I again changed the value of x=20 then I'll get a new transaction hash. So is there any way using the transactionHash of the earlier updation(x=10) with which I can see the what value of x it was?

Questioner
Sanket Shevkar
Viewed
0
Mikko Ohtamaa 2020-04-11 17:56:05

There are two ways to get output from the smart contracts

  • You read the state directly using the smart contract ABI and calls

  • The transaction contains Solidity events which you can parse from the transaction logs

For both cases the support has to be written to the smart contract and in this question the smart contract code itself is missing, so it is not possible to tell exactly how to do it.

Generally, nodes do not support reading historical state. They support reading historical event logs though, so if you need to access the data over time series then you need to write your smart contract so that it emits events.