Developers Forum for XinFin XDC Network

Cover image for Step-by-Step Guide to Creating a Demo File with TradeTrust Functionality for the XDC Network!
Vinn
Vinn

Posted on

Step-by-Step Guide to Creating a Demo File with TradeTrust Functionality for the XDC Network!

TradeTrust is a groundbreaking platform designed to enhance trust and security within the realm of international trade. Leveraging TradeTrust, we aim to bring transparency and reliability to trade documents. In our comprehensive guide, available at "Unveiling MLETR’s Potential in International Trade with TradeTrust-XDC Network Partnership", we provide detailed insights into how TradeTrust seamlessly integrates with the XDC Network. To create a demo file, follow these steps:

Clone the "open-attestation-cli" Repository and Install Dependencies:
Begin by cloning the "open-attestation-cli" repository and installing the necessary dependencies using the following command:

npm i
Enter fullscreen mode Exit fullscreen mode

Initiate Wallet Creation:
To create verifiable documents, start by initiating wallet creation with this command:

open-attestation wallet create --output-file wallet.json
Enter fullscreen mode Exit fullscreen mode

Note: Ensure that you add funds to the displayed wallet address.

Deploy the Document Store:

For XDC Mainnet:

open-attestation deploy document-store "My first document store" --network xdc --encrypted-wallet-path wallet.json
Enter fullscreen mode Exit fullscreen mode

For XDC Apothem Network:

open-attestation deploy document-store "My first document store" --network xdcapothem --encrypted-wallet-path wallet.json
Enter fullscreen mode Exit fullscreen mode

Create DNS TXT Records:

For Mainnet:

open-attestation dns txt-record create --address <document store address> --network-id 50
Enter fullscreen mode Exit fullscreen mode

For XDC Apothem Network:

open-attestation dns txt-record create --address <document store address> --network-id 51
Enter fullscreen mode Exit fullscreen mode

Retrieve DNS TXT Records:

For Mainnet:

open-attestation dns txt-record get --location <DNS location> --networkId 50
Enter fullscreen mode Exit fullscreen mode

For XDC Apothem Network:

open-attestation dns txt-record get --location <DNS location> --networkId 51
Enter fullscreen mode Exit fullscreen mode

Creating Raw Document:

Create a folder named "raw-documents" and place a file inside it named "cert.json" with the following content:

{
  "$template": {
    "name": "main",
    "type": "EMBEDDED_RENDERER",
    "url": "https://tutorial-renderer.openattestation.com"
  },
  "recipient": {
    "name": "John"
  },
  "issuers": [
    {
      "name": "Alice",
      "documentStore": "<documentStore address>",
      "identityProof": {
        "type": "DNS-TXT",
        "location": "<DNS location>"
      }
    }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Wrap Documents:

open-attestation wrap ./raw-documents --output-dir ./wrapped-documents
Enter fullscreen mode Exit fullscreen mode

Issue Documents:

For Mainnet:

open-attestation document-store issue --network xdc --encrypted-wallet-path wallet.json --address <document store address> --hash <merkle root hash>
Enter fullscreen mode Exit fullscreen mode

For XDC Apothem Network:

open-attestation document-store issue --network xdcapothem --encrypted-wallet-path wallet.json --address <document store address> --hash <merkle root hash>
Enter fullscreen mode Exit fullscreen mode

Once you have successfully created a Demo Verifiable document, you can easily verify it on the TradeTrust Verification platform by connecting to the XDC network. Discover the transformative potential of TradeTrust and the XDC Network in revolutionizing international trade documentation!

For XDC Apothem Network Verification:
https://dev.tradetrust.io/verify

For XDC Mainnet Verification:
https://www.tradetrust.io/verify
Image description

If you encounter any issues during the creation of your demo file, please feel free to leave a comment below.

Discussion (1)

Collapse
suheb_ahmed_26781d5581aa7 profile image
Suheb Ahmed

Hi Vin, while deploying my first document store I am getting error that Wei is not specified while I have XDC token in my wallet