Uploading Manifests
[Arweave Path Manifests][arweave-manifests] are are special .json files that instruct Arweave Gateways to map file data associated with specific, unique transaction IDs to customized, hosted paths relative to that of the manifest file itself. So if, for example, your manifest file had an arweave.net URL like:
https://arweave.net/{manifest tx id}Then, all the mapped transactions and paths in the manifest file would be addressable at URLs like:
https://arweave.net/{manifest tx id}/foo.txt
https://arweave.net/{manifest tx id}/bar/baz.pngArDrive supports the creation of these Arweave manifests using any of your PUBLIC folders. The generated manifest paths will be links to each of the file entities within the specified folder. The manifest file entity will be created at the root of the folder.
To create a manifest of an entire public drive, specify the root folder of that drive:
ardrive create-manifest -f "bc9af866-6421-40f1-ac89-202bddb5c487" -w "/path/to/wallet"You can also create a manifest of a folder's file entities at a custom depth by using the --max-depth option:
ardrive create-manifest --max-depth 0 -f "867228d8-4413-4c0e-a499-e1decbf2ea38" -w "/path/to/wallet"Creating a .json file of your manifest links output can be accomplished here with some jq parsing and piping to a file:
ardrive create-manifest -w /path/to/wallet -f "6c312b3e-4778-4a18-8243-f2b346f5e7cb" | jq '{links}' > links.jsonIf you'd like to preview the contents of your manifest before uploading, you can perform a dry run and do some lightweight post processing to isolate the data:
ardrive create-manifest -w /path/to/wallet -f "6c312b3e-4778-4a18-8243-f2b346f5e7cb" --dry-run | jq '{manifest}.manifest'{
"manifest": "arweave/paths",
"version": "0.1.0",
"index": {
"path": "index.html"
},
"paths": {
"hello_world.txt": {
"id": "Y7GFF8r9y0MEU_oi1aZeD87vrmai97JdRQ2L0cbGJ68"
},
"index.html": {
"id": "pELonjVebHyBsdxVymvxbGTmHD96v9PuuUXj8GUHGoY"
}
}
}The manifest data transaction is tagged with a unique content-type, application/x.arweave-manifest+json, which tells the gateway to treat this file as a manifest. The manifest file itself is a .json file that holds the paths (the data transaction ids) to each file within the specified folder.
When your folder is later changed by adding files or updating them with new revisions, the original manifest will NOT be updated on its own. A manifest is a permanent record of your files in their current state.
However, creating a subsequent manifest with the same manifest name will create a new revision of that manifest in its new current state. Manifests follow the same name conflict resolution as outlined for files above (upsert by default).
Hosting a Webpage with Manifest
When creating a manifest, it is possible to host a webpage or web app. You can do this by creating a manifest on a folder that has an index.html file in its root.
Using generated build folders from popular frameworks works as well. One requirement here to note is that the href= paths from your generated index.html file must not have leading a /. This means that the manifest will not resolve a path of /dist/index.js but it will resolve dist/index.js or ./dist/index.js.
As an example, here is a flow of creating a React app and hosting it with an ArDrive Manifest. First, generate a React app:
yarn create react-app my-appNext, add this field to the generated package.json so that the paths will resolve correctly:
"homepage": ".",Then, create an optimized production build from within the app's directory:
yarn buildNow, we can create and upload that produced build folder on ArDrive to any of your existing ArFS folder entities:
ardrive upload-file -l "/build" -w "/path/to/wallet" --parent-folder-id "bc9af866-6421-40f1-ac89-202bddb5c487"And finally, create the manifest using the generated Folder ID from the build folder creation:
ardrive create-manifest -f "41759f05-614d-45ad-846b-63f3767504a4" -w "/path/to/wallet"In the return output, the top link will be a link to the deployed web app:
"links": [
"https://arweave.net/0MK68J8TqGhaaOpPe713Zn0jdpczMt2NGS2CtRYiuAg",
"https://arweave.net/0MK68J8TqGhaaOpPe713Zn0jdpczMt2NGS2CtRYiuAg/asset-manifest.json",
"https://arweave.net/0MK68J8TqGhaaOpPe713Zn0jdpczMt2NGS2CtRYiuAg/favicon.ico",
"https://arweave.net/0MK68J8TqGhaaOpPe713Zn0jdpczMt2NGS2CtRYiuAg/index.html",
# ...This is effectively hosting a web app with ArDrive. Check out the ArDrive Price Calculator React App hosted as an [ArDrive Manifest][example-manifest-webpage].
How is this guide?