ar.io Logoar.io Documentation
ArDrive CLIWorking With Files

Creating a Snapshot

A snapshot is a drive's whole state, up to the current block, published as one Arweave transaction: an ArFS Drive State entity (Entity-Type: drive-state) holding a SQLite database of the drive's folders, files and their revisions. A client that finds one reads the drive in one download and then queries only the blocks after it, instead of replaying every transaction the drive has ever produced. create-snapshot builds it from the chain and posts it.

Some important things to know:

  • You must own the drive. Clients trust a snapshot only from the drive's owner.
  • Public and private drives. A private drive's snapshot is encrypted with the drive key, so only someone with the drive key can read it. Pass --private or --drive-key as you would to list the drive.
  • Costs to post, like any other data transaction. create-snapshot prints the size and, without --turbo, the estimated AR cost before sending, and checks your wallet can cover it.
  • It refuses rather than publish a drive state it cannot vouch for. It stops if a recent change to the drive is still being confirmed, if any of the drive's metadata cannot be read, if the drive has no folders or files, or if the snapshot would be larger than the 100 MiB every reader accepts. Licence details are not included: readers read each file's licence from its licenseTxId.
  • Each run publishes a new snapshot. Readers use the newest one. Publishing again after a drive has grown keeps reading it fast.
  • The format replaced the JSON snapshot. Earlier versions of this command published Entity-Type: snapshot JSON bodies. Those stay readable by every client; this command no longer creates them.
ardrive create-snapshot --drive-id "bc9af866-6421-40f1-ac89-202bddb5c487" -w "/path/to/wallet"

For a private drive:

ardrive create-snapshot --drive-id "bc9af866-6421-40f1-ac89-202bddb5c487" -w "/path/to/wallet" --private

Use --dry-run to build and sign the snapshot and see its block range, entity count and size without posting anything or needing the funds:

ardrive create-snapshot --drive-id "bc9af866-6421-40f1-ac89-202bddb5c487" -w "/path/to/wallet" --dry-run

Like other write commands, create-snapshot supports --boost, --turbo/--turbo-url, and --gateway. See ardrive create-snapshot --help for the full flag list.

How is this guide?