Skip to content

Publishing the Unchained Index Manifest

Thomas Jay Rush edited this page May 16, 2024 · 13 revisions

Table of Contents

Update the index to the latest block

  • Run chifra scrape, or
  • Copy the index from another machine (using get_index, for example)

Pin the chunks to both IPFS and Pinata

  • Start the IPFSs daemon in one window. Work in another.
  • Run chifra chunks manifest | cut -f1 | cut -f2 -d'-'. This will show the $lastIndexBlock found in the manifest.
  • Subtract a few blocks (to avoid off-by-one) $lastIndexBlock -= 10.
  • Note: $lastIndexBlock will snap back to the start of the previous chunk.
  • Run chifra chunks index --check until everything passes (do not proceed otherwise).
  • Run echo no | TB_CHUNKS_PINFIRSTBLOCK=$lastIndexBlock chifra chunks manifest --chain <chain> --pin --remote --sleep 1 --deep.
    • The echo no disables the check that would happen otherwise.
    • --deep causes each chunk to be pinned. Without --deep, only the manifest and timestamps are pinned.
    • Without --remote, the chunks will only be pinned to the local IPFS daemon. --sleep is required to avoid rate limiting.
  • The above will write the new manifest to a temporary folder. Check it against the existing manifest.
  • Check the manifest. Do not proceed unless it's accurate.

Update the manifest.json file

  • Run chifra chunks manifest. This should report the old latest manifest record ($lastIndexBlock).
  • Run chifra chunks manifest --remote. This should report the same $lastIndexBlock from the smart contract.
  • Run echo no | TB_CHUNKS_PINFIRSTBLOCK= chifra chunks manifest --chain <chain> --pin --remote --rewrite.
  • Note: We do not include --deep here, so it only takes a few seconds. That's why we can start at zero.
  • The above will overwrite the manifest in the unchained index folder. Check it against the previous manifest.
  • Check that both the manifest and the ts.bin files are pinned. The CIDs will be shown on the console.

Publish the manifest.json to the smart contract

  • Run chifra chunks manifest. It should report new $lastIndexBlock.
  • Run chifra chunks manifest --remote. It should report the previous $lastIndexBlock.
  • Publish to the smart contract with chifra chunks manifest --chain <chain> --publish. (Doesn't work - do it by hand.)
  • Note: The --publish flag is not yet implemented. Do it by hand.
  • Check everything:
    • chifra init all --chain <chain>
    • chifra chunks index --check.