@a16z/helios

中文文档
0.12.0发布于 2026/10/06MITTypeScriptESM + CJS构建来源已验证近 30 天下载 2499

A fast, secure, and portable multichain light client for Ethereum

原始使用文档
文档目录7 节
  1. Installation & Basic Setup Examples
  2. 1. Installing using NPM
  3. 2. Loading on a webpage from a CDN
  4. Usage as EIP-1193 provider
  5. Cleanup
  6. Documentation
  7. License

@a16z/helios

Helios is a trustless, efficient, and portable Ethereum light client written in Rust with TypeScript bindings for web and Node.js environments. It comes both as a UMD and ES module.

Installation & Basic Setup Examples

1. Installing using NPM

Install the package:

npm install @a16z/helios

Basic usage in your project (e.g., index.js or index.mjs or main.ts):

import { createHeliosProvider } from '@a16z/helios';

async function main() {
  // Create provider - WASM initialization is handled automatically
  const heliosProvider = await createHeliosProvider({
    executionRpc: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
    consensusRpc: 'https://ethereum.operationsolarstorm.org',
    network: 'mainnet',
    checkpoint: "0x..."
  }, 'ethereum');

  await heliosProvider.waitSynced();
  console.log('Helios is synced and ready!');
  
  // Example: Get latest block number
  const blockNumber = await heliosProvider.request({ method: 'eth_blockNumber', params: [] });
  console.log('Latest block number:', parseInt(blockNumber, 16));
}

main().catch(console.error);

2. Loading on a webpage from a CDN

For a quick test, you can try Helios directly in an HTML file using a CDN like unpkg.

As a UMD module:

<!DOCTYPE html>
<html>
<head>
  <title>Helios UMD Test</title>
  <script src="https://unpkg.com/@a16z/helios/dist/lib.umd.js"></script>
</head>
<body>
  <script>
    async function main() {
      // Helios is available via global variable `helios`
      const provider = await helios.createHeliosProvider({
        executionRpc: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
        consensusRpc: 'https://ethereum.operationsolarstorm.org',
        network: 'mainnet',
        checkpoint: "0x..."
      }, 'ethereum');
      
      await provider.waitSynced();
      console.log('Helios is ready!');
    }
    
    main().catch(console.error);
  </script>
</body>
</html>

As an ES module:

<!DOCTYPE html>
<html>
<head>
  <title>Helios ESM Test</title>
</head>
<body>
  <script type="module">
    import { createHeliosProvider } from 'https://unpkg.com/@a16z/helios/dist/lib.mjs';
    
    async function main() {
      const provider = await createHeliosProvider({
        executionRpc: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
        consensusRpc: 'https://ethereum.operationsolarstorm.org',
        network: 'mainnet',
        checkpoint: "0x..."
      }, 'ethereum');
      
      await provider.waitSynced();
      console.log('Helios is ready!');
    }
    
    main().catch(console.error);
  </script>
</body>
</html>

Usage as EIP-1193 provider

Helios can be used as an EIP-1193 provider. Once initialized and synced (as shown in the examples above), heliosProvider can be used with libraries like viem, ethers.js, web3.js, etc.

Example with viem:

import { createPublicClient, custom } from 'viem';
import { mainnet } from 'viem/chains';
import { createHeliosProvider } from '@a16z/helios';

// Create and sync Helios provider
const heliosProvider = await createHeliosProvider({
  executionRpc: 'https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY',
  consensusRpc: 'https://lodestar-mainnet.chainsafe.io',
  network: 'mainnet',
  checkpoint: "0x..."
}, 'ethereum');

await heliosProvider.waitSynced();

// Use with viem
const client = createPublicClient({
  chain: mainnet,
  transport: custom(heliosProvider)
});

const blockNumber = await client.getBlockNumber();
console.log('Latest block number:', blockNumber);

Cleanup

If Helios is used as a transport for ethers or viem, calling EthersProvider.destroy() will NOT destroy underlying Helios instance nor will stop the background tasks.

For proper cleanup, call shutdown() (or its alias destroy()) on your Helios provider instance to properly release resources:

// Clean up when done
await heliosProvider.shutdown();

This unsubscribes all active subscriptions, aborts background tasks, removes event listeners, and frees WASM memory. The method is idempotent—calling it multiple times is safe. After dereferencing Helios provider instance will be garbage collected.

Documentation

See helios github repo for more details.

License

This project is licensed under the MIT License - see the main repository for details.

版本与发布记录

@a16z/helios 共发布 9 个版本,首次发布于 2025/06/18;过去 12 个月发布了 3 个版本。最新版本附带 npm provenance 构建来源证明,可追溯到公开的 CI 构建记录。

版本发布日期距今
0.12.0latest2026/10/061 个月前
0.11.12026/02/288 个月前
0.11.02025/12/1710 个月前
0.10.22025/11/061 年前
0.10.12025/10/281 年前
0.10.02025/10/281 年前

关于 @a16z/helios 的常见问题

@a16z/helios 是什么?

A fast, secure, and portable multichain light client for Ethereum

如何安装 @a16z/helios?

在项目目录运行 npm install @a16z/helios,或使用 pnpm add / yarn add / bun add。

@a16z/helios 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@a16z/helios 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@a16z/helios 可以商用吗?

@a16z/helios 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@a16z/helios 的下载量有多少?

根据 npm 官方下载统计,@a16z/helios 在 2026/10/05 – 2026/11/03 这 30 天内被下载 2,499 次,日均约 83 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@a16z/helios 还在维护吗?

最新版本 0.12.0 发布于 2026/10/06(1 个月前);至今共发布 9 个版本,其中过去 12 个月发布了 3 个;首次发布于 2025/06/18。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。