Storage CLI

The Irys CLI provides command-line tools for managing onchain storage operations including checking balances, pricing, funding, withdrawing, and uploading files and directories.

Installation

Install the CLI globally using npm:

npm i -g @irys/cli

Depending on your setup, you may need to use the sudo command:

sudo npm i -g @irys/cli
Note
Note
If you get an error while installing, append the --force flag to the end of the install command.

Balance

The balance command retrieves available funds on a specified Irys node using a public wallet address.

OptionDescription
-nThe network to check, mainnet or devnet, defaults to mainnet
-tThe token type for funding
--provider-urlRPC URL to use

Mainnet example:

irys balance 0x591B5Ce7cA10a55A9B5d1516eF89693D5b3586b8 \
  -t ethereum

Devnet example:

irys balance 0x591B5Ce7cA10a55A9B5d1516eF89693D5b3586b8 \
  -t ethereum \
  -n devnet \
  --provider-url https://rpc.sepolia.dev

Price

The price command checks the cost to upload a specified number of bytes.

OptionDescription
-nThe network to check, mainnet or devnet, defaults to mainnet
-tToken for funding
--provider-urlRPC URL to use

Mainnet example:

irys price 1000000 \
  -t ethereum

Devnet example:

irys price 1000000 \
  -t ethereum \
  -n devnet \
  --provider-url https://rpc.sepolia.dev

Fund

The fund command funds your Irys account with tokens.

Note
Note
Not all calls to fund will post immediately to your account. Some blockchains are faster than others.
OptionDescription
-nSpecifies network (mainnet or devnet), defaults to mainnet
-tDesignates the token type for funding
-wYour private key
--provider-urlRPC URL to use

Mainnet example:

irys fund 1000000000000000 \
  -t ethereum \
  -w bf20......c9885307

Devnet example:

irys fund 1000000000000000 \
  -n devnet \
  -t ethereum \
  -w bf20......c9885307 \
  --provider-url https://rpc.sepolia.dev

Withdraw

The withdraw command withdraws funds from your Irys account.

Note
Note
Not all calls to withdraw will post immediately to your account. Some blockchains are faster than others.
OptionDescription
-nSpecifies network (mainnet or devnet), defaults to mainnet
-tDesignates the token type for the withdrawal
-wYour private key
--provider-urlRPC URL to use

Mainnet example:

irys withdraw 1000000000000000 \
  -t ethereum \
  -w bf20......c9885307

Devnet example:

irys withdraw 1000000000000000 \
  -n devnet \
  -t ethereum \
  -w bf20......c9885307 \
  --provider-url https://rpc.sepolia.dev

Upload

The upload command uploads a single file to the Irys network.

OptionDescription
-nNetwork selection: mainnet or devnet (defaults to mainnet)
-tToken type for funding the upload
-wYour private key
--tagsMetadata tags in name value format pairs
--provider-urlRPC URL to use

Mainnet example:

irys upload myImage.png \
  -t ethereum \
  -w bf20......c9885307 \
  --tags tagName1 tagValue1 tagName2 tagValue2

Devnet example:

irys upload myImage.png \
  -n devnet \
  -t ethereum \
  -w bf20......c9885307 \
  --tags tagName1 tagValue1 tagName2 tagValue2 \
  --provider-url https://rpc.sepolia.dev

After a successful upload, the CLI returns a transaction ID. Files can be downloaded from the Irys gateway at https://gateway.irys.xyz/[transactionId].

Upload Directory

The upload-dir command uploads an entire directory of files.

OptionDescription
-nSpecifies network (mainnet or devnet), defaults to mainnet
-tDesignates the token used for funding
-wYour private key
--index-fileNames the file serving as an index for manifests
--provider-urlRPC URL to use

Mainnet example:

irys upload-dir ./myImages \
  -t ethereum \
  -w bf20......c9885307

Devnet example:

irys upload-dir ./myImages \
  -n devnet \
  -t ethereum \
  -w bf20......c9885307 \
  --provider-url https://rpc.sepolia.dev

Upon completion, two local files are generated: [folder_name].csv and [folder_name].json containing transaction metadata. Uploaded files can be retrieved via:

https://gateway.irys.xyz/manifestId/:originalFileName
https://gateway.irys.xyz/:transactionId
Note
Note
RPC URLs change often. Use a recent one from chainlist.org.