4

I have a smart contract where the user inputs temperature readings, I'd like to add a time stamp to relate those reading with a current time of submission. I understand that in Ethereum we only have now to assist with block time but we don't have a time of a transaction, but that's not what I want.

Any ideas on how to do so, is it possible? Or if using a Dapp I'll have to do so via HTML or JS?

1

Like you said, now gives you the block.timstamp. On the Ethereum blockchain, this is the only timestamp built into the protocol.

The transaction you sent gets processed in the block that it is chosen in. Because of this, the "time of transaction" that you are looking for is actually now. The blockchain does not record the time that the transaction is intially created (and subsequently waiting to be included in a block).

If you are trying to store the time that your transaction is created, you will need to do that off-chain.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.