Skip to content

H0M13/true-site

Repository files navigation

TrueSite

Dapp built as part of the Spring 2021 Chainlink Virtual Hackathon to demonstrate a simple usage of TrueSight, a prototype for an oracle network built to provide moderation labels for user-generated content.

Users are able to upload images to an API. There the images are pinned to IPFS and the IPFS content hash is returned. The user is then prompted to make a transaction to store the image content hash on the dapp smart contract.

Upon submission of the transaction the smart contract requests moderation labels on the image from a Chainlink node and receives back another IPFS content hash representing the generated moderation labels. Note: the IPFS content hash is transformed to a bytes32 type to respect the maximum size of return values from Chainlink nodes of 32 bytes.

The client-side application converts moderation labels from bytes32 to IPFS content hash format and is then able to prompt all users whether any moderation labels were flagged for an image before they view it.

This repository began as a fork of scaffold-eth!

Quick Start

required: Node and Yarn

yarn install
yarn start

Backend API

By default the application will point to our pre-deployed API but this can be configured by setting the REACT_APP_API_URL environment variable.

Smart contract

By default the application will point to a pre-deployed contract on the Polygon Mumbai testnet.

If you wish to deploy your own contract run

yarn deploy

and be sure to fund it with testnet LINK so it can make moderation requests!

Manually decoding bytes32 IPFS hashes

Run node .\bytes32ToIpfsHashConverter.js {your_bytes32_content} to get the original IPFS content hash for the moderation labels.

You can go to https://gateway.ipfs.io/ipfs/{your_ipfs_content_hash} to see the reported labels in your browser.

See https://gateway.ipfs.io/ipfs/QmeD98VHCC4jGXanSmfSXNdB6ot8zAMghAUDGcqxNhUh92 for an example.