We provided a client tool if you want to directly interact with the storage node.
Copy
git clone <https://github.com/0glabs/0g-storage-client.git>
Copy
cd 0g-storage-client
go build
Copy
# file upload
./0g-storage-client upload --url <blockchain_rpc_endpoint> --contract <log_contract_address> --key <private_key> --node <storage_node_rpc_endpoint> --file <file_path>
# file download
./0g-storage-client download --node <storage_node_rpc_endpoint> --root <file_root_hash> --file <output_file_path>
# file download with verfication
./0g-storage-client download --node <storage_node_rpc_endpoint> --root <file_root_hash> --file <output_file_path> --proof
Check Contract Addresses for log contract address.
Note: You need to have the file root in order to download the file
For the storage node rpc endpoint, you could use the team deployed https://rpc-storage-testnet.0g.ai or you could deploy yourself by following the above instructions.
During download, the file_root_hash
can be retrieved from these places
Data merkle root calculated root=
.Overview -> File Hash
in the tx detail page.My command fails to execute with error Transaction execution failed
Try to set a higher gas limit with --gas-limit
. For the reason why you need to set a customized gas limit, check the Ethereum EIP-150.