Skip to main content
OnchainDB provides multiple layers of security including wallet-based authentication, spend authorization (authz), and encryption settings for your applications.

Wallet Authentication

OnchainDB Dashboard uses Keplr wallet for authentication. This ensures that only the wallet owner can manage their applications and API keys.

Connecting Your Wallet

  1. Install the Keplr wallet extension
  2. Navigate to dashboard.onchaindb.io
  3. Click Connect Wallet
  4. Approve the connection request in Keplr
  5. Your wallet address is now linked to your session
OnchainDB supports both Celestia Mainnet and Celestia Mocha Testnet. The network is automatically detected from your Keplr configuration.

Session Management

After connecting your wallet, a secure session is created:
  • Session Duration: 10 minutes
  • Auto-Renewal: Sessions automatically renew when you sign a new message
  • Secure Storage: Session tokens are stored in httpOnly cookies
When your session expires, you’ll be prompted to sign a message with Keplr to verify your identity and create a new session.

Request Signing

All sensitive operations require cryptographic signature verification:
HeaderDescription
X-Wallet-AddressYour wallet address
X-TimestampRequest timestamp (5-minute validity window)
X-SignatureBase64-encoded signature
X-PubkeyYour public key (base64-encoded)
This ensures that requests cannot be forged or replayed.

Spend Authorization (Authz)

Authz grants allow you to authorize the OnchainDB broker to execute payments on your behalf, enabling the Auto-Pay feature.

What is Authz?

Authz is a Cosmos SDK feature that lets you grant another address permission to execute specific transactions. For OnchainDB, this means:
  • The broker can deduct payments automatically for data operations
  • You don’t need to sign each individual transaction
  • Transactions are limited by your configured spend limit
  • Grants expire after one year

Setting Up Auto-Pay

1

Connect Wallet

Connect your Keplr wallet to the Dashboard
2

Configure Spend Limit

Enter your maximum spend limit in TIA (default: 10 TIA)
3

Grant Authorization

Click “Enable Auto-Pay” and approve the transaction in Keplr
4

Verify Status

Check that the green “Auto-Pay Enabled” badge appears

Authz Status Indicators

StatusBadge ColorDescription
EnabledGreenAuto-Pay is active with remaining balance
DisabledYellowNo authz grant, manual payments required
Low BalanceOrangeRemaining limit below threshold
ExpiredRedGrant has expired, needs renewal

Managing Your Authorization

From the Dashboard, you can:
  • View remaining limit: See how much of your spend authorization remains
  • Increase limit: Grant additional spend authorization
  • Revoke grant: Remove the broker’s authorization to spend on your behalf
Revoking your authz grant will disable Auto-Pay. You’ll need to provide payment proofs manually for all operations.

On-Chain Verification

Critical operations require on-chain transaction verification to prove wallet ownership:

Operations Requiring Verification

OperationTransaction MemoFee
Generate API Keyregenerate_key:{appId}~0.001 TIA
Revoke API Keyrevoke_key:{appId}:{keyHash}~0.001 TIA
List API Keyslist_keys:{appId}~0.001 TIA
Update Encryptionupdate_encryption:{appId}~0.001 TIA
This ensures that even if a session is compromised, attackers cannot modify your API keys without access to your wallet.

Verification Flow

Encryption Settings

OnchainDB supports encryption for sensitive data at both the application and collection level.

Private Application

Making your application private encrypts all data by default:
  1. Go to your app’s Encryption tab
  2. Toggle Private App on
  3. Approve the on-chain verification transaction

Private Collections

You can also encrypt specific collections while keeping others public:
  1. Navigate to the Encryption tab
  2. Select collections to encrypt
  3. Save changes and approve the transaction
Use collection-level encryption when you need some public data (e.g., product listings) alongside private data (e.g., user preferences).

App Ownership

Each OnchainDB application is linked to a wallet address. Only the owner can:
  • Generate, list, or revoke API keys
  • Modify encryption settings
  • Update app configuration
  • View usage analytics

Ownership Verification

The Dashboard verifies ownership by:
  1. Checking your connected wallet address
  2. Comparing against the app’s owner_wallet field
  3. Returning 403 Forbidden if addresses don’t match
Application ownership cannot be transferred. To change ownership, create a new application with the desired wallet.

API Key Security

Key Format

App Keys are cryptographically generated tokens:
  • Length: 64 characters
  • Format: Alphanumeric with special characters
  • Storage: Only the hash is stored server-side

Key Headers

When making API requests, include the appropriate headers:
curl -X POST https://api.onchaindb.io/v1/store \
  -H "X-App-Key: your_app_key_here" \
  -H "X-User-Key: optional_user_key_for_auto_pay" \
  -H "Content-Type: application/json" \
  -d '{"collection": "posts", "data": [{"title": "Hello"}]}'

Security Implementation

FeatureImplementation
httpOnly CookiesSession tokens protected from XSS
HMAC SigningToken integrity verification
Timestamp Validation5-minute replay attack window
On-Chain VerificationWallet ownership proof
Immediate InvalidationRevoked keys stop working instantly
One-Time DisplayKeys shown once, never stored in plaintext

Troubleshooting

Session Expired

If you see “Session Expired” errors:
  1. Sign the authentication message in Keplr
  2. Your session will automatically renew
  3. The original request will be retried

Authorization Failed

If you receive 403 Forbidden errors:
  • Verify you’re connected with the correct wallet
  • Check that you own the application
  • Ensure your session hasn’t expired

Auto-Pay Not Working

If automatic payments aren’t working:
  1. Check your authz status in the Dashboard
  2. Verify remaining spend limit is sufficient
  3. Ensure the grant hasn’t expired
  4. Confirm the user key is correctly configured

Next Steps