@chainsafe/bls-hd-key

中文文档
0.3.0发布于 2022/02/10Apache-2.0TypeScriptCommonJS近 30 天下载 2.2万

BLS KDF 和 HD 钱包工具

中文使用文档
文档目录4 节
  1. 示例
  2. 争吵
  3. 审计
  4. 许可证

BLS HD 密钥公用事业

npm (tag) Discord GitHub ES Version Node Version

用于管理 BLS 继承式决定性账户的功能 .

  1. 从 Entropy 创建主密钥
  2. 从私钥和索引创建儿童私钥
  3. 将标准路径转换成一系列索引
  4. 从私人密钥和一系列指数中创建一个失真私钥

执行方式如下: EIP-2334, (中文(简体) ), EIP-2333

关于更高层次的界面,参见 @ 链条安全/ bls- keygen。 。 。 .

示例


import {deriveMasterSK, deriveChildSK, deriveChildSKMultiple, pathToIndices} from "@chainsafe/bls-hd-key";

// Create master private key (according to EIP-2333)

const entropy: Uint8Array = Uint8Array.from(...);
const masterKey: Uint8Array = deriveMasterSK(entropy);

// Create child private key one level deep

const childIndex: number = ...;
const childKey: Uint8Array = deriveChildSK(masterKey, childIndex);

// Convert a "path" into an array of indices (using validation rules of EIP-2334)

cont path = "m/12381/3600/0/0";
const childIndices: number[] = pathToIndices(path);

// Convert a "path" into an array of indices (validating an alternate key type)

const eth1KeyType = 60;
cont path = "m/12381/60/0/0";
const childIndices: number[] = pathToIndices(path, eth1KeyType);

// Create a child private key `childIndices.length` levels deep

const childIndices: number[] = [...];
const childKey = deriveChildSKMultiple(masterKey, childIndices);

// Compose functions to derive a child key from entropy and a path

const entropy: Uint8Array = Uint8Array.from(...);
cont path = "m/12381/3600/0/0";
const childKey = deriveChildSKMultiple(deriveMasterSK(entropy), pathToIndices(path));

争吵

所需经费:

  • 节点
  • 线条
yarn install
yarn run test

审计

这一回购额由最不发达国家管理局审计,作为 本次安全审计,于2020-03-23发布. 提交 767c998 报告已核实.

许可证

阿帕奇 - 2.0

版本与发布记录

@chainsafe/bls-hd-key 共发布 5 个版本,首次发布于 2019/12/01;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.3.0latest2022/02/104 年前
0.2.12021/04/215 年前
0.2.02020/09/276 年前
0.1.02020/07/306 年前
0.0.12019/12/016 年前

关于 @chainsafe/bls-hd-key 的常见问题

@chainsafe/bls-hd-key 是什么?

BLS KDF 和 HD 钱包工具

如何安装 @chainsafe/bls-hd-key?

在项目目录运行 npm install @chainsafe/bls-hd-key,或使用 pnpm add / yarn add / bun add。

@chainsafe/bls-hd-key 支持 TypeScript 吗?

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

@chainsafe/bls-hd-key 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@chainsafe/bls-hd-key 可以商用吗?

@chainsafe/bls-hd-key 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@chainsafe/bls-hd-key 的下载量有多少?

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

@chainsafe/bls-hd-key 还在维护吗?

最新版本 0.3.0 发布于 2022/02/10(4 年前);至今共发布 5 个版本,其中过去 12 个月发布了 0 个;首次发布于 2019/12/01。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。