Skip to main content

Deploy and Test the Tangle Data Storage Demo

To start storing data in the IPFS node and the Tangle, deploy the application and use our graphical user interface to upload file data, retrieve file data, and compare hashes to verify the contents.

Prerequisites

To test and deploy this application, you need the following:

To edit this application for your own needs, you need knowledge of JavaScript, Node.js, and React.js.

Deploy the Tangle Data Storage App

To deploy this application on your local network, complete the following instructions. These deployment instructions are also hosted on GitHub.

  1. Clone the GitHub repository

    git clone https://github.com/iotaledger/poc-ipfs.git
    cd poc-ipfs
  2. Change into the api directory and install the dependencies

    cd api
    npm i
  3. Copy the src/data/config.template.json file to the dist/data directory and rename it to config.local.json

  4. Open the config.local.json file and configure the API server

    Configuration optionDescriptionNotes
    node (required)The IOTA network settingsWhen choosing a node, consider the IOTA network that you want to use
    ipfs (required)Set the provider field to the URL of your IPFS node. If your IPFS node requires an authentication token, set this in the token field.
    dynamoDbConnection (required)Set these fields to the settings for your DynamoDB instanceThis database is needed to keep track of transaction data so that it is never lost in the Tangle after a snapshot
    allowedDomainsSet this field to the domains that may access the API.
  5. From the api directory, start the API server in development mode

    npm run start-dev
  6. Change into the client directory and install the dependencies

    cd ../client
    npm i
  7. Rename the public/data/config.template.json file to config.local.json

  8. Open the config.local.json file and configure the client application

    Configuration optionDescriptionNotes
    apiEndpoint (required)Set this field to the URL of the API server that you just startedBy default, the API listens on the following URL: http:localhost:4000
    ipfsGatewaySet this field to the IPFS gateway that you want to use to get files from the IPFS networkThe default gateway is https://ipfs.io/ipfs/:hash
    tangleExplorerSet these fields to the URL of the Tangle explorer that you want to use to search for messages on the front endThe default Tangle explorer is https://explorer.iota.org
    googleAnalyticsIdIf you have Google Analytics set up for your client, set this field to your Google Analytics ID
  9. Run the client application

    npm run start

When the client connects to the API, the following page will be opened in your default web browser:

Upload File for IOTA IPFS Data Storage PoC

:

The file size limitation is only for the purposes of this blueprint. You can edit this blueprint to allow any file size.

This page is the front end to the application, which you can use to test it.

Test the Tangle Data Storage App

  1. Select a file, and see that the other fields are automatically populated with metadata

    Upload File for IOTA IPFS Data Storage PoC - Populated

  2. Click Upload to store the metadata on the IPFS node and the Tangle. If everything went well, you should see a confirmation message.

    Uploaded File for IOTA IPFS Data Storage PoC

  3. To validate a file, go to the Retrieve File page.

    Retrieve File for IOTA IPFS Data Storage PoC

  4. Enter a message ID and click RETRIEVE. The message ID will be passed to the API, which will get the IPFS hash from the message's IndexationPayload field, which is used to download the file and validate its SHA256 hash against the one stored in the message.

    Retrieve File for IOTA IPFS Data Storage PoC

This completes the full lifecycle for storing, retrieving, and validating a file. The file metadata, SHA256 hash and IPFS hash that are stored in a transaction in the Tangle are immutable. If the file contents that you retrieve from the IPFS node don't match the ones in the Tangle, then the contents of that file can no longer be trusted.

Next Steps

Run your own node and configure the application to connect to it.