Feed Creation
Anyone can create a data feed on Molpha by connecting an API endpoint to the protocol. This guide walks you through the process.Prerequisites
Before creating a feed, you’ll need:- API Endpoint — A publicly accessible API or protected API with credentials
- JSONPath Selector — Knowledge of how to extract the value from the API response
- Solana Wallet — With USDC for creation fees
- Feed Configuration — Decide on update frequency and subscription duration
Creating a Feed
Step 1: Prepare Your API
Your API should return data in a consistent format. For example:Step 2: Define Your Feed Specification
A feed specification includes:| Field | Description | Example |
|---|---|---|
feedId | Unique identifier | btc-usd |
source | API endpoint URL | https://api.example.com/v1/price |
selector | JSONPath to extract value | $.bitcoin.usd |
transform | Optional transformation | x => parseFloat(x).toFixed(2) |
precision | Decimal places | 2 |
frequency | Update interval (seconds) | 60 |
Step 3: Submit via Dashboard
- Visit the Molpha Dashboard
- Click “Create Feed”
- Fill in your feed specification
- Choose subscription duration (30-365 days)
- Pay creation fee in USDC
Step 4: Verification
After submission:- Verifier nodes start fetching from your API
- Nodes validate and sign results
- Once quorum is reached, feed becomes active
- Updates are published according to your specified frequency
Feed Types
Public API Feeds
Feeds using publicly accessible APIs require no special credentials:- Example: CoinGecko, public weather APIs
- Setup: Just provide the API URL
- Cost: Creation fee + subscription only
Protected API Feeds
Feeds requiring API keys use HashiCorp Vault:- Register API key in Vault (via dashboard)
- Key is encrypted and stored securely
- Verifier nodes fetch credentials automatically
- Keys never touch the blockchain
Feed Management
Updating Feed Configuration
You can update:- Update frequency
- API endpoint (requires re-verification)
- Selector/transform logic
- Subscription extension
Monitoring Feed Status
Dashboard shows:- Last update timestamp
- Current value
- Number of active verifiers
- Uptime percentage
- Recent updates history
Feed Lifecycle
- Draft — Created but not yet active
- Active — Receiving updates from verifiers
- Paused — Temporarily stopped (e.g., expired API key)
- Archived — Subscription expired, no longer updating
Best Practices
API Design
- Stable endpoints — Use consistent API URLs
- Clear structure — JSON responses with predictable schema
- Rate limits — Ensure API can handle update frequency
- Error handling — API should return clear error codes
Selector Design
- Specific paths — Avoid ambiguous selectors
- Consistent format — Value type should be consistent
- Fallback values — Consider API failures
Security
- Use HTTPS — Only use encrypted API endpoints
- Rotate keys — Regularly update API credentials
- Monitor usage — Check API usage in dashboard
- Backup plans — Consider multiple API sources
Examples
Crypto Price Feed
Real-World Asset Feed
Weather Feed
Troubleshooting
Feed Not Updating
- Check API endpoint is accessible
- Verify JSONPath selector is correct
- Ensure API key is valid (for protected APIs)
- Check feed status in dashboard
Incorrect Values
- Verify selector extracts correct value
- Check transformation logic
- Review API response format
- Submit a dispute if needed
High Costs
- Reduce update frequency
- Use public APIs when possible
- Choose shorter subscription periods
- Consider batch updates for multiple feeds
Next Steps
- Protocol Overview — Understand the architecture
- Economics — Learn about pricing and rewards
- Quick Start — Create your first feed
- Development Guide — Integrate feeds into your app