A simple command-line tool to test the Blossom blob storage service by performing upload, fetch, and delete operations.
# From the repository root
CGO_ENABLED=0 go build -o cmd/blossomtest/blossomtest ./cmd/blossomtest
# Basic usage with auto-generated key
./cmd/blossomtest/blossomtest
# Specify relay URL
./cmd/blossomtest/blossomtest -url http://localhost:3334
# Use a specific Nostr key (nsec format)
./cmd/blossomtest/blossomtest -nsec nsec1...
# Test with larger blob
./cmd/blossomtest/blossomtest -size 10240
# Verbose output to see HTTP requests and auth events
./cmd/blossomtest/blossomtest -v
# Test anonymous uploads (for open relays)
./cmd/blossomtest/blossomtest -no-auth
-url - Relay base URL (default: http://localhost:3334)-nsec - Nostr private key in nsec format (generates new key if not provided)-size - Size of test blob in bytes (default: 1024)-v - Verbose output showing HTTP requests and authentication events-no-auth - Skip authentication and test anonymous uploads (useful for open relays)The tool performs the following operations in sequence:
- Creates a Blossom authorization event (kind 24242)
- Sends a PUT request to /blossom/upload
- Verifies the returned descriptor
- Sends a GET request to /blossom/<sha256>
- Verifies the data matches what was uploaded
- Creates another authorization event for deletion
- Sends a DELETE request to /blossom/<sha256>
- Attempts to fetch the blob again - Expects a 404 Not Found response
đ¸ Blossom Test Tool
===================
âšī¸ No key provided, generated new keypair
Using identity: npub1...
Relay URL: http://localhost:3334
đĻ Generated 1024 bytes of random data
SHA256: a1b2c3d4...
đ¤ Step 1: Uploading blob...
â
Upload successful!
URL: http://localhost:3334/blossom/a1b2c3d4...
SHA256: a1b2c3d4...
Size: 1024 bytes
đĨ Step 2: Fetching blob...
â
Fetch successful! Retrieved 1024 bytes
â
Data verification passed - hashes match!
đī¸ Step 3: Deleting blob...
â
Delete successful!
đ Step 4: Verifying deletion...
â
Blob successfully deleted - returns 404 as expected
đ All tests passed! Blossom service is working correctly.
"connection refused"
http://localhost:3334)"unauthorized" or "403 Forbidden"
ORLY_AUTH_TO_WRITE=true, make sure authentication is workingORLY_ADMINS if using follows mode"blossom server not initialized"
ORLY_DB_TYPE is set to badger or not set (defaults to badger)