Skip to main content

Using Generic Templates for Document Preview

TrustVC provides a set of pre-designed generic templates for common document types. These templates offer a quick and convenient way to render TrustVC documents without having to create custom renderers from scratch. This guide will walk you through the process of using these generic templates for your documents.

Overview of Available Templates​

TrustVC currently offers the following generic templates:

Template NameDescription
Certificate of Origin (CoO)A document certifying the country in which a product was manufactured, grown, or processed.
Electronic Promissory Note (ePN)A digital equivalent of a paper-based promissory note, representing a legally binding agreement to repay a debt.
Electronic Bill of Lading (eBL)A digital record of a shipment, serving as a receipt, contract of carriage, and document of title.
InvoiceA commercial document issued by a seller to a buyer, detailing the products or services provided, their quantities and agreed prices, and the total amount due.
Warehouse ReceiptA document issued by a warehouse operator acknowledging the receipt of goods for storage.
Bill of Exchange (BoE) (Beta)A written, unconditional order directing a drawee to pay a fixed sum to a payee — issued via the Obligation Registry rather than the classic Token Registry.

These templates are hosted at https://generic-templates.tradetrust.io and can be previewed in the TrustVC Gallery, other legacy templates can be previewed in the Generic Templates Storybook.

When to Use Generic Templates​

Generic templates are ideal for:

  • Demonstration purposes - When you want to quickly demonstrate TrustVC functionality
  • Prototyping - When you're in the early stages of development and need a working renderer
  • Testing - When you want to test document issuance and verification without creating a custom renderer
  • Simple use cases - When your document structure aligns well with one of the available templates

However, for production environments or specific document types that require custom branding or layouts, we recommend creating a custom decentralized renderer.

Using Generic Templates​

1. Choose the Appropriate Template​

First, determine which generic template best fits your document type. You can preview the templates in the Generic Templates Storybook to see how they look and what data fields they support.

2. Configure Your Document​

To use a generic template, you need to configure your document's renderMethod field to point to the generic templates renderer and specify the template name:

{
...
"renderMethod": [
{
"id": "https://generic-templates.tradetrust.io",
"type": "EMBEDDED_RENDERER",
"templateName": "BILL_OF_LADING_CARRIER"
}
],
...
}

Replace BILL_OF_LADING_CARRIER with the appropriate template name from the following options:

  • CHAFTA_COO - Certificate of Origin template
  • PROMISSORY_NOTE - Electronic Promissory Note template
  • BILL_OF_LADING_CARRIER - Electronic Bill of Lading template
  • INVOICE - Invoice template
  • WAREHOUSE_RECEIPT - Warehouse Receipt template
  • BILL_OF_EXCHANGE - Bill of Exchange template (Beta — see Obligation Registry Overview)

3. Prepare Your Document Data​

Each template requires specific data fields. Below are examples for common templates:

Bill of Lading​

{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://w3id.org/security/data-integrity/v2",
"https://trustvc.io/context/render-method-context-v2.json",
"https://trustvc.io/context/transferable-records-context.json",
"https://trustvc.io/context/attachments-context.json",
"https://trustvc.io/context/bill-of-lading-carrier.json"
],
"type": [
"VerifiableCredential"
],
"credentialStatus": {
"type": "TransferableRecords",
"tokenNetwork": {
"chain": "POL",
"chainId": "80002"
},
"tokenRegistry": "0x3652efbc80ace560844afc932d2bf8b452a96c6d",
"tokenId": "02d85fa7969fc26d5b6714d09b905e3e7656c0200d6c3734fc7b64db274d4081"
},
"renderMethod": [
{
"id": "https://generic-templates.tradetrust.io",
"type": "EMBEDDED_RENDERER",
"templateName": "BILL_OF_LADING_CARRIER"
}
],
"credentialSubject": {
"type": [
"BillOfLadingCarrier"
],
"shipperAddressStreet": "",
"consigneeName": "",
"notifyPartyName": "",
"blNumber": "20250107",
"scac": "20250107",
"attachments": [
{
"filename": "word.docx",
"mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
"data": "..."
}
]
},
"validUntil": "2025-09-30T15:53:58.112Z",
"issuer": "did:web:did.trustvc.io",
}

Bill of Exchange​

Beta

The Bill of Exchange template is currently in beta, as is the Obligation Registry it's issued through. APIs, contract addresses, and behavior may change before the stable release. Use on testnet only and do not rely on this feature in production.

To create and issue this example, use the beta CLI on testnet (npm install -g @trustvc/trustvc-cli@beta, then trustvc w3c-sign followed by trustvc obligation-registry mint — mint only accepts a signed document) — see Mint document to the Obligation Registry for the full flow. Do not use the V5 Creator (Mainnet or Testnet) for this example; it only supports the classic Token Registry.

Unlike the other generic templates, a Bill of Exchange document's credentialStatus points at an Obligation Registry (obligationRegistry) instead of a classic Token Registry (tokenRegistry) — see Obligation Registry Deployment to deploy one.

{
"@context": [
"https://www.w3.org/ns/credentials/v2",
"https://w3id.org/security/data-integrity/v2",
"https://trustvc.io/context/render-method-context-v2.json",
"https://trustvc.io/context/bill-of-exchange-documentary-credit.json",
"https://trustvc.io/context/obligation-records-context.json"
],
"type": [
"VerifiableCredential"
],
"credentialStatus": {
"type": "TransferableRecords",
"tokenNetwork": {
"chain": "Sepolia",
"chainId": 11155111
},
"obligationRegistry": "0x9aAEfa502D0d975b9eECdBc280704F2D52029d10",
"tokenId": "d518e8958af67b90441775e4836feb050240ace87ac086d30496169ea296b32e"
},
"renderMethod": [
{
"id": "https://generic-templates.tradetrust.io",
"type": "EMBEDDED_RENDERER",
"templateName": "BILL_OF_EXCHANGE"
}
],
"credentialSubject": {
"type": [
"BillOfExchange"
],
"referenceNumber": "BOE-2026-00147",
"amountInFigures": "128500.00",
"currencyCode": "USD",
"amountInWords": "One hundred twenty-eight thousand five hundred United States Dollars only",
"placeOfIssue": "Singapore",
"dateOfIssue": "2026-07-06",
"tenor": "At 90 days sight",
"payee": "Meridian Commodities Pte Ltd",
"drawnUnder": "Documentary Credit No. LC-DBS-2026-88341",
"drawnUnderDate": "2026-06-15",
"issuedBy": "DBS Bank Ltd",
"drawee": {
"name": "Fairview Industries Inc.",
"address": "1201 Market Street, Suite 900, Wilmington, DE 19801, USA",
"authorisedSignatoryName": "James R. Carter",
"signature": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
},
"drawer": {
"name": "Meridian Commodities Pte Ltd",
"address": "8 Marina Boulevard, #24-01, Singapore 018981",
"authorisedSignatoryName": "Wei Ling Tan",
"signature": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII="
}
},
"validUntil": "2026-12-31T15:53:58.112Z",
"issuer": "did:web:did.trustvc.io"
}

Fields on drawee / drawer (both optional BillOfExchangeParty objects): name, address, authorisedSignatoryName, and signature. signature must be an inline base64 data URI (data:image/png;base64,..., data:image/jpeg;base64,..., data:image/gif;base64,..., data:image/webp;base64,..., or data:image/svg+xml;base64,...) — hosted/remote image URLs are rejected by the template for security. The signature values above are minimal 1×1 pixel placeholders to keep the example short — substitute your own signature image's data URI.

4. Create and Issue Your Document​

For templates other than Bill of Exchange, you can create and issue a sample document using the TrustVC Creator (V5 - Mainnet) / TrustVC Creator (V5 - Testnet).

Alternatively, you can setup your own creator by following the TrustVC Creator Tutorial.

Bill of Exchange issuance is covered in the Bill of Exchange section above — use the beta CLI on testnet, not the Creator.

Limitations of Generic Templates​

While generic templates provide a convenient way to get started, they have some limitations:

  1. Limited customization - You can only customize the fields provided by the template
  2. Fixed layout - The overall layout and design cannot be changed
  3. No custom branding - Limited options for adding your company's branding
  4. No custom logic - Cannot add custom validation or interactive features

For these reasons, generic templates are recommended primarily for demonstration, testing, and prototyping purposes. For production use, consider creating a custom decentralized renderer.

Conclusion​

Generic templates provide a quick and convenient way to render TrustVC documents without having to create custom renderers. They are ideal for demonstration, testing, and prototyping purposes, but for production use, consider creating a custom decentralized renderer for greater flexibility and branding control.

By following the steps in this guide, you can effectively use TrustVC's generic templates to render your documents in a visually appealing way.