# @ethersphere/core-sdk 中文文档

规范地址：https://npmcn.com/package/%40ethersphere/core-sdk/

版本：0\.3\.0
npm 元数据更新时间：2026-10-27T13:13:15.944Z
中文译文更新时间：2026-11-13T23:41:23.239Z
软件包许可：BSD-3-Clause

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40ethersphere/core-sdk
原文对照：https://npmcn.com/package/%40ethersphere/core-sdk/?lang=original
项目主页：https://github.com/ethersphere/core-sdk
源码仓库：https://github.com/ethersphere/core-sdk

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：2.8 MB，227 个文件
- 模块格式：ESM + CJS
- TypeScript 类型：包内自带
- Node.js 要求：\>=22
- 运行依赖：2 个
- 首次发布：2026-08-18T12:58:59.737Z
- 最新版本发布：2026-10-27T13:13:14.747Z
- 近 30 天下载量：8473（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：6（近 12 个月 6 个）

## 中文简介

用于 Swarm 分散存储网络的框架不可知类型Script 原始

## 安装

```sh
npm install @ethersphere/core-sdk
```

也可以使用：`pnpm add @ethersphere/core-sdk`、`yarn add @ethersphere/core-sdk`、`bun add @ethersphere/core-sdk`

## README

# 沼泽核心

框架不可知类型 [沼泽](https://www.ethswarm.org/) 分权存储网络:打入字节包装、内容地址和单所有者块、Mantaray Express tree、Reed-Solomon desersure 编码、加密和邮票签名.

没有I/O网络——这个库只构建并剖析了斯瓦尔姆的-盘/接线数据结构. 与Bee节点交谈是留给消费者的(例如. [贝杰斯](https://github.com/ethersphere/bee-js)) (中文(简体) ).

## 安装

```sh
npm install @ethersphere/core-sdk
```

船舶既作为无害环境管理,又作为普通JS,具有完整的类型Script. 从您的子路径导入 :

```ts
import { Bytes, Reference } from '@ethersphere/core-sdk/bytes'
import { makeContentAddressedChunk } from '@ethersphere/core-sdk/chunk'
```

## 快速实例

```ts
import { makeContentAddressedChunk } from '@ethersphere/core-sdk/chunk'

const chunk = makeContentAddressedChunk('Hello, Swarm!')
console.log(chunk.address.toHex())
```

## 包括什么

| 子路径 | 目录 |
| --- | --- |
| `@ethersphere/core-sdk/bytes` | `Bytes` 和打入的包装`Reference`, (中文(简体) ), `BatchId`, (中文(简体) ), `EthAddress`, (中文(简体) ), `PrivateKey`, (中文(简体) ), `PublicKey`, (中文(简体) ), `Signature`, (中文(简体) ), `Span`, (中文(简体) ), `Topic`, (中文(简体) ), `Identifier`, (中文(简体) ), `FeedIndex`, (中文(简体) ), `PeerAddress`, (中文(简体) ), `TransactionId`\+ 低等编码辅助器(hex/base32/base64、concat、切片、整数包装) |
| `@ethersphere/core-sdk/crypto` | Keccak-256、ECDSA标志/恢复/核查、公用/私用钥匙衍生 |
| `@ethersphere/core-sdk/chunk` | 内容地址为Chunks(CAC)、单所有者chunks(SOC/SOC复制品)、BMT块散列以及 `ChunkSplitter`编号 :`ChunkJoiner` 用于建造和重建块状树木 |
| `@ethersphere/core-sdk/mantaray` | `MantarayNode` ——用于目录/收藏上传的表列三相 |
| `@ethersphere/core-sdk/erasure-coding` | Reed-Solomon对等,冗余级表格,以及用于将等分块添加到流中的批量逻辑 |
| `@ethersphere/core-sdk/encryption` | 春克级流密码和 XOR 助手 |
| `@ethersphere/core-sdk/bps` | BPS-lite live pub/sub(SWIP-74/87):会话主题和块编号,签名的DATA/AUTH/ROSTER/EOS块,WebSocket帧编码器,名册有效载荷,以及 `BpsPosition` 恢复订阅 |
| `@ethersphere/core-sdk/stamper` | 邮票签名(`Stamper`, (中文(简体) ), `stamp()`)和有效能力数学 |

每个子路径也会从包根再导出(`@ethersphere/core-sdk`),这样 `import { Bytes } from '@ethersphere/core-sdk'` 还行.

## 发展

```sh
pnpm install
pnpm test          # vitest
pnpm typecheck
pnpm format:check
pnpm build          # esbuild (ESM + CJS) + tsc (.d.ts)
pnpm bench          # perf-sensitive functions, checked against a stored baseline
```

需要节点.js 22+.

## 常见问题

### @ethersphere/core-sdk 是什么？

用于 Swarm 分散存储网络的框架不可知类型Script 原始

### 如何安装 @ethersphere/core-sdk？

在项目目录运行 npm install @ethersphere/core-sdk，或使用 pnpm add / yarn add / bun add。

### @ethersphere/core-sdk 支持 TypeScript 吗？

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

### @ethersphere/core-sdk 支持 ESM 还是 CommonJS？

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

### @ethersphere/core-sdk 需要什么版本的 Node\.js？

package\.json 的 engines 字段要求 Node\.js \>=22。版本不符时 npm 默认只给出警告，开启 engine-strict 后会拒绝安装。

### @ethersphere/core-sdk 可以商用吗？

@ethersphere/core-sdk 使用 BSD-3-Clause 许可。宽松许可：允许商业使用、修改和再分发，通常只需在分发时保留原版权与许可声明。另外不得用原作者名义为衍生产品背书。以上为概括，不构成法律意见，请以许可原文为准。

### @ethersphere/core-sdk 的下载量有多少？

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

### @ethersphere/core-sdk 还在维护吗？

最新版本 0\.3\.0 发布于 2026/10/27（17 天前）；至今共发布 6 个版本，其中过去 12 个月发布了 6 个；首次发布于 2026/08/18。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

