How to get effective time of event using PQS

Is there any way I can write a query to find the effective ledger time at which a particular contract was created using PQS?

1 Like

Hi @huw , transactions have an effective_at field. So do a join via the “offset” field on creates and transactions and get the effective time from the transaction.

Yes but I notice that the effective_at field is nullable on the _transactions table. In testing it has come up as NULL. Moreover the _transactions table’s schema may not be stable. Can you advise on the best approach?

After some more experimentation, it seems there is a timing issue: if I run my test immediately after scribe has started the effective time stamp may be NULL, but after adding some delay before querying I get the expected time stamps. It would be good to get some clarity on how to do this correctly. I guess I need to use some of the offset-related functions?

A couple of suggestions:

  1. _transactions points to a very old version of PQS, it is no longer supported, please upgrade ASAP
  2. use Read API table functions to access data (without underscores) instead of going into internal tables
  3. PQS v0.3.2 exposes the event’s transaction’s effective_at field via Read API now
select contract_id, created_effective_at, archived_effective_at, payload
from creates('PingPong:Pong');

Ok thank you. I will try again with the latest version of PQS