Skip to content

链网络列表 ​

支持的区块链网络及其配置信息


网络分类 ​

按网络类型 ​

类型说明示例
主网生产环境,真实资产BFM Mainnet, Ethereum Mainnet
测试网开发测试,测试代币BFM Testnet, Sepolia
开发网本地开发环境Localhost, Hardhat Network

按链架构 ​

架构特点代表链
EVM 兼容支持以太坊虚拟机Ethereum, BSC, Polygon
BFM 原生BioForest 原生架构BFM Chain
UTXO 模型比特币架构Bitcoin, Litecoin
TVMTron 虚拟机Tron

BFM 链网络 ​

BFM 主网 ​

json
{
  "chainId": "bfm-mainnet",
  "name": "BFM Mainnet",
  "type": "bfm",
  "rpc": {
    "primary": "https://rpc.bfmeta.io",
    "fallback": ["https://rpc2.bfmeta.io"]
  },
  "explorer": {
    "name": "BFM Explorer",
    "url": "https://explorer.bfmeta.io"
  },
  "nativeCurrency": {
    "name": "BioForest Meta",
    "symbol": "BFM",
    "decimals": 8
  },
  "features": {
    "staking": true,
    "nft": true,
    "smartContract": true
  }
}

BFM 测试网 ​

json
{
  "chainId": "bfm-testnet",
  "name": "BFM Testnet",
  "type": "bfm",
  "testnet": true,
  "rpc": {
    "primary": "https://testnet-rpc.bfmeta.io"
  },
  "faucet": "https://faucet.bfmeta.io"
}

EVM 兼容链 ​

Ethereum 主网 ​

json
{
  "chainId": "1",
  "name": "Ethereum Mainnet",
  "type": "evm",
  "rpc": {
    "primary": "https://eth.llamarpc.com",
    "fallback": [
      "https://rpc.ankr.com/eth",
      "https://cloudflare-eth.com"
    ]
  },
  "explorer": {
    "name": "Etherscan",
    "url": "https://etherscan.io"
  },
  "nativeCurrency": {
    "symbol": "ETH",
    "decimals": 18
  }
}

BSC 主网 ​

json
{
  "chainId": "56",
  "name": "BNB Smart Chain",
  "type": "evm",
  "rpc": {
    "primary": "https://bsc-dataseed.binance.org"
  },
  "explorer": {
    "name": "BscScan",
    "url": "https://bscscan.com"
  },
  "nativeCurrency": {
    "symbol": "BNB",
    "decimals": 18
  }
}

Polygon 主网 ​

json
{
  "chainId": "137",
  "name": "Polygon Mainnet",
  "type": "evm",
  "rpc": {
    "primary": "https://polygon-rpc.com"
  },
  "nativeCurrency": {
    "symbol": "MATIC",
    "decimals": 18
  }
}

测试网络 ​

链测试网Chain IDFaucet
EthereumSepolia11155111sepoliafaucet.com
BSCBSC Testnet97testnet.binance.org/faucet-smart
TronNile-nileex.io/faucet
BFMBFM Testnet-faucet.bfmeta.io

链配置 Schema ​

typescript
interface ChainConfig {
  // 基础信息
  chainId: string        // 唯一标识
  name: string           // 显示名称
  type: ChainType        // 链类型
  version: string        // 配置版本 (x.y)
  
  // 网络配置
  rpc: {
    primary: string      // 主 RPC 端点
    fallback?: string[]  // 备用端点
  }
  
  // 浏览器配置
  explorer?: {
    name: string
    url: string
    apiUrl?: string
  }
  
  // 原生代币
  nativeCurrency: {
    name: string
    symbol: string
    decimals: number
  }
  
  // 可选信息
  testnet?: boolean
  faucet?: string
  features?: {
    staking?: boolean
    nft?: boolean
    smartContract?: boolean
  }
}

type ChainType = 'bfm' | 'evm' | 'utxo' | 'solana' | 'tron'

订阅源格式 ​

标准格式 ​

json
{
  "version": "1.0",
  "lastUpdate": "2024-01-15T00:00:00Z",
  "chains": [
    { /* ChainConfig */ }
  ]
}

默认订阅源 ​

环境URL
生产https://config.bfmpay.io/chains.json
测试https://config.bfmpay.io/chains-testnet.json
内置src/config/default-chains.json

添加自定义链 ​

配置验证规则 ​

typescript
const chainConfigSchema = z.object({
  chainId: z.string().min(1),
  name: z.string().min(1).max(50),
  type: z.enum(['bfm', 'evm', 'utxo', 'solana', 'tron']),
  rpc: z.object({
    primary: z.string().url(),
    fallback: z.array(z.string().url()).optional()
  }),
  nativeCurrency: z.object({
    symbol: z.string().max(10),
    decimals: z.number().int().min(0).max(18)
  })
})

RPC 切换策略 ​

  1. 首先尝试 primary RPC
  2. 失败后依次尝试 fallback
  3. 所有失败后标记链为离线
  4. 后台定期重试恢复

相关文档 ​

Released under the MIT License.