Skip to content
CCPEDIAby Unity Nodes
Discussions/App Development/How can I see all the history of a contract in UI?Forum ↗

How can I see all the history of a contract in UI?

App Development3 posts247 viewsLast activity May 2023
CO
cohen.avrahamOP
May 2023

G-d willing

Hello, assuming I have a simple contract like the following:

template Simple
  with
    owner: Party
    status : Int
  where
    signatory owner

  choice ChangeStatus : ContractId Simple
  controller owner 
    do
      create this with status = status + 1

How can I fetch the data of this contract knowing when the status was equal to 1 or 2 and etc…?
I need this for a system where I need to show the history of a contract in a UI application.

Thanks,

CO
cocreature
May 2023

The JSON API does not provide access to historical data at the moment. Your best option is to build a custom (Java) backend using the Java bindings + codegen that stores the history you’re interested in based on the data it receives on the transaction/transaction tree stream and then expose that through an HTTP API to your frontend.

CO
cohen.avraham
May 2023

G-d willing

I am not sure I understood you completely.
Are you suggesting I use a database where I will store all the history I need - and not use the ledger?
If this is what you mean, how do I take advantage of a ledger that holds all the contract’s history?

← Back to Discussions