Onchain Storage
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/cliDepending on your setup, you may need to use the sudo command:
sudo npm i -g @irys/cli--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.
| Option | Description |
|---|---|
-n | The network to check, mainnet or devnet, defaults to mainnet |
-t | The token type for funding |
--provider-url | RPC URL to use |
Mainnet example:
irys balance 0x591B5Ce7cA10a55A9B5d1516eF89693D5b3586b8 \
-t ethereumDevnet example:
irys balance 0x591B5Ce7cA10a55A9B5d1516eF89693D5b3586b8 \
-t ethereum \
-n devnet \
--provider-url https://rpc.sepolia.devPrice
The price command checks the cost to upload a specified number of bytes.
| Option | Description |
|---|---|
-n | The network to check, mainnet or devnet, defaults to mainnet |
-t | Token for funding |
--provider-url | RPC URL to use |
Mainnet example:
irys price 1000000 \
-t ethereumDevnet example:
irys price 1000000 \
-t ethereum \
-n devnet \
--provider-url https://rpc.sepolia.devFund
The fund command funds your Irys account with tokens.
fund will post immediately to your account. Some blockchains are faster than others.| Option | Description |
|---|---|
-n | Specifies network (mainnet or devnet), defaults to mainnet |
-t | Designates the token type for funding |
-w | Your private key |
--provider-url | RPC URL to use |
Mainnet example:
irys fund 1000000000000000 \
-t ethereum \
-w bf20......c9885307Devnet example:
irys fund 1000000000000000 \
-n devnet \
-t ethereum \
-w bf20......c9885307 \
--provider-url https://rpc.sepolia.devWithdraw
The withdraw command withdraws funds from your Irys account.
withdraw will post immediately to your account. Some blockchains are faster than others.| Option | Description |
|---|---|
-n | Specifies network (mainnet or devnet), defaults to mainnet |
-t | Designates the token type for the withdrawal |
-w | Your private key |
--provider-url | RPC URL to use |
Mainnet example:
irys withdraw 1000000000000000 \
-t ethereum \
-w bf20......c9885307Devnet example:
irys withdraw 1000000000000000 \
-n devnet \
-t ethereum \
-w bf20......c9885307 \
--provider-url https://rpc.sepolia.devUpload
The upload command uploads a single file to the Irys network.
| Option | Description |
|---|---|
-n | Network selection: mainnet or devnet (defaults to mainnet) |
-t | Token type for funding the upload |
-w | Your private key |
--tags | Metadata tags in name value format pairs |
--provider-url | RPC URL to use |
Mainnet example:
irys upload myImage.png \
-t ethereum \
-w bf20......c9885307 \
--tags tagName1 tagValue1 tagName2 tagValue2Devnet example:
irys upload myImage.png \
-n devnet \
-t ethereum \
-w bf20......c9885307 \
--tags tagName1 tagValue1 tagName2 tagValue2 \
--provider-url https://rpc.sepolia.devAfter 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.
| Option | Description |
|---|---|
-n | Specifies network (mainnet or devnet), defaults to mainnet |
-t | Designates the token used for funding |
-w | Your private key |
--index-file | Names the file serving as an index for manifests |
--provider-url | RPC URL to use |
Mainnet example:
irys upload-dir ./myImages \
-t ethereum \
-w bf20......c9885307Devnet example:
irys upload-dir ./myImages \
-n devnet \
-t ethereum \
-w bf20......c9885307 \
--provider-url https://rpc.sepolia.devUpon 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