> For the complete documentation index, see [llms.txt](https://docs.guardianservice.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.guardianservice.app/technical-information/library-of-policy-examples/trustchain-reports.md).

# TrustChain reports

For a demo example of following steps, here is the policy timestamp: **1675176247.137536341**

### **Task**

Create a report to check a chain of documents.

### **Preparation**

We will use example 4 to assemble multiple documents to build a realistic-looking *Trustchain*.

Let’s add several additional attributes into the documents to simplify the document search.

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FEVCSLVP9xClNORmZNvsQ%2FTemplate_5_screenshot_01.png?alt=media&amp;token=8b03c5e6-6d3e-4dc3-ab7a-668362c929a2" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F5WFw6cg84ekRcXnhbxRR%2FTemplate_5_screenshot_02.png?alt=media&amp;token=1c16ee1b-4c77-488c-be37-09658f31e5d5" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F6JVXCLwDtqHHdk9zd9ew%2FTemplate_5_screenshot_03.png?alt=media&amp;token=b92a7dbd-2b80-48b6-b208-fef13bc9669e" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F1cvIaAkpqVJdNny8tPtv%2FTemplate_5_screenshot_04.png?alt=media&amp;token=b648f0c0-574a-45fd-be2d-508f2b4b3f1a" alt=""><figcaption></figcaption></figure>

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FIV4XA9ziGsXeISfGGYqf%2FTemplate_5_screenshot_05.png?alt=media&amp;token=9df5df35-dec4-445b-bbb7-8a8b8cc8dcd7" alt=""><figcaption></figcaption></figure>

### **Building the trustchain report:**

1. Using the ‘***reportBlock***’

1.1 Add new container

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FvErZtFGAZ89xhbRIX9S3%2FTemplate_5_screenshot_06.png?alt=media&amp;token=235b6e03-7605-493c-8c85-c3194691400e" alt=""><figcaption></figcaption></figure>

1.2 Add ‘***reportBlock***’

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FM64djK9teoeLMtZnon0T%2FTemplate_5_screenshot_07.png?alt=media&amp;token=ca98bc9f-92f9-4243-bbee-9c1c91b5484b" alt=""><figcaption></figcaption></figure>

In Guardian policy ‘**reportBlock**’ finds VP documents based on their *id* or *hash* and displays document information, related policy and token information. To retrieve the linked information ‘**reportItemBlock**’ must be used.

1.3 We will build the following chain in this example: \*\*mint \*\****VP – MRV Report – Project (approved and signed the the Approver) – Approver document – Project (created and signed by the user) – User document.***

We will need 6 ‘**reportItemBlock**’ items correspondingly, 1 per each document.

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FDLnZrjzVukXqaCt1pXOq%2FTemplate_5_screenshot_08.png?alt=media&amp;token=277d6093-38b3-4e78-afc8-9d04275cb614" alt=""><figcaption></figcaption></figure>

The ‘**reportItemBlock**’ items are executed sequentially, thus in the filter for each consecutive ‘**reportItemBlock**’ we can use values from the previous blocks/documents.

1.3.1 ‘**mint\_document**’. To find this document which described the token mint operation we will use one of the **Common Variables** - *actionId*

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FGQjUEF1tzJUDQYofZYXT%2FTemplate_5_screenshot_09.png?alt=media&amp;token=20a2e5dc-0638-43c7-a59a-0411761dbd65" alt=""><figcaption></figcaption></figure>

1.3.2 ’**report\_document***’*. To find the MRV report (i.e. data document which was the basis of the decision to mint tokens) we will also use one of the **Common Variables** – *documentId*

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FUkJVHSEwF4Q0vutoTOvZ%2FTemplate_5_screenshot_10.png?alt=media&amp;token=5144be65-3d15-4816-94e7-c0861fd7fc6d" alt=""><figcaption></figcaption></figure>

To find further documents we will need to use values from the **Ref** variable which point to the previous document. Let’s save in a new variable:

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FPpOEsyhzBTUMKPj2N7v8%2FTemplate_5_screenshot_11.png?alt=media&amp;token=aff120ad-22c7-4616-9d6f-43c364bc3e1e" alt=""><figcaption></figcaption></figure>

1.3.3 ’**project\_document(approver)***’* - Lets use the previously defined variable alongside the static filtration parameters.

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FnDMYeeIpHyxjXjFL3sAU%2FTemplate_5_screenshot_12.png?alt=media&amp;token=d85cf55b-2015-4359-a2e2-a7e8d2d9c093" alt=""><figcaption></figcaption></figure>

Save the author of the document signature so we can display the information about the user later

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FudIEdZsa3O2uhU2wlrX6%2FTemplate_5_screenshot_13.png?alt=media&amp;token=7ce29067-236f-4035-9a91-f55dfcde8adc" alt=""><figcaption></figcaption></figure>

**Use the same approach to continue the chain until the end.**

1.3.4 ***’*****approver\_document*****’***

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FxGUOCiKU9UKC67OiIUfX%2FTemplate_5_screenshot_14.png?alt=media&amp;token=cc0ea8f1-fa07-40ff-9926-0a1cca75b94e" alt=""><figcaption></figcaption></figure>

1.3.5 ’**project\_document(user)***’*

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F4Pjv6bvNTEXj1sfEYiMt%2FTemplate_5_screenshot_15.png?alt=media&amp;token=3d9370df-2d74-4680-81d5-6d77e4bd2835" alt=""><figcaption></figcaption></figure>

1.3.6 ’**user\_document***’*

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2F9lMjCX4ccc4zpHDTS7wZ%2FTemplate_5_screenshot_16.png?alt=media&amp;token=0475d6e1-e6af-46c9-ac50-7caf6500a059" alt=""><figcaption></figcaption></figure>

2. To activate the ‘**reportBlock**’ an id or a hash of the VP document is needed, we will add the grid containing the list of the VP documents and links to the trustchain.

2.1 Add ‘**interfaceContainerBlock**’, ‘**interfaceDocumentsSourceBlock**’ and ‘**documentsSourceAddon**’

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2Fl5YsHMEGFO8TajyEmxyR%2FTemplate_5_screenshot_17.png?alt=media&amp;token=9f7fbc5d-8a2a-4608-9b47-2c7496dc45b1" alt=""><figcaption></figcaption></figure>

2.2 Add new column with the type **BUTTON**

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FFcWcNaBtuihU8wJBFQqy%2FTemplate_5_screenshot_18.png?alt=media&amp;token=6c4bde41-87dd-475c-97cf-7f788e9c1596" alt=""><figcaption></figcaption></figure>

Setting the **Action** to LINK will cause the Policy Engine to attempt to switch the display to the target policy block upon the user clicking the link (if possible).

### **Demo**

#### VPs:

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2Fc60xfqu1Q6Yqkk6YMklJ%2FTemplate_5_demot_01.png?alt=media&amp;token=8953a3e1-5860-46df-aa2a-9e1adfd6f1de" alt=""><figcaption></figcaption></figure>

#### Trustchain:

<figure><img src="https://3006114282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FXVOaWpJKxLZf1Tee9eCO%2Fuploads%2FbEMeI9bCK9wnotGrZmqi%2FTemplate_5_demot_02.png?alt=media&amp;token=0fe27346-9761-44fe-8698-b59bd1286dcf" alt=""><figcaption></figcaption></figure>
