# Provenance Proofs Integration This document outlines: - Using just data hashes to inherit strong provenance - How to post provenance proofs - How to use Bundlr's GraphQL for retrieving provenance proofs ### Prerequisites - You have funded node1 which can be done [here](https://docs.bundlr.network/developer-docs/cli/funding-a-node) ### Code snippets This example demonstrates: - Posting a `sha256` hash of the data in the provenance proof (you can use any other standard hash function) - Using ETH for Bundlr ```js import Bundlr from "@bundlr-network/client"; import crypto from "crypto"; const bundlr = new Bundlr("https://node1.bundlr.network", "ethereum", "<eth-private-key>"); const hashingAlgo = "sha256"; const uploader = "Josh"; const data = "Hello world"; const hash = crypto .createHash(hashingAlgo) .update(data) .digest() .toString("hex"); const result = await bundlr.upload("", { tags: [ { name: "Data-Protocol", value: "Provenance-Confirmation" }, { name: "Hashing-Algo", value: hashingAlgo }, { name: "Data-Hash", value: hash }, { name: "Uploaded-For", value: uploader } ], }); // Transaction ID which can be used to retrieve the proof const { id } = result; console.log("See tx at https://gateway.bundlr.network/tx/" + id); ``` This example demonstrates: - Getting a proof for a specific piece of data via GraphQL ```js import axios from "axios"; const hash = ...; const queryObject = { query: `{ transactions( tags: [ { name: "Data-Protocol", values: ["Provenance-Confirmation"] }, { name: "Data-Hash", values: ["${hash}"] } ] ) { edges { node { id tags { name value } timestamp } } } }` }; const results = await axios.post("https://node1.bundlr.network/graphql", queryObject); // Get first instance of proof const proof = results.data.data.transactions.edges[0]?.node; console.log(proof); // { // id: "...", // tags: [...], // timestamp: ..., // ... // } ```