- 确定性钱包
- 非确定性钱包
最开始, 比特币的私钥是通过一定的算法直接随机生成的, 然后再通过私钥计算出公钥, 公钥计算出地址; 每个私钥之间是毫无关联的, 都是独立的, 一个私钥也就是一个钱包, 所以称之为非确定性钱包;
但是这种钱包存在一个问题, 某些人或者公司拥有很多个私钥的时候就不好管理了, 丢了几个也毫不知觉;
At first, Bitcoin's private key was generated directly and randomly through a certain algorithm, and then the public key was calculated, and the address was calculated by the public key; there was no connection between each private key, it was independent, and one private key was a wallet, so it was called a non-determinate wallet;
, but there was a problem with that wallet, and it was difficult to manage when some people or companies had many private keys, and missing a few were not aware of it.
因为非确定性钱包管理起来不方便, 所以Bitcoin Improvement Proposals就推出了功能更加强大的bip32协议, 这种钱包也称之为确定性钱包;
Because it is not easy to manage a non-determinative wallet, Bitcoin Improvement Projects has launched a more powerful bit32 agreement, also known as a determinative wallet.
-
bip32协议
bip32是随机生成一个种子, (种子大概长这样 2056950ac942cc5fc7b2a3c4ad222417685a3f5c7f0bdc686f87552dc63d13cc78a80689889f0f0208e9f07ebf749a12bbeae876a5027c6cd3116bbadcca15f6), 然后通过这个种子去计算出公私钥和地址, 并且可以生成N多个私钥, 每个私钥都是有序的;
用户只需要保存好一个种子, 就掌控了多个私钥, 方便管理;
请看下图, 就是通过种子生成的有序的私钥
供上地址: https://iancoleman.io/bip39/
但是bip32也存在一个问题, 就是这个种子可读性差, 又长又难记;
-
bip39协议
就bip32协议的种子可读性差的问题, 推了bip39协议;
bip39增加了助记词这样一个概念, 简单来说就是在助记词库里面随机生成助记词, 然后再通过助记词去计算出种子, 这样用户只需要保存助记词就好了, 助记词虽然也不好记, 但是比起种子还是要好很多;
助记词库地址: https://github.com/bitcoin/bips/tree/master/bip-0039
助记词提示: 并不是你在助记词库里面随便选12个单词出来就是一个可用的助记词, 他是有一定的算法规定的; 不然人为挑选的话很容易重复的, 就像我们取游戏网名一样, 经常该网名已被使用对吧;
wordtips:
-
bip44协议
随着后来币的种类越来越多, 就推出了bip44协议;
bip44协议增加了多币种概念, 就是不仅可以通过一个种子计算出多个私钥, 还可以计算出多种币的私钥, 也是有序的; 也就意味着你只需要一个助记词就可以管理各种币, 这样的钱包就更方便了;
- 先安装包
- BTC
- ETH
-
其它币种也是类似的写法
币种类和参数对照表网址: https://github.com/satoshilabs/slips/blob/master/slip-0044.md
这里有一个疑问: 既然bip44协议就可以生成不同币种的私钥, 那为什么计算btc私钥需要导入bitcoinjs-lib包, 计算eth私钥需要导入ethers包, 按道理应该使用bip44协议就可以完成一切啊; 我给出的答案是格式问题, 因为每个币种的私钥,公钥,地址格式是不一样的, 需要导入对应的包, 计算出标准的格式;
questions: Since the bip44 agreement can generate private keys in different currencies, why the calculation of the btc private key requires the import of the bitcoinjs-lib package, the calculation of the beth private key requires the import of the ethers package, which should logically be done by using the bip44 protocol; I give the answer to the question of the format, because the private key of each currency, the public key, the address format is different, the corresponding package needs to be imported and the standard format is calculated;
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论