A Go-based HTTP gateway providing REST API access to the Züs decentralized storage network. This microservice enables developers to integrate Züs storage capabilities into applications written in any programming language through simple HTTP requests.
- Language Agnostic: Integrate Züs storage from JavaScript, Python, Ruby, or any language with HTTP support
- Reliable: Built on the stable Züs gosdk
- Secure: Credentials managed server-side, never exposed to clients
- Simple REST API: Easy-to-use HTTP endpoints for storage operations
POST /init-sdkInitializes the Züs SDK with wallet credentials and network configuration.
POST /upload-file
Content-Type: application/json
{
"allocation_id": "your-allocation-id",
"local_path": "/path/to/file.jpg",
"encrypt": true,
"web_streaming": false
}Uploads a file to the Züs network and returns an auth ticket for sharing.
POST /download-file
Content-Type: application/json
{
"allocation_id": "your-allocation-id",
"filename": "file.jpg",
"auth_ticket": "auth-ticket-string",
"local_path": "/path/to/save/file.jpg"
}Downloads a file from the Züs network using an auth ticket.
- Go 1.23.4 or higher
- Züs wallet (create one at using zwalletcli
- Züs allocation ID (create one using zboxcli
-
Clone the repository
git clone https://github.com/YOUR_USERNAME/zus-storage-api.git cd zus-storage-api -
Install dependencies
go mod download
-
Configure credentials
The service uses
config.yamlfor configuration. An example is provided inconfig.example.yaml.For wallet configuration, you'll need to set up your Züs wallet separately and ensure the SDK can access it from
~/.zcn/directory. -
Run the service
go run main.go
The service will start on
http://localhost:8080
// Initialize SDK
const initResponse = await fetch('http://localhost:8080/init-sdk', {
method: 'POST'
});
// Upload a file
const uploadResponse = await fetch('http://localhost:8080/upload-file', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
allocation_id: 'your-allocation-id',
local_path: './photo.jpg',
encrypt: true,
web_streaming: false
})
});
const { auth_ticket } = await uploadResponse.json();
console.log('File uploaded! Auth ticket:', auth_ticket);import requests
# Initialize SDK
requests.post('http://localhost:8080/init-sdk')
# Upload a file
response = requests.post('http://localhost:8080/upload-file', json={
'allocation_id': 'your-allocation-id',
'local_path': './photo.jpg',
'encrypt': True,
'web_streaming': False
})
auth_ticket = response.json()['auth_ticket']
print(f'File uploaded! Auth ticket: {auth_ticket}')# Initialize SDK
curl -X POST http://localhost:8080/init-sdk
# Upload a file
curl -X POST http://localhost:8080/upload-file \
-H "Content-Type: application/json" \
-d '{
"allocation_id": "your-allocation-id",
"local_path": "./photo.jpg",
"encrypt": true,
"web_streaming": false
}'The config.yaml file contains network and SDK settings:
block_worker: Züs network DNS endpointchain_id: Blockchain network identifiersignature_scheme: Cryptographic signature scheme (bls0chain)min_submit: Minimum blobbers for submissionmin_confirmation: Minimum confirmations requiredconfirmation_chain_length: Chain length for confirmationssharder_consensous: Sharder consensus requirementmax_txn_query: Maximum transaction queriesquery_sleep_time: Query sleep time in seconds
.
├── main.go # HTTP server and route configuration
├── handlers/
│ ├── sdk_handler.go # SDK initialization endpoint
│ ├── upload_handler.go # File upload endpoint
│ └── download_handler.go # File download endpoint
├── config.yaml # Network configuration
├── config.example.yaml # Configuration template
└── README.md
- Web Applications: Backend API for browser-based file storage
- Data Pipelines: Python/Ruby scripts storing data on Züs
- Mobile Apps: iOS/Android apps integrating decentralized storage
- Enterprise Systems: Multi-language environments requiring Züs integration
- Store wallet files securely in
~/.zcn/directory - Use HTTPS in production deployments
- Implement authentication/authorization for production use
- Consider rate limiting for public-facing deployments
- Never expose wallet credentials to clients
Contributions are welcome! Please feel free to submit a Pull Request.
See LICENSE file for details.
For issues and questions:
- Open an issue on GitHub
- Visit Züs Discord