Comment on page
CLI
The CLI is the easiest way to interact with ShdwDrive. You can use your favorite shell scripting language, or just type the commands one at a time. For test driving ShdwDrive, this is the best way to get started.
Then run the following command
npm install -g @shadow-drive/cli
In order to interact with ShdwDrive, we're going to need a Solana wallet and CLI to interact with the Solana blockchain.
NOTE: The ShdwDrive CLI uses it's own RPC configuration. It does not use your Solana environment configuration.
sh -c "$(curl -sSfL https://release.solana.com/v1.14.3/install)"
Upon install, follow that up immediately with:
export PATH="/home/sol/.local/share/solana/install/active_release/bin:$PATH"
We need to have a keypair in .json format to use the ShdwDrive CLI. This is going to be the wallet that owns the storage account. If you want, you can convert your browser wallet into a .json file by exporting the private keys. Solflare by default exports it in a .json format (it looks like a standard array of integers, [1,2,3,4...]. Phantom, however, needs some help and we have just the tool to do that.
If you want to create a new wallet, just use
solana-keygen new -o ~/shdw-keypair.json
You will see it write a new keypair file and it was display the
pubkey
which is your wallet address.You'll need to send a small amount of SOL and SHDW to that wallet address to proceed! The SOL is used to pay for transaction fees, the SHDW is used to create (and expand) the storage account!
ShdwDrive CLI comes with integrated help. All ShdwDrive commands begin with
shdw-drive
.shdw-drive help
The above command will yield the following output

You can get further help on each of these commands by typing the full command, followed by the
--help
option.shdw-drive create-storage-account --help
-kp, --keypair
- Path to wallet that will create the storage account
-n, --name
- What you want your storage account to be named. (Does not have to be unique)
-s, --size
- Amount of storage you are requesting to create. This should be in a string like '1KB', '1MB', '1GB'. Only KB, MB, and GB storage delineations are supported.
Example:
shdw-drive create-storage-account -kp ~/shdw-keypair.json -n "pony storage drive" -s 1GB
There are only two required options for this command:
-kp, --keypair
- Path to wallet that will upload the file
-f, --file
- File path. Current file size limit is 1GB through the CLI.
If you have multiple storage accounts it will present you with a list of owned storage accounts to choose from. You can optionally provide your storage account address with:
-s, --storage-account
- Storage account to upload file to.
Example:
shdw-drive upload-file -kp ~/shdw-keypair.json -f ~/AccountHolders.csv
A more realistic use case is to upload an entire directory of, say, NFT images and metadata. It's basically the same thing, except we point the command to a directory.
Options:
-kp, --keypair
- Path to wallet that will upload the files
-d, --directory
- Path to folder of files you want to upload.
-s, --storage-account
- Storage account to upload file to.
-c, --concurrent
- Number of concurrent batch uploads. (default: "3")
Example:
shdw-drive upload-multiple-files -kp ~/shdw-keypair.json -d ~/ponyNFT/assets/
This command is used to replace an existing file that has the exact same name. If you attempt to upload this file using
edit-file
and an existing file with the same name is not already there, the request will fail.There are three requirements for this command:
-kp, --keypair
- Path to wallet that will upload the file
-f, --file
- File path. Current file size limit is 1GB through the CLI. File must be named the same as the one you originally uploaded
-u, --url
- ShdwDrive URL of the file you are requesting to delete
Example:
shdw-drive edit-file --keypair ~/shdw-keypair.json --file ~/ponyNFT/01.json --url https://shdw-drive.genesysgo.net/abc123def456ghi789/0.json
This is straightforward and it's important to note once it's deleted, it's gone for good.
There are two requirements and there aren't any options outside of the standard ones:
-kp, --keypair
- Path to the keypair file for the wallet that owns the storage account and file
-u, --url
ShdwDrive URL of the file you are requesting to deleteExample:
shdw-drive delete-file --keypair ~/shdw-keypair.json --url https://shdw-drive.genesysgo.net/abc123def456ghi789/0.json
You can expand the storage size of a storage account. This command consumes SHDW tokens.
There are only two requirements for this call
-kp, --keypair
- Path to wallet that will upload the files
-s, --size
- Amount of storage you are requesting to add to your storage account. Should be in a string like '1KB', '1MB', '1GB'. Only KB, MB, and GB storage delineations are supported currently
If you have more than one account, you'll get to pick which storage account you want to add storage to.
Example:
shdw-drive add-storage -kp ~/shdw-keypair.json -s 100MB
You can reduce your storage account and reclaim your unused SHDW tokens. This is a two part operation where you first reduce your account size, and then request your SHDW tokens. First, let's reduce the storage account size.
There are two requirements
-kp, --keypair
- Path to wallet that will upload the files
-s, --size
- Amount of storage you are requesting to remove from your storage account. Should be in a string like '1KB', '1MB', '1GB'. Only KB, MB, and GB storage delineations are supported currently
Example:
shdw-drive reduce-storage -kp ~/shdw-keypair.json -s 500MB
Since you reduced the amount of storage being used in the previous step, you are now free to claim your unused SHDW tokens. The only requirement here is a keypair.
Example:**
shdw-drive claim-stake -kp ~/shdw-keypair.json
You can entirely remove a storage account from ShdwDrive. Upon completion, your SHDW tokens will be returned to the wallet.
NOTE: You have a grace period upon deletion that lasts until the end of the current Solana epoch. Go HERE to see how much time is remaining in the current Solana epoch to know how much grace period you will get.
All you need here is a keypair, and it will prompt you for the specific storage account to delete.
Example:
shdw-drive delete-storage-account ~/shdw-keypair.json
Assuming the epoch is still active, you can undelete your storage account. You only need a keypair. You will be prompted to select a storage account when running the command. This removes the deletion request.
shdw-drive undelete-storage-account -kp ~/shdw-keypair.json
One of the most unique and useful features of ShdwDrive is that you can make your storage truly permanent. With immutable storage, no file that was uploaded to the account can ever be deleted or edited. They are solidified and permanent, as is the storage account itself. You can still continue to upload files to an immutable account, as well as add storage to an immutable account.
The only requirement is a keypair. You will be prompted to select a storage account when running the command.
Example:
shdw-drive make-storage-account-immutable -kp ~/shdw-keypair.json
Create an account on which to store data. Storage accounts can be globally, irreversibly marked immutable for a one-time fee. Otherwise, files can be added or deleted from them, and space rented indefinitely.
Parameters:
--name
- String
--size
- Byte
Example:
shadow-drive-cli create-storage-account --name example_account --size 10MB
Queues a storage account for deletion. While the request is still enqueued and not yet carried out, a cancellation can be made (see cancel-delete-storage-account subcommand).
Parameters:
--storage-account
- Pubkey
Example:
shadow-drive-cli delete-storage-account --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Example:
shadow-drive-cli delete-storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Cancels the deletion of a storage account enqueued for deletion.
Parameters:
--storage-account
- Pubkey
Example:
shadow-drive-cli cancel-delete-storage-account --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Example:
shadow-drive-cli cancel-delete-storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Redeem tokens afforded to a storage account after reducing storage capacity.
Parameters:
--storage-account
- Pubkey
Example:
shadow-drive-cli claim-stake --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Example:
shadow-drive-cli claim-stake FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Increase the capacity of a storage account.
Parameters:
--storage-account
- Pubkey
--size
- Byte (accepts KB, MB, GB)
Example:
shadow-drive-cli add-storage --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB --size 10MB
Example:
shadow-drive-cli add-storage FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB 10MB
Increase the immutable storage capacity of a storage account.
Parameters:
--storage-account
- Pubkey
--size
- Byte (accepts KB, MB, GB)
Example:
shadow-drive-cli add-immutable-storage --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB --size 10MB
Example:
shadow-drive-cli add-immutable-storage FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB 10MB
Reduce the capacity of a storage account.
Parameters:
--storage-account
- Pubkey
--size
- Byte (accepts KB, MB, GB)
Example:
shadow-drive-cli reduce-storage --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB --size 10MB
Example:
shadow-drive-cli reduce-storage FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB 10MB
Make a storage account immutable. This is irreversible.
Parameters:
--storage-account
- Pubkey
Example:
shadow-drive-cli make-storage-immutable --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Example:
shadow-drive-cli make-storage-immutable FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Fetch the metadata pertaining to a storage account.
Parameters:
--storage-account
- Pubkey
Example:
shadow-drive-cli get-storage-account --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Example:
shadow-drive-cli get-storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Fetch a list of storage accounts owned by a particular pubkey. If no owner is provided, the configured signer is used.
Parameters:
--owner
- Option<Pubkey>
Example:
shadow-drive-cli get-storage-accounts --owner FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Example:
shadow-drive-cli get-storage-accounts
List all the files in a storage account.
Parameters:
--storage-account
- Pubkey
Example:
shadow-drive-cli list-files --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Example:
shadow-drive-cli list-files FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB
Get a file, assume it's text, and print it.
Parameters:
--storage-account
- Pubkey
--filename
Example:
shadow-drive-cli get-text --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB --filename example.txt
Example:
shadow-drive-cli get-text FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB example.txt
Get basic file object data from a storage account file.
Parameters:
--storage-account
- Pubkey
--file
- String
Example:
shadow-drive-cli get-object-data --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB --file example.txt
Example:
shadow-drive-cli get-object-data FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB example.txt
Delete a file from a storage account.
Parameters:
--storage-account
- Pubkey
--filename
- String
Example:
shadow-drive-cli delete-file --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB --filename example.txt
Example:
shadow-drive-cli delete-file FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB example.txt
Edit a file in a storage account.
Parameters:
--storage-account
- Pubkey
--path
- PathBuf
Example:
shadow-drive-cli edit-file --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB --path /path/to/new/file.txt
Example:
shadow-drive-cli edit-file FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB /path/to/new/file.txt
Upload one or more files to a storage account.
Parameters:
--batch-size
- usize (default: value of FILE_UPLOAD_BATCH_SIZE)
--storage-account
- Pubkey
--files
- Vec<PathBuf>
Example:
shadow-drive-cli store-files --batch-size 100 --storage-account FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB file1.txt file2.txt
Example:
shadow-drive-cli store-files FKDU64ffTrQq3E1sZsNknefrvY8WkKzCpRyRfptTnyvB file1.txt file2.txt
Last modified 1mo ago