Transaction Timestamps
Kaspa transactions do not contain timestamps. Instead, transactions contain the DAA (Difficulty Adjustment Algorithm) score. The DAA score can be translated into an approximate timestamp by using the RpcClient.getDaaScoreTimestampEstimate
RPC method.
This method accepts a list of DAA scores and returns a list of approximate timestamps corresponding to each DAA score.
Processing Timestamps
Transaction-related events contain a TransactionRecord
interface that includes the unixtimeMsec?
property.
This property is always undefined
if the transaction occurs in real time. There is no need to convert the DAA score to a timestamp if you are processing live transactions; you can simply capture the current system time on the client side.
However, if the transaction is of the discovery
type, the unixtimeMsec
property will contain the approximate timestamp of the transaction.
This behavior is subject to change in the future, so it is recommended to always follow these steps:
- If the transaction is not of the
discovery
type, use the current system time. - If the transaction is of the
discovery
type and theunixtimeMsec
property isundefined
, use theRpcClient.getDaaScoreTimestampEstimate
method to get the approximate timestamp for the transaction.