Contract creation time

Hi there,

Recently I run into a problem. One of my colleague streamed the ACS and she also wanted to find the time the contracts were created. The information was not part of the ACS so she invoked GetTransactionByEventIdRequest for each contract to get the timestamp. However this process consumed large amount of the client node resources. Is there better way of doing this? Is it possible to access this information from CreateEvent?

1 Like

Currently, you only get the time in the transaction as you noted. To improve the efficiency you could setup an off-ledger data store that stores a mapping from contract id to the effective time of the transaction that created it. The most efficient way of doing that is probably to subscribe to the flat transaction stream for your party and then for each transaction store the contracts and the effective time of the transaction in a database.

Note however, that after pruning you cannot get the time of contracts that have been created before anymore so you have to keep that data yourself.

Adding another layer will solve the issue however it just adds the system complexity. Another aspect of the problem is that when the Ledger API consumer continuously calling getTransactonbyEventId, the client node resource quickly went up and eventually it started affecting other users that using the same client node. Is there anything we can do on the Ledger API layer to limit each session’s resource consumption?

The Ledger API itself does not provide resource limits right now. This is planned for future versions but I cannot provide a timeline at this point.