bitcoinjs-lib: 用于node.js和浏览器的javascript比特币库。

资讯 2024-07-09 阅读:67 评论:0
用于node.js和浏览器的javascript比特币库。用TypeScript编写,但提交JS文件进行验证。The javascript bitcoin library for node.js and browsers. Wr...
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

用于node.js和浏览器的javascript比特币库。用TypeScript编写,但提交JS文件进行验证。

The javascript bitcoin library for node.js and browsers. Written by TypeScript, but submitted to JS documents for validation.

根据麻省理工学院执照的条款发布。

Issued under the terms of the license of the Massachusetts Institute of Technology.

如果您正在考虑在生产中使用此库的主分支,请停止。Master是不稳定的;它是我们的开发分支,只有标记的发布才可以被归类为稳定的。

If you are considering using the main branch of this bank in production, stop. Master is unstable; it is our branch of development, and only the release of the tags can be classified as stable.

不要相信。验证。

Don't believe it. Verify.

我们建议此库和bitcoinjs生态系统的每个用户进行审核,并验证任何底层代码的有效性和适用性,包括检查项目的所有依赖项。

We recommend that each user of the library and the bitcoinjs ecosystem perform an audit and verify the validity and applicability of any bottom code, including checking all dependencies of the project.

错误和错误会发生,但在您解决和报告问题的帮助下,我们可以一起开发出开源软件,即:

Errors and errors occur, but with your help in solving and reporting problems, we can develop open source software together, namely:

  • 易于审核和验证,
  • 测试,测试覆盖率>95%,
  • 先进,功能丰富,
  • 标准化,使用prettier和Node,以及
  • 友好,有一个强大且乐于助人的社区,随时准备回答问题。

目前,除了我们的例子,我们没有任何正式的文档,如果我们的例子不足以指导您,请寻求帮助。

At present, except for our example, we do not have any formal documentation, and if our example is not enough to guide you, please seek help.

 
 

通常我们支持节点维护LTS版本。如有疑问,请参阅。特拉维斯·伊梅尔我们的持续集成测试使用了哪些版本。

We usually support the maintenance of the LTS version at the node. If you have any questions, please refer to the version that Travis Yimer used for our continuous integration tests.

警告:我们目前没有提供任何工具来验证上的版本是否与GitHub匹配。因此,您应该对照自己的验证副本来验证下载的任何内容。

Warning: We do not currently have any tools to verify whether the version matches GitHub. Therefore, you should check any downloads against your own certified copy.

密码很难。

The password is hard.

当使用私钥时,随机数生成器基本上是您编写的任何软件中最重要的部分之一。对于随机数生成,我们默认使用模块,该模块在浏览器中使用或节点js',具体取决于您的构建系统。尽管此默认值为~OK,但没有简单的方法来检测所提供的底层RNG是否足够好,或者是否严重损坏。你应该始终按照自己的标准来验证这一点。

When using a private key, the random number generator is basically one of the most important parts of any software you prepare. For random numbers generation, we use the module by default, which uses or nodes js' in the browser, depending on your construction system. Although the default value is ~OK, there is no simple way to test whether the bottom level RNG is good enough or seriously damaged. You should always verify this according to your own criteria.

这个库使用tiny-secp256k1,它使用RFC6979来帮助防止re-use和攻击。不幸的是,这不是灵丹妙药。通常,Javascript本身通过绕过这些counter-measures来与我们作对。

This library uses tiny-secp256k1, and it uses RFC6979 to help prevent re-use and attack. Unfortunately, this is not a panacea.

例如,中的问题可以在没有任何警告的情况下导致灾难性的资金损失。它可以通过破坏你的随机数生成,意外地产生一个重复的值,将比特币发送到格式错误的输出脚本,或者任何一种不同的方式。在目标环境中运行测试是很重要的,也是推荐的持续验证步骤。

For example, the problem in question can result in catastrophic financial losses without warning. It can be generated by destroying your random numbers, unexpectedly producing a duplicate value, sending bitcoin to an output script in a wrong format, or in any different way. Running tests in the target environment is important and a recommended continuous validation step.

最后,坚持最佳实践。我们不是最佳实践的权威来源,但至少:

Finally, stick to best practices. We are not an authoritative source of best practices, but at least:

  • 不要re-use地址。
  • 不要共享BIP32扩展公钥('xpubs')。它们是一个负担,它只需要1个放错地方的私钥(或者一个有缺陷的实现!)你很容易遭受灾难性的资金损失。
  • 不要使用-无论如何-不要。
  • 强制要求用户在广播之前总是(手动)验证其预期事务的freshly-decodedhuman-readable版本。
  • 不要要求用户生成助记符或“大脑钱包”,人类是可怕的随机数生成器。
  • 最后,如果可以的话,使用Typescript或类似的工具。

在浏览器中使用的推荐方法是通过Browserify。如果您熟悉如何使用browserify,请忽略这一点并继续进行,否则,建议您阅读https://browserify.org/。

The recommended method used in the browser is through Browserify. If you are familiar with how to use browserify, ignore this and continue. Otherwise you are advised to read https://browserify.org/.

注意:我们使用节点维护LTS功能,如果您需要严格的ES5,请将与步骤结合使用(使用预置)。

Note: We use nodes to maintain the LTS function, and if you need strict ES5, you will use them in combination with steps (using presets).

警告:iOS设备有问题,请至少使用buffer@5.0.5或更高版本,并在使用前强制测试套件(用于,以及任何其他依赖项)通过。

Warning: iOS equipment is in trouble. Please use at least the buffer@0.5 or higher version and make the test package (for use, and any other dependent item) mandatory before it is used.

Typescript的类型声明包含在此库中。正常安装应包括所有需要的类型信息。

Type statements by TypeScript are included in this library. Normal installation should include all required type information.

下面的例子是作为集成测试实现的,它们应该非常容易理解。否则,请求拉取是受欢迎的。一些示例(通过HTTPS)与第三方区块链提供商(3ppp)交互。

The following examples are achieved as integration tests, which should be very easy to understand. Otherwise, the request is welcome. Some examples (through HTTPS) interact with third-party block chain providers (3ppp).

  • 生成随机地址
  • 通过WIF导入地址
  • 生成2-of-3 P2SH multisig地址
  • 生成SegWit地址
  • 生成SegWit P2SH地址
  • 生成SegWit3-of-4 multisig地址
  • 生成SegWit2-of-2 P2SH multisig地址
  • 支持地址的交易检索(第三方区块链)
  • 生成Testnet地址
  • 生成Litecoin地址
  • 创建1-to-1事务
  • 创建(并通过3ppp广播)典型事务
  • 使用OP_RETURN输出创建(并通过3ppp广播)事务
  • 使用2-of-4p2sh(multisig)输入创建(并通过3ppp广播)事务
  • 使用SegWit P2SH(P2WPKH)输入创建(并通过3ppp广播)事务
  • 使用SegWit P2WPKH输入创建(并通过3ppp广播)事务
  • 使用SegWit P2PK输入创建(并通过3ppp广播)事务
  • 使用SegWit3-of-4p2sh(P2WSH(multisig))输入创建(并通过3ppp广播)事务
  • 创建(并通过3ppp广播)事务并使用HDSigner接口(bip32)签名
  • 导入BIP32 testnet xpriv并导出到WIF
  • 导出BIP32 xpriv,然后导入它
  • 导出BIP32 xpub
  • 创建BIP32,比特币,账户0,外部地址
  • 创建BIP44,比特币,账户0,外部地址
  • 创建BIP49,比特币测试网,账户0,外部地址
  • 使用BIP39生成BIP32地址
  • 创建(并通过3PBP广播)一个事务,Alice可以在过期后赎回输出(过去)
  • 创建(并通过3PBP广播)一个事务,Alice可以在过期后赎回输出(在将来)
  • 创建(并通过3PBP广播)一个事务,Alice和Bob可以随时赎回输出
  • 创建(但无法通过3PBP广播)Alice试图在到期前赎回的交易
  • 创建(并通过3PBP广播)一个事务,Alice可以在到期后(将来)赎回输出(简单的CHECKSEQUENCEVERIFY)
  • 创建(但无法通过3PBP广播)Alice尝试在到期前赎回的事务(简单CHECKSEQUENCEVERIFY)
  • 创建(并通过3PBP广播)Bob和Charles可以发送的事务(复杂CHECKSEQUENCEVERIFY)
  • 创建(并通过3PBP广播)一个事务,Alice(mediator)和Bob可以在2个块之后发送(复杂CHECKSEQUENCEVERIFY)
  • 创建(并通过3ppp广播)一个事务,Alice(中介)可以在5个块之后发送(复杂CHECKSEQUENCEVERIFY)

如果你有一个用例,你觉得可以在这里列出,请要求它!

If you have an example, you think you can list it here, please ask it!

See CONTRIBUTING.md.

 
  
 
  • BIP21-一个BIP21兼容的URL编码库
  • BIP38-Passphrase-protected私钥
  • BIP39-确定性密钥的助记符生成
  • BIP32-Utils-使用BIP32的一组实用程序
  • BIP66-严格的DER签名解码
  • BIP68-相对lock-time编码库
  • BIP69-事务输入和输出的词典索引
  • Base58-Base58编码/解码
  • Base58检查-Base58检查编码/解码
  • Bech32-一个符合BIP173的Bech32编码库
  • coinselect-Afee-optimizing,用于bitcoinjs-lib的事务输入选择模块。
  • merkle-lib-一个有性能意识的库,用于merkle根和树计算。
  • minimaldata-检查比特币策略的模块:SCRIPT_VERIFY_MINIMALDATA
美化布局示例

欧易(OKX)最新版本

【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   全球官网 大陆官网

币安(Binance)最新版本

币安交易所app【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址

火币HTX最新版本

火币老牌交易所【遇到注册下载问题请加文章最下面的客服微信】永久享受返佣20%手续费!

APP下载   官网地址
文字格式和图片示例

注册有任何问题请添加 微信:MVIP619 拉你进入群

弹窗与图片大小一致 文章转载注明

分享:

扫一扫在手机阅读、分享本文

发表评论
平台列表
美化布局示例

欧易(OKX)

  全球官网 大陆官网

币安(Binance)

  官网

火币(HTX)

  官网

Gate.io

  官网

Bitget

  官网

deepcoin

  官网
热门文章
  • 区块链社区有哪些?区块链社区是什么?

    区块链社区有哪些?区块链社区是什么?
    展开全文...
  • 0.00006694个比特币等于多少人民币/美金

    0.00006694个比特币等于多少人民币/美金
    0.00006694比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00006694比特币等于4.53424784美元/32.5436 16人民币。比特币(BTC)美元(USDT)人民币(CNY)0.000066944.53424784【比特币密码】32.82795436 16比特币对人民币的最新汇率为:490408.64 CNY(1比特币=490408.64人民币)(1美元=7.24人民币)(0.00006694USDT=0.0004846456 CNY)汇率更新时...
  • 0.00003374个比特币等于多少人民币/美金

    0.00003374个比特币等于多少人民币/美金
    0.00003374比特币等于多少人民币?根据比特币对人民币的最新汇率,0.00003374比特币等于2.2826 1222美元/16.5261124728人民币。比特币(BTC)美元(USDT)人民币(CNY)0.00003374克洛克-0/22216.5261124728比特币对人民币的最新汇率为:489807.72 CNY(1比特币=489807.72人民币)(1美元=7.24人民币)(0.00003374USDT=0.0002442776 CNY)。汇率更新于2024...
  • 0.00015693个比特币等于多少人民币/美金

    0.00015693个比特币等于多少人民币/美金
    0.000 15693比特币等于多少人民币?根据比特币对人民币的最新汇率,0.000 15693比特币等于10.6 1678529美元/76.86554996人民币。比特币(BTC)【比特币价格翻倍】美元(USDT)人民币(CNY)0.000/克洛克-0/5693【数字货币矿机】10.6 167852976.8655254996比特币对人民币的最新汇率为:489,807.72 CNY(1比特币= 489,807.72人民币)(1美元=7.24人民币)(0.00015693 U...
  • 2018-5-31币圈简报

    2018-5-31币圈简报
    一、要闻资讯类I. KEY INFORMATION CATEGORY1、央视:数字货币在京揭牌成立!中国或为此突变!1. View: Digital currency is established in Kyoto! China or mutated for it!中国数字货币来了˂a href="https://mp.weixin.qq.com/s/69fxKCf8GKSCscS4lT8WCA" Target="_blank"rel="noformlow"" Chinese...
标签列表