moralis-streams-api
Real-time blockchain event monitoring with webhooks. Use when user asks about setting up webhooks, real-time event streaming, monitoring wallet addresses, tracking token transfers in real-time, listening to all addresses on a chain, creating/updating/deleting streams, adding/removing addresses from streams, or receiving blockchain events as they happen. Supports all EVM chains. NOT for querying historical or current blockchain state - use moralis-data-api instead.
Best use case
moralis-streams-api is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Real-time blockchain event monitoring with webhooks. Use when user asks about setting up webhooks, real-time event streaming, monitoring wallet addresses, tracking token transfers in real-time, listening to all addresses on a chain, creating/updating/deleting streams, adding/removing addresses from streams, or receiving blockchain events as they happen. Supports all EVM chains. NOT for querying historical or current blockchain state - use moralis-data-api instead.
Teams using moralis-streams-api should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/moralis-streams-api/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How moralis-streams-api Compares
| Feature / Agent | moralis-streams-api | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Real-time blockchain event monitoring with webhooks. Use when user asks about setting up webhooks, real-time event streaming, monitoring wallet addresses, tracking token transfers in real-time, listening to all addresses on a chain, creating/updating/deleting streams, adding/removing addresses from streams, or receiving blockchain events as they happen. Supports all EVM chains. NOT for querying historical or current blockchain state - use moralis-data-api instead.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
## CRITICAL: Read Rule Files Before Implementing
**The #1 cause of bugs is using wrong HTTP methods or stream configurations.**
For EVERY endpoint:
1. Read `rules/{EndpointName}.md`
2. Check HTTP method (PUT for create, POST for update, DELETE for delete)
3. Verify stream ID format (UUID, not hex)
4. Use hex chain IDs (0x1, 0x89), not names (eth, polygon)
**Reading Order:**
1. This SKILL.md (core patterns)
2. Endpoint rule file in `rules/`
3. Pattern references in `references/` (for edge cases only)
---
## Setup
### API Key (optional)
**Never ask the user to paste their API key into the chat.** Instead:
1. Check if `MORALIS_API_KEY` is set in the environment (try running `[ -n "$MORALIS_API_KEY" ] && echo "API key is set" || echo "API key is NOT set"`).
2. If not set, offer to create the `.env` file with an empty placeholder: `MORALIS_API_KEY=`
3. Tell the user to open the `.env` file and paste their key there themselves.
4. Let them know: without the key, you won't be able to test or call the Moralis API on their behalf.
If they don't have a key yet, point them to [admin.moralis.com/register](https://admin.moralis.com/register) (free, no credit card).
### Environment Variable Discovery
The `.env` file location depends on how skills are installed:
Create the `.env` file in the project root (same directory the user runs Claude Code from). Make sure `.env` is in `.gitignore`.
### Verify Your Key
```bash
curl "https://api.moralis-streams.com/streams/evm?limit=10" \
-H "X-API-Key: $MORALIS_API_KEY"
```
---
## Base URL
```
https://api.moralis-streams.com
```
**Important:** Different from Data API (`deep-index.moralis.io`).
## Authentication
All requests require: `X-API-Key: $MORALIS_API_KEY`
---
## HTTP Methods (CRITICAL)
| Action | Method | Endpoint |
|--------|--------|----------|
| Create stream | `PUT` | `/streams/evm` |
| Update stream | `POST` | `/streams/evm/{id}` |
| Delete stream | `DELETE` | `/streams/evm/{id}` |
| Get streams | `GET` | `/streams/evm` |
| Replace addresses | `PATCH` | `/streams/evm/{id}/address` |
**Common mistake:** Using POST to create streams. Use PUT instead.
---
## Stream Types
| Type | Description |
|------|-------------|
| `tx` | Native transactions |
| `log` | Contract event logs |
| `erc20transfer` | ERC20 token transfers |
| `erc20approval` | ERC20 approvals |
| `nfttransfer` | NFT transfers |
| `internalTx` | Internal transactions |
---
## Quick Reference: Most Common Patterns
### Stream ID Format (ALWAYS UUID)
```typescript
// WRONG - Hex format
"0x1234567890abcdef"
// CORRECT - UUID format
"a1b2c3d4-e5f6-7890-abcd-ef1234567890"
```
### Chain IDs (ALWAYS hex)
```typescript
"0x1" // Ethereum
"0x89" // Polygon
"0x38" // BSC
"0xa4b1" // Arbitrum
"0xa" // Optimism
"0x2105" // Base
```
### Event Signatures (topic0)
```typescript
"Transfer(address,address,uint256)" // ERC20/NFT Transfer
"Approval(address,address,uint256)" // ERC20 Approval
```
### Status Values (lowercase only)
```typescript
"active" // CORRECT - normal operating state
"paused" // CORRECT - manually paused
"error" // CORRECT - auto-set when webhook success rate <70%
"terminated" // CORRECT - unrecoverable, after 24h in error
"ACTIVE" // WRONG
```
---
## Common Pitfalls (Top 5)
1. **Using POST to create streams** - Use `PUT` instead
2. **Wrong base URL** - Use `api.moralis-streams.com`, NOT `deep-index.moralis.io`
3. **Hex stream ID** - Must be UUID format, not hex
4. **String chain names** - Use hex (0x1), not names (eth)
5. **Uppercase status** - Use lowercase ("active", "paused")
6. **Not returning 200 on test webhook** - Stream won't start unless your endpoint returns 2xx on the test webhook sent during create/update
See [references/CommonPitfalls.md](references/CommonPitfalls.md) for complete reference.
---
## Triggers (Read-Only Contract Calls)
Enrich webhook data with on-chain reads (e.g., `balanceOf`). Triggers execute `view`/`pure` functions and attach results to webhook events. Supports dynamic selectors (`$contract`, `$from`, `$to`). See [references/Triggers.md](references/Triggers.md) for complete reference with examples.
---
## Native Balances in Webhooks
Configure `getNativeBalances` to include native token balances (ETH, BNB, etc.) in webhook payloads. Requires Business plan+. See [references/UsefulStreamOptions.md](references/UsefulStreamOptions.md) for configuration details.
---
## Delivery and Error Handling
- **Two webhooks per event**: Unconfirmed (`confirmed: false`) + Confirmed (`confirmed: true`). Idempotent handlers required.
- **Streams auto-terminate after 24 hours in error state** (webhook success rate <70%). This is **unrecoverable** — you must create a new stream.
- **Test webhook**: Sent on every create/update. Must return 200 or stream won't start.
See [references/DeliveryGuarantees.md](references/DeliveryGuarantees.md) and [references/ErrorHandling.md](references/ErrorHandling.md).
---
## Webhook Security
Webhooks are signed with your streams secret (different from API key).
- **Header:** `x-signature`
- **Algorithm:** `sha3(JSON.stringify(body) + secret)`
```javascript
const verifySignature = (req, secret) => {
const provided = req.headers["x-signature"];
const generated = web3.utils.sha3(JSON.stringify(req.body) + secret);
if (generated !== provided) throw new Error("Invalid Signature");
};
```
See [references/WebhookSecurity.md](references/WebhookSecurity.md) for complete examples.
---
## Testing Endpoints
```bash
WEBHOOK_URL="https://your-server.com/webhook"
# List streams (requires limit)
curl "https://api.moralis-streams.com/streams/evm?limit=100" \
-H "X-API-Key: $MORALIS_API_KEY"
# Create stream (PUT, not POST)
curl -X PUT "https://api.moralis-streams.com/streams/evm" \
-H "X-API-Key: $MORALIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"webhookUrl": "'${WEBHOOK_URL}'",
"description": "Test stream",
"tag": "test",
"topic0": ["Transfer(address,address,uint256)"],
"allAddresses": false,
"chainIds": ["0x1"]
}'
# Pause stream (POST to status)
curl -X POST "https://api.moralis-streams.com/streams/evm/<stream_id>/status" \
-H "X-API-Key: $MORALIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"status": "paused"}'
```
---
## Quick Troubleshooting
| Issue | Cause | Solution |
|-------|-------|----------|
| "400 Bad Request" | Invalid config | Check webhookUrl, topic0 format, chainIds |
| "404 Not Found" | Wrong stream ID | Verify UUID format |
| "Method Not Allowed" | Wrong HTTP method | PUT for create, POST for update |
| "Missing limit" | GET /streams/evm | Add `?limit=100` |
| "No webhooks" | Stream paused | Check status is "active" |
---
## Endpoint Catalog
Complete list of all 20 Streams API endpoints organized by category.
### Stream Management
Create, update, delete, and manage streams.
| Endpoint | Description |
|----------|-------------|
| [AddAddressToStream](rules/AddAddressToStream.md) | Add address to stream |
| [CreateStream](rules/CreateStream.md) | Create stream |
| [DeleteAddressFromStream](rules/DeleteAddressFromStream.md) | Delete address from stream |
| [DeleteStream](rules/DeleteStream.md) | Delete stream |
| [DuplicateStream](rules/DuplicateStream.md) | Duplicate stream |
| [GetAddresses](rules/GetAddresses.md) | Get addresses by stream |
| [GetHistory](rules/GetHistory.md) | Get history |
| [GetLogs](rules/GetLogs.md) | Get logs |
| [GetSettings](rules/GetSettings.md) | Get project settings |
| [GetStats](rules/GetStats.md) | Get project stats |
| [GetStatsByStreamId](rules/GetStatsByStreamId.md) | Get project stats by Stream ID |
| [GetStream](rules/GetStream.md) | Get a specific evm stream. |
| [GetStreamBlockDataByNumber](rules/GetStreamBlockDataByNumber.md) | Get webhook data returned on the block number with provided stream config |
| [GetStreamBlockDataToWebhookByNumber](rules/GetStreamBlockDataToWebhookByNumber.md) | Send webhook based on a specific block number using stream config and addresses. |
| [GetStreams](rules/GetStreams.md) | Get streams |
| [ReplaceAddressFromStream](rules/ReplaceAddressFromStream.md) | Replaces address from stream |
| [UpdateStream](rules/UpdateStream.md) | Update stream |
| [UpdateStreamStatus](rules/UpdateStreamStatus.md) | Update stream status |
### Status & Settings
Pause/resume streams and configure settings.
| Endpoint | Description |
|----------|-------------|
| [SetSettings](rules/SetSettings.md) | Set project settings |
### History & Analytics
Stream history, replay, statistics, logs, and block data.
| Endpoint | Description |
|----------|-------------|
| [ReplayHistory](rules/ReplayHistory.md) | Replay history |
## Listen to All Addresses
Set `allAddresses: true` with a `topic0` and `abi` to monitor an event across every contract on a chain (e.g., all ERC20 transfers network-wide). Requires higher-tier plans. See [references/ListenToAllAddresses.md](references/ListenToAllAddresses.md) for complete examples, ABI templates, and gotchas.
## Example: Create ERC20 Transfer Monitor
```bash
curl -X PUT "https://api.moralis-streams.com/streams/evm" \
-H "X-API-Key: $MORALIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"webhookUrl": "https://your-server.com/webhook",
"description": "Monitor ERC20 transfers",
"tag": "erc20-monitor",
"topic0": ["Transfer(address,address,uint256)"],
"allAddresses": true,
"chainIds": ["0x1", "0x89"],
"advancedOptions": [{
"topic0": "Transfer(address,address,uint256)",
"includeNativeHash": true
}]
}'
```
---
## Pagination
List endpoints use cursor-based pagination:
```bash
# First page
curl "...?limit=100" -H "X-API-Key: $KEY"
# Next page
curl "...?limit=100&cursor=<cursor>" -H "X-API-Key: $KEY"
```
---
## Supported Chains
All major EVM chains: Ethereum (0x1), Polygon (0x89), BSC (0x38), Arbitrum (0xa4b1), Optimism (0xa), Base (0x2105), Avalanche (0xa86a), and more.
See [references/StreamConfiguration.md](references/StreamConfiguration.md) for complete chain ID list.
---
## Reference Documentation
- [references/CommonPitfalls.md](references/CommonPitfalls.md) - Complete pitfalls reference
- [references/DeliveryGuarantees.md](references/DeliveryGuarantees.md) - At-least-once delivery, dual webhooks, confirmation blocks, test webhooks
- [references/ErrorHandling.md](references/ErrorHandling.md) - Retry schedule, error/terminated states, rate limits, re-org handling
- [references/FAQ.md](references/FAQ.md) - Streams API frequently asked questions
- [references/FilterStreams.md](references/FilterStreams.md) - Webhook data filtering to reduce noise
- [references/ListenToAllAddresses.md](references/ListenToAllAddresses.md) - Monitor events across all contracts on a chain
- [references/MonitorMultipleAddresses.md](references/MonitorMultipleAddresses.md) - Multi-address monitoring patterns
- [references/ReplayFailedWebhooks.md](references/ReplayFailedWebhooks.md) - Replay failed webhook guide
- [references/StreamConfiguration.md](references/StreamConfiguration.md) - Stream config reference
- [references/Triggers.md](references/Triggers.md) - Read-only contract call enrichment (balanceOf, etc.)
- [references/Tutorials.md](references/Tutorials.md) - Real-world examples and tutorials
- [references/UsefulStreamOptions.md](references/UsefulStreamOptions.md) - Advanced stream configuration options
- [references/WebhookResponseBody.md](references/WebhookResponseBody.md) - Webhook payload structure
- [references/WebhookSecurity.md](references/WebhookSecurity.md) - Signature verification
---
## See Also
- Endpoint rules: `rules/*.md` files
- Data API: @moralis-data-api for querying blockchain stateRelated Skills
moralis
Moralis — Web3 data, token prices, wallet history, NFTs, DeFi positions, and blockchain events.
moralis-data-api
Query Web3 blockchain data from Moralis API. Use when user asks about wallet data (balances, tokens, NFTs, transaction history, profitability, net worth), token data (prices, metadata, DEX pairs, analytics, security scores), NFT data (metadata, transfers, traits, rarity, floor prices), DeFi positions, entity/label data for exchanges and funds, or block and transaction data. Supports EVM chains (Ethereum, Polygon, BSC, Arbitrum, Base, Optimism, Avalanche, etc.) and Solana. NOT for real-time streaming - use moralis-streams-api instead.
moralis-openapi-skill
Operate Moralis EVM wallet and token reads through UXC with a curated OpenAPI schema, API-key auth, and wallet-intelligence guardrails.
8004-skill
ERC-8004 Trustless Agents - Register and manage AI agent identities on TRON and BSC blockchains with on-chain reputation tracking
8004-MCP - Agent Registry Protocol
Multi-chain MCP server for ERC-8004 Agent Registry. Query agents, reputation, and feedback across Solana + EVM chains.
supurr
Backtest, deploy, and monitor trading bots on Hyperliquid. Supports Grid, DCA, and Spot-Perp Arbitrage strategies across Native Perps, Spot markets (USDC/USDH), and HIP-3 sub-DEXes.
senpi-skills
Agent Skills for autonomous crypto trading on Hyperliquid — trailing stops, market scanning, position management, and more.
sdks
Official Azex SDKs — TypeScript, Python, MCP Server, CLI for the crypto-native LLM API gateway
perp-cli
Multi-DEX perpetual futures CLI + MCP server — Pacifica (Solana), Hyperliquid, Lighter (Ethereum). 18 MCP tools for AI-powered trading
okx-exchange-websocket-skill
Subscribe to OKX public exchange WebSocket channels through UXC raw WebSocket mode for ticker, trade, book, and candle events with explicit subscribe frames.
okx-wallet-portfolio
This skill should be used when the user asks to 'check my wallet balance', 'show my token holdings', 'how much OKB do I have', 'what tokens do I have', 'check my portfolio value', 'view my assets', 'how much is my portfolio worth', 'what\'s in my wallet', or mentions checking wallet balance, total assets, token holdings, portfolio value, remaining funds, DeFi positions, or multi-chain balance lookup. Supports XLayer, Solana, Ethereum, Base, BSC, Arbitrum, Polygon, and 20+ other chains. Do NOT use for general programming questions about balance variables or API documentation. Do NOT use when the user is asking how to build or integrate a balance feature into code.
okx-security
Use this skill for security scanning: check transaction safety, is this transaction safe, pre-execution check, security scan, token risk scanning, honeypot detection, DApp/URL phishing detection, message signature safety, malicious transaction detection, approval safety checks, token approval management. Triggers: 'is this token safe', 'check token security', 'honeypot check', 'scan this tx', 'scan this swap tx', 'tx risk check', 'is this URL a scam', 'check if this dapp is safe', 'phishing site check', 'is this signature safe', 'check this signing request', 'check my approvals', 'show risky approvals', 'revoke approval', 'check if this approve is safe', token authorization, ERC20 allowance, Permit2. Covers token-scan, dapp-scan, tx-scan (EVM+Solana pre-execution), sig-scan (EIP-712/personal_sign), approvals (ERC-20/Permit2). Chinese: 安全扫描, 代币安全, 蜜罐检测, 貔貅盘, 钓鱼网站, 交易安全, 签名安全, 代币风险, 授权管理, 授权查询, 风险授权, 代币授权. Do NOT use for wallet balance/send/history — use okx-agentic-wallet.