What is a ledger offset?

Hi team,

I read in the ledger api documentation that there is a ledger offset.
I got some issue understanding it at the beginning.

May I know what exactly is that ledger offset ?




The offset is an ever-growing number assigned by the participant to each transaction as they are received from the ledger. The state of a ledger (i.e. the set of active contracts) as exposed by the Ledger API is valid at a specific offset, which is why the last message you receive when calling the ActiveContractsService is precisely that offset. In this way, the client can keep track of the relevant state without needing to invoke the ActiveContractsService again, by starting to read transactions from the given offset.

Note that the offset is also useful to perform crash recovery, by persisting the relevant state and the offset at which it was valid and resuming from there in case of a crash.


Cheers as usual Stef’