8
n8n 中文网amn8n.com

区块链监控器

中级

这是一个Crypto Trading, AI Summarization领域的自动化工作流,包含 14 个节点。主要使用 If, Code, Slack, Webhook, ScrapegraphAi 等节点。 基于ScrapeGraphAI风险检测的区块链监控器,即时警报和Slack通知

前置要求
  • Slack Bot Token 或 Webhook URL
  • HTTP Webhook 端点(n8n 会自动生成)
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "VhEwspDqzu7ssFVE",
  "meta": {
    "instanceId": "f4b0efaa33080e7774e0d9285c40c7abcd2c6f7cf1a8b901fa7106170dd4cda3",
    "templateCredsSetupCompleted": true
  },
  "name": "我的工作流 2",
  "tags": [
    {
      "id": "DxXGubfBzRKh6L8T",
      "name": "Revenue Optimization",
      "createdAt": "2025-07-25T16:24:30.370Z",
      "updatedAt": "2025-07-25T16:24:30.370Z"
    },
    {
      "id": "IxkcJ2IpYIxivoHV",
      "name": "Content Strategy",
      "createdAt": "2025-07-25T12:57:37.677Z",
      "updatedAt": "2025-07-25T12:57:37.677Z"
    },
    {
      "id": "PAKIJ2Mm9EvRcR3u",
      "name": "Trend Monitoring",
      "createdAt": "2025-07-25T12:57:37.670Z",
      "updatedAt": "2025-07-25T12:57:37.670Z"
    },
    {
      "id": "YtfXmaZk44MYedPO",
      "name": "Dynamic Pricing",
      "createdAt": "2025-07-25T16:24:30.369Z",
      "updatedAt": "2025-07-25T16:24:30.369Z"
    },
    {
      "id": "wJ30mjhtrposO8Qt",
      "name": "Simple RAG",
      "createdAt": "2025-07-28T12:55:14.424Z",
      "updatedAt": "2025-07-28T12:55:14.424Z"
    }
  ],
  "nodes": [
    {
      "id": "1249a626-d963-4448-a5b1-26ca50200824",
      "name": "🔗 区块链 Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -1392,
        624
      ],
      "webhookId": "eed656b3-6a7f-4460-92e0-802bca2522d0",
      "parameters": {
        "path": "eed656b3-6a7f-4460-92e0-802bca2522d0",
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "16186e5f-84af-4303-a48a-bb7f5a8548e9",
      "name": "📋 概览",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1936,
        112
      ],
      "parameters": {
        "color": 4,
        "width": 400,
        "height": 492,
        "content": "# 🔍 简单区块链监控器"
      },
      "typeVersion": 1
    },
    {
      "id": "f29f94bb-cafd-43b6-8e2a-6557bca1dd7b",
      "name": "🔄 规范化数据",
      "type": "n8n-nodes-base.code",
      "position": [
        -1056,
        624
      ],
      "parameters": {
        "jsCode": "// Simple blockchain data preparation\nconst input = $input.all()[0].json;\n\n// Basic normalization\nconst blockData = {\n  block_number: input.blockNumber || input.block_number || input.height,\n  blockchain: (input.blockchain || input.chain || 'ethereum').toLowerCase(),\n  timestamp: input.timestamp || Date.now(),\n  session_id: `block_${Date.now()}`\n};\n\n// Set explorer URL\nconst explorers = {\n  ethereum: `https://etherscan.io/block/${blockData.block_number}`,\n  bitcoin: `https://blockchair.com/bitcoin/block/${blockData.block_number}`,\n  bsc: `https://bscscan.com/block/${blockData.block_number}`,\n  polygon: `https://polygonscan.com/block/${blockData.block_number}`\n};\n\nblockData.explorer_url = explorers[blockData.blockchain] || explorers.ethereum;\n\nconsole.log(`Processing block ${blockData.block_number} on ${blockData.blockchain}`);\n\nreturn [{ json: blockData }];"
      },
      "typeVersion": 2
    },
    {
      "id": "adc3d7ef-4928-4c92-acff-5fd0dacb4c91",
      "name": "📡 输入信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1536,
        112
      ],
      "parameters": {
        "color": 5,
        "width": 396,
        "height": 744,
        "content": "# 步骤 1:Webhook 输入 🔗"
      },
      "typeVersion": 1
    },
    {
      "id": "473fd718-b826-45f1-a832-8609635c6214",
      "name": "🤖 ScrapeGraphAI",
      "type": "n8n-nodes-scrapegraphai.scrapegraphAi",
      "position": [
        -768,
        608
      ],
      "parameters": {
        "userPrompt": "Extract transaction data from this blockchain explorer page. Return JSON with:\n\n**transactions**: Array of objects with:\n- hash: transaction ID\n- from: sender address  \n- to: receiver address\n- value_usd: USD amount (if available)\n- fee_usd: fee in USD\n- status: success/failed\n- is_contract: true if contract interaction\n\n**summary**:\n- total_transactions: count\n- total_volume_usd: sum of values\n- high_value_count: transactions > $10,000\n- failed_count: failed transactions\n\nFocus on accuracy and include only confirmed data.",
        "websiteUrl": "={{ $json.explorer_url }}"
      },
      "typeVersion": 1
    },
    {
      "id": "26598a18-97d4-4e5d-bced-7a5bc9869265",
      "name": "🔧 处理信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1136,
        112
      ],
      "parameters": {
        "color": 3,
        "width": 300,
        "height": 744,
        "content": "# 步骤 2:数据处理 🔄"
      },
      "typeVersion": 1
    },
    {
      "id": "0ac361af-deb0-471b-8a0f-2d7a7c36a7e4",
      "name": "⚡ 风险分析器",
      "type": "n8n-nodes-base.code",
      "position": [
        -448,
        608
      ],
      "parameters": {
        "jsCode": "// Simple risk analysis\nconst blockData = $('Normalize Data').first().json;\nconst scrapedData = $input.all()[0].json;\n\n// Initialize analysis\nlet analysis = {\n  block_number: blockData.block_number,\n  blockchain: blockData.blockchain,\n  timestamp: new Date().toISOString(),\n  \n  // Basic stats\n  total_transactions: 0,\n  total_volume_usd: 0,\n  high_value_transactions: [],\n  failed_transactions: 0,\n  \n  // Risk assessment\n  risk_score: 0,\n  risk_level: 'low',\n  alerts: []\n};\n\n// Process scraped data\nif (scrapedData.transactions && Array.isArray(scrapedData.transactions)) {\n  analysis.total_transactions = scrapedData.transactions.length;\n  \n  scrapedData.transactions.forEach(tx => {\n    const value = parseFloat(tx.value_usd || 0);\n    analysis.total_volume_usd += value;\n    \n    // High-value detection\n    if (value > 10000) {\n      analysis.high_value_transactions.push({\n        hash: tx.hash,\n        value_usd: value,\n        from: tx.from,\n        to: tx.to\n      });\n    }\n    \n    // Failed transaction count\n    if (tx.status === 'failed') {\n      analysis.failed_transactions++;\n    }\n  });\n}\n\n// Use summary data if available\nif (scrapedData.summary) {\n  analysis.total_transactions = scrapedData.summary.total_transactions || analysis.total_transactions;\n  analysis.total_volume_usd = scrapedData.summary.total_volume_usd || analysis.total_volume_usd;\n  analysis.failed_transactions = scrapedData.summary.failed_count || analysis.failed_transactions;\n}\n\n// Simple risk scoring\nlet riskScore = 0;\n\n// High value risk\nriskScore += analysis.high_value_transactions.length * 15;\n\n// Volume risk\nif (analysis.total_volume_usd > 1000000) riskScore += 20;\nelse if (analysis.total_volume_usd > 100000) riskScore += 10;\n\n// Failure rate risk\nconst failureRate = analysis.total_transactions > 0 ? \n  analysis.failed_transactions / analysis.total_transactions : 0;\nif (failureRate > 0.1) riskScore += 15;\n\nanalysis.risk_score = Math.min(riskScore, 100);\n\n// Risk level determination\nif (analysis.risk_score >= 50) {\n  analysis.risk_level = 'high';\n} else if (analysis.risk_score >= 25) {\n  analysis.risk_level = 'medium';\n} else {\n  analysis.risk_level = 'low';\n}\n\n// Generate alerts\nif (analysis.risk_level === 'high') {\n  analysis.alerts.push(`High risk block: ${analysis.high_value_transactions.length} high-value transactions`);\n}\n\nif (analysis.high_value_transactions.length > 3) {\n  analysis.alerts.push(`Multiple high-value transactions detected`);\n}\n\nif (failureRate > 0.2) {\n  analysis.alerts.push(`High failure rate: ${Math.round(failureRate * 100)}%`);\n}\n\nconsole.log(`Analysis: ${analysis.total_transactions} txs, $${analysis.total_volume_usd.toLocaleString()}, Risk: ${analysis.risk_level}`);\n\nreturn [{ json: analysis }];"
      },
      "typeVersion": 2
    },
    {
      "id": "44081a4a-0e37-4c69-a9b3-06f546a1b533",
      "name": "🕷️ 抓取信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -832,
        112
      ],
      "parameters": {
        "color": 6,
        "width": 300,
        "height": 744,
        "content": "# 步骤 3:AI 数据提取 🤖"
      },
      "typeVersion": 1
    },
    {
      "id": "e23fec64-72de-40eb-9ee0-25a1c753c54b",
      "name": "🚨 风险过滤器",
      "type": "n8n-nodes-base.if",
      "position": [
        -128,
        592
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "risk-check",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $json.risk_level }}",
              "rightValue": "low"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "0480096b-03cc-46bb-85b9-90b1d81f6596",
      "name": "📊 分析信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -528,
        112
      ],
      "parameters": {
        "color": 2,
        "width": 300,
        "height": 744,
        "content": "# 步骤 4:风险分析 ⚡"
      },
      "typeVersion": 1
    },
    {
      "id": "7c567592-055a-4550-9867-ca728a0e11dc",
      "name": "📱 Slack 警报",
      "type": "n8n-nodes-base.slack",
      "position": [
        176,
        608
      ],
      "webhookId": "ccb327b2-8ac0-440e-a605-4f2964d5dfb6",
      "parameters": {
        "operation": "create"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a669635d-49fd-4fd4-b30a-08e98590de70",
      "name": "🎯 过滤器信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -224,
        112
      ],
      "parameters": {
        "width": 300,
        "height": 744,
        "content": "# 步骤 5:风险过滤 🚨"
      },
      "typeVersion": 1
    },
    {
      "id": "6fa3b3f7-0142-4089-a46b-8fb69e17e91e",
      "name": "🔔 警报信息",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        112
      ],
      "parameters": {
        "color": 7,
        "width": 300,
        "height": 744,
        "content": "# 步骤 6:Slack 警报 📱"
      },
      "typeVersion": 1
    },
    {
      "id": "bd1d424c-6f26-4f96-ae80-ba4ef87e7c5e",
      "name": "⚙️ 配置",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        384,
        112
      ],
      "parameters": {
        "color": 2,
        "width": 350,
        "height": 744,
        "content": "## 🔧 配置"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ac7a0925-70ce-4b7f-91e7-19bf16686bfa",
  "connections": {
    "🚨 Risk Filter": {
      "main": [
        [
          {
            "node": "📱 Slack Alert",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "⚡ Risk Analyzer": {
      "main": [
        [
          {
            "node": "🚨 Risk Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🤖 ScrapeGraphAI": {
      "main": [
        [
          {
            "node": "⚡ Risk Analyzer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔄 Normalize Data": {
      "main": [
        [
          {
            "node": "🤖 ScrapeGraphAI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "🔗 Blockchain Webhook": {
      "main": [
        [
          {
            "node": "🔄 Normalize Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级 - 加密货币交易, AI 摘要总结

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量14
分类2
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

外部链接
在 n8n.io 查看

分享此工作流