网络

网络(Network)代表 Fystack 支持的区块链网络。你可以获取可用网络的信息,包括 EVM 和非 EVM 链,以及它们的配置详情和健康状态。

支持的网络

下表列出了 Fystack 目前支持的主网网络及其 network_code 标识符。在 API 请求、webhook 或 SDK 调用中引用网络时,请使用 network_code 的值。

网络 网络代码
Ethereum ETHEREUM_MAINNET
Base BASE_MAINNET
Solana SOL_MAINNET
Polygon POLYGON_MAINNET
BNB Smart Chain BSC_MAINNET
Lisk LISK_MAINNET
Bitcoin BTC_MAINNET
Tron TRON_MAINNET

需要的网络不在列表中?请联系 Fystack 团队,我们可以优先安排添加。


网络信息

Fystack 中的每个网络都包含该区块链的完整信息:

网络属性

  • 链标识:每个网络唯一的链 ID 和内部代码
  • 网络类型:同时支持 EVM 和非 EVM 网络
  • 原生币:每个网络的原生代币(例如 ETH、SOL)
  • 区块浏览器:预先配置的交易、地址和代币浏览器 URL
  • 网络状态:实时的 RPC 健康状态和可用性
  • 区块配置:确认数要求和出块间隔
  • 测试网支持:明确标识出用于开发的测试网络

获取网络列表

GET
/networks

该 endpoint 用于获取可用的区块链网络。这是一个无需认证的公开 endpoint。

参数

  • Name
    search
    Type
    string
    Description

    按名称筛选网络。例如,?search=Base 会返回与 "Base" 匹配的网络。

响应

  • Name
    success
    Type
    boolean
    Description

    表示请求是否成功。

  • Name
    message
    Type
    string
    Description

    描述操作结果的消息。

  • Name
    code
    Type
    integer
    Description

    表示结果状态的数字代码(0 表示成功)。

  • Name
    data
    Type
    array
    Description

    网络对象数组。

  • Name
    id
    Type
    string
    Description

    网络的 UUID。

  • Name
    created_at
    Type
    string
    Description

    网络被添加到系统中的时间戳。

  • Name
    updated_at
    Type
    string
    Description

    网络配置最后一次更新的时间戳。

  • Name
    name
    Type
    string
    Description

    网络的显示名称。

  • Name
    description
    Type
    string
    Description

    网络的简要描述。

  • Name
    is_evm
    Type
    boolean
    Description

    是否为以太坊虚拟机(EVM)兼容网络。

  • Name
    chain_id
    Type
    integer
    Description

    网络唯一的链标识符。

  • Name
    native_currency
    Type
    string
    Description

    网络原生币的符号。

  • Name
    is_testnet
    Type
    boolean
    Description

    是否为测试网络。

  • Name
    internal_code
    Type
    string
    Description

    网络的内部标识代码。

  • Name
    explorer_tx
    Type
    string
    Description

    交易浏览器链接的 URL 模板。使用 %s 作为交易哈希的占位符。

  • Name
    explorer_address
    Type
    string
    Description

    地址浏览器链接的 URL 模板。使用 %s 作为地址的占位符。

  • Name
    explorer_token
    Type
    string
    Description

    代币浏览器链接的 URL 模板。使用 %s 作为代币地址的占位符。

  • Name
    confirmation_blocks
    Type
    integer
    Description

    交易被视为最终确认所需的区块确认数。

  • Name
    block_interval_in_seconds
    Type
    integer
    Description

    平均出块间隔(秒)。

  • Name
    disabled
    Type
    boolean
    Description

    网络当前是否被禁用。

  • Name
    logo_url
    Type
    string
    Description

    网络 logo 图片的 URL。

  • Name
    is_rpc_active
    Type
    boolean
    Description

    RPC endpoint 当前是否处于活跃状态。

  • Name
    rpc_health_status
    Type
    string
    Description

    RPC endpoint 当前的健康状态。可能为 healthy、degraded 或 null。

  • Name
    pending_block_count
    Type
    integer
    Description

    正在处理的待处理区块数量。

该 endpoint 是公开的,无需认证。你可以在没有 API 凭证的情况下使用它获取网络信息。

请求

GET
/networks
curl -X GET https://api.fystack.io/api/v1/networks

Response

200
{
  "success": true,
  "message": "success",
  "code": 0,
  "data": [
    {
      "id": "23d13c03-1f3c-4e2a-9aef-1771a244b7f6",
      "created_at": "2024-01-05T09:05:25.629202+07:00",
      "updated_at": "2025-07-18T12:34:07.91766+07:00",
      "name": "Sepolia Ethereum Testnet",
      "description": "Sepolia testnet",
      "is_evm": true,
      "chain_id": 11155111,
      "native_currency": "ETH",
      "is_testnet": true,
      "internal_code": "ETHER_SEPOLIA_TESTNET",
      "explorer_tx": "https://sepolia.etherscan.io/tx/%s",
      "explorer_address": "https://sepolia.etherscan.io/address/%s",
      "explorer_token": "https://sepolia.etherscan.io/token/%s",
      "confirmation_blocks": 1,
      "block_interval_in_seconds": 15,
      "disabled": false,
      "logo_url": "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcR-lzp6jMVVHdxHiK4q5Xy2FbJIrC-GPmTREA&s",
      "is_rpc_active": true,
      "rpc_health_status": "healthy",
      "pending_block_count": 8
    },
    {
      "id": "f8d7d8b9-3466-405c-a8c9-542366f95f39",
      "created_at": "2025-03-01T22:21:44.604716+07:00",
      "updated_at": "2025-08-03T21:47:21.917315+07:00",
      "name": "Base mainnet",
      "description": "Base mainnets",
      "is_evm": true,
      "chain_id": 8453,
      "native_currency": "ETH",
      "internal_code": "BASE_MAINNET",
      "explorer_tx": "https://basescan.org/tx/%s",
      "explorer_address": "https://basescan.org/address/%s",
      "explorer_token": "https://basescan.org/token/%s",
      "confirmation_blocks": 20,
      "block_interval_in_seconds": 2,
      "disabled": false,
      "logo_url": "https://avatars.githubusercontent.com/u/108554348?v=4",
      "is_rpc_active": false,
      "rpc_health_status": null,
      "pending_block_count": 25438
    }
  ]
}

重新扫描交易

POST
/networks/rescan-transaction

该 endpoint 用于手动触发对某个网络上特定交易的重新扫描。当交易因 RPC 故障在一段时间后仍未被索引时,这会很有用。你可以手动触发重新扫描,让系统对该交易进行索引。

该 endpoint 需要用户访问令牌和系统管理员权限。

参数

  • Name
    tx_hash
    Type
    string
    Required
    required
    Description

    需要重新扫描的交易哈希。

  • Name
    network_id
    Type
    string
    Required
    required
    Description

    交易所在网络的 UUID。

响应

  • Name
    success
    Type
    boolean
    Description

    表示重新扫描请求是否成功。

  • Name
    message
    Type
    string
    Description

    描述操作结果的消息。

  • Name
    code
    Type
    integer
    Description

    表示结果状态的数字代码(0 表示成功)。

请求

POST
/networks/rescan-transaction
import { FystackSDK, Environment } from "@fystack/sdk"
const apiCredentials = {
apiKey: process.env.API_KEY,
apiSecret: process.env.API_SECRET
}
const sdk = new FystackSDK({
credentials: apiCredentials,
environment: Environment.Sandbox,
logger: true
})
await sdk.rescanTransaction({
txHash: 'a6ec569aa7db70433e9012eb456cd24156d33c1748825f0d868d2d4e2595cb06',
networkId: 'c5725221-fa98-4d6c-a6ca-8c5cd65cd884'
})

Response

200
{
  "success": true,
  "message": "success",
  "code": 0,
  "data": {
    "message": "Transaction block added to rescan queue successfully"
  }
}