Upload data to distributed storage
const url = 'http://localhost:8080/api/v1/storage/upload';const options = { method: 'POST', headers: {'X-Signature': '<X-Signature>', 'Content-Type': 'application/json'}, body: '{"userAddr":"0x1234567890123456789012345678901234567890","chunkID":1,"data":"SGVsbG8gV29ybGQh"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/api/v1/storage/upload \ --header 'Content-Type: application/json' \ --header 'X-Signature: <X-Signature>' \ --data '{ "userAddr": "0x1234567890123456789012345678901234567890", "chunkID": 1, "data": "SGVsbG8gV29ybGQh" }'Upload encrypted data to the distributed mesh storage network. Data is automatically encrypted (if not already encrypted) and distributed across multiple nodes using Reed-Solomon erasure coding for fault tolerance.
Authentication: Requires Ethereum wallet signature (X-Signature and X-Timestamp headers)
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”object
Ethereum address (42 characters, 0x prefix)
Chunk identifier (0 or positive integer)
Base64-encoded data to store
Optional wallet signature for encryption key derivation
Optional password for encryption (alternative to signature)
True if data is already client-encrypted
Examples
Basic upload with wallet-derived encryption
{ "userAddr": "0x1234567890123456789012345678901234567890", "chunkID": 1, "data": "SGVsbG8gV29ybGQh"}Upload with signature-based encryption
{ "userAddr": "0x1234567890123456789012345678901234567890", "chunkID": 1, "data": "SGVsbG8gV29ybGQh", "signature": "0xabc..."}Upload pre-encrypted data
{ "userAddr": "0x1234567890123456789012345678901234567890", "chunkID": 1, "data": "SGVsbG8gV29ybGQh", "encrypted": true}Responses
Section titled “Responses”Upload successful
object
Original data size in bytes
Encrypted data size in bytes
Number of shards created
Size of each shard in bytes
List of node IDs storing the shards
Redundancy ratio
Number of shards that can be lost
Whether data is encrypted
Encryption method used
Upload timestamp
object
Index of the shard
Node ID storing this shard
Network addresses of the node
Example
{ "success": true, "userAddr": "0x1234567890123456789012345678901234567890", "chunkID": 1, "originalSizeBytes": 1024, "encryptedSizeBytes": 1040, "shardCount": 15, "shardSizeBytes": 70, "storageNodes": [ "QmNode1...", "QmNode2..." ], "redundancy": 1.5, "faultTolerance": 5, "encrypted": true, "encryptionInfo": "AES-256-GCM (wallet-derived)", "uploadedAt": "2025-12-10T12:00:00Z", "shardLocations": [ { "shardIndex": 0, "nodeId": "QmNode1...", "addresses": [ "/ip4/192.168.1.1/tcp/9000" ] } ]}Bad Request - Invalid parameters
object
Error type
Human-readable error description
Optional error code
Example
{ "error": "Invalid request", "message": "User address must be a valid Ethereum address (0x...)"}Unauthorized - Authentication failed
object
Error type
Human-readable error description
Optional error code
Example
{ "error": "Authentication failed", "message": "Invalid signature or expired timestamp"}Too Many Requests - Rate limit exceeded
object
Error type
Human-readable error description
Optional error code
Example
{ "error": "Rate limit exceeded", "message": "Maximum 100 requests per minute"}Headers
Section titled “Headers”Example
100Request limit per minute
Example
0Remaining requests in current window
Example
1702234620Unix timestamp when rate limit resets
Internal Server Error
object
Error type
Human-readable error description
Optional error code
Example
{ "error": "Internal server error", "message": "An unexpected error occurred"}