You need to provide the contract address (-a <address>), chain ID (-c <chain-id>), private key (-p <private-key>), and the type of upload (-t <upload-type>).
Notice that you have 2 options to specify the file upload type: calldata, blob. The default type is blob which requires network support for EIP-4844.
If the part -c <chain-id> is omitted, Ethereum Mainnet will be specified by default.
Example: SWC Beta
ethfs-cli upload -f dist -a 0xab351F35B82B20C1a253ae16523c5E2D60B56D6E -c 3335 -p 0x112233...
Example log:
providerUrl = https://rpc.beta.testnet.l2.quarkchain.io:8545
chainId = 3335
address = 0xab351F35B82B20C1a253ae16523c5E2D60B56D6E
threadPoolSize = 15
FlatDirectory: The transaction hash for chunk 0 is 0x2526108470cb100837ac1a724df91c9ba3d1422fb2e45fec458cc3f566d5f210 hello.txt
FlatDirectory: Chunks 0 have been uploaded hello.txt
FlatDirectory: The transaction hash for chunks 0,1,2 is 0xfec795480524f81964e62251e8ac7d0f0dc9ed8422bc96a300254377043d3721 img/1.jpeg
FlatDirectory: Chunks 0,1,2 have been uploaded img/1.jpeg
Total File Count: 2
Total Upload Chunk Count: 4
Total Upload Data Size: 324.1015625 KB
Total Storage Cost: 2.259012840557991428 ETH
providerUrl = https://rpc.sepolia.org
chainId = 11155111
address: 0x2f7696D4284358A2E8fDb4DF772dAd60c2c8fbAd
FlatDirectory: The transaction hash for chunk 0 is 0x809411aeb708023a33dadf17791d994dc3b4b2db1a6bbd36792bbedb68646978 img/1.jpeg
FlatDirectory: Chunks 0 have been uploaded hello.txt
FlatDirectory: The transaction hash for chunk 0 is 0x7cea7ea7e4898e03bee4fbc031799689dbe215bd6dd36733721150a099680be7 hello.txt
FlatDirectory: Chunks 0 have been uploaded img/1.jpeg
Total File Count: 2
Total Upload Chunk Count: 2
Total Upload Data size: 52.6513671875 KB
Total Storage Cost: 0.001492087764775451 ETH
Step 4: Download Your File!
Now you should be able to download the file you just uploaded.
Command Syntax
ethfs-cli download -a <address> -c <chain-id> -f <file>
Example: SWC Beta
ethfs-cli download -a 0xab351F35B82B20C1a253ae16523c5E2D60B56D6E -c 3335 -f img/1.jpeg
Example: Sepolia
ethfs-cli download -a 0x2f7696D4284358A2E8fDb4DF772dAd60c2c8fbAd -c 11155111 -f img/1.jpeg
Now, your file has been saved locally.
Step 5: Access Your File via web3://
Of course, you can also easily access the file you just uploaded using the web3:// protocol.
Example: SWC Beta
Example: Sepolia
Note: In the above URLs, you may need to specify a different chain ID than the one used in the ethfs-cli commands. This distinct chain ID is necessary for identifying the EthStorage network responsible for storing the files.
Optional: Using Your Own RPC Endpoint
You can also specify your own RPC for better performance by -r flag in the above steps.