沼泽核心
框架不可知类型 沼泽 分权存储网络:打入字节包装、内容地址和单所有者块、Mantaray Express tree、Reed-Solomon desersure 编码、加密和邮票签名.
没有I/O网络——这个库只构建并剖析了斯瓦尔姆的-盘/接线数据结构. 与Bee节点交谈是留给消费者的(例如. 贝杰斯) (中文(简体) ).
安装
npm install @ethersphere/core-sdk
船舶既作为无害环境管理,又作为普通JS,具有完整的类型Script. 从您的子路径导入 :
import { Bytes, Reference } from '@ethersphere/core-sdk/bytes'
import { makeContentAddressedChunk } from '@ethersphere/core-sdk/chunk'
快速实例
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' 还行.
发展
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+.