Max timestamp error

I develop application based on transactions timestamp, and it is importand for me to have correct timestamp from node.
I’m trying to find out what is the maximum error in time for the transaction.
From the docks, I found out that if my local time is more than one minute behind or behind, my node is not valid and other nodes will not account for transactions from it.

But is it possible that I have correct timestamp but node that make harvesting has incorrect time.
So my transaction timestamp in block will not be 20:00:00. It will be 20:00:59 or at 19:59:01.
Is it possible?
Thankful.

No, nodes syncronize their time via a very unique protocoll that only nem has. They is only very little “drift” between them. If your node is synced with the network and you are able to broadcast your tx (which means you calculated the timestamp correctly) then other nodes won’t cause problems. If a node were to drift from the network it wouldn’t be able to harvest.

1 Like

Thank you about your answer.
Do you know what maximum drift?

The network has an internal network time. The network time can be queried from a node via

http://alice2.nem.ninja:7890/time-sync/network-time

The above request returns the network time in milliseconds resolution while the timestamp for entities (transactions / blocks) is in seconds.
When creating a transaction, other nodes will accept the transaction only if the timestamp is less than 10 seconds in the future (future relative to the network tim), else it is rejected. Same for blocks.

1 Like

Thank you very much.
And what about if the timestamp is less than 10 seconds in the past?
Is it possible that I send transaction at 20:00:00. And some harvesting node add it with timestamp 19:59:01?

Not sure i understand the question. The harvester cannot change the transaction timestamp. If the harvester has a faulty network time (like in your example, which shouldn’t happen), he will reject the transaction and not include it in the block.

1 Like

For example my node took transaction with timestamp 18:00:00(correct time).
Then my node notify other nodes about this transaction. Harvesting node got this transaction at 18:00:30 and look that it’s timestamp (18:00:00). How harvesting node verify it’s validation?

That is perfectly valid as long as the deadline of the transaction is not exceeded. The timestamp of a transaction can be in the past, no problem.

1 Like

Thank you. I have last question.
But if node which took transaction for example at (18:00:30) has incorrect time. And send notification about received transaction with incorrect time to other node.
Other nodes will be reject notification from it. Is my understanding correct?

Say transaction timestamp is 18:00:00, node A has (incorrect) network time 18:00:30. Node A will accept the transaction and forward to another node B. If node B has correct network time 17:59:30, then node B will reject the transaction.

1 Like

Thanks.
So I have guaranty that transaction has valid timestamp.
Even if malicious node has correct network time, and change only transactions timestamp(from received at 20:00:00 but change at 19:30:00). Other nodes will not accept transaction from it.

If a node changes the timestamp of a transaction, the transaction signature is corrupt and all good nodes will reject the transaction.

Cool.
The signature is on the client side. but if client local time is not correct he sign transaction with his private key and send to the node. How node will be handle this transaction with incorrect timestamp?

If the client supplies a transaction with invalid timestamp (too far in future), then the nodes will reject the transaction.

1 Like

But if it will be far in past all will be ok?
If yes I have to handle correct client time in my application by myself.
Thank you very much.

As long as the deadline for the transaction is not exceeded, the transaction is ok.

1 Like