欢迎光临散文网 会员登陆 & 注册

多链钱包系统开发详细及方案,多链钱包开发源码

2023-02-27 15:43 作者:Nv_mrsfu123  | 我要投稿

单链钱包通常被称为主链钱包。这种钱包一般是针对渠道型公链开发的。比方IM Token版和MetaMask(许多朋友叫它小狐狸钱包)都是以太坊单链钱包,所以只支撑使用相同规范的ETH和ERC-20令牌。 多链钱包 多链钱包简单来说便是能够支撑多个主链渠道令牌的钱包。常见的多链钱包有Bitter、imToken2.0、Cobo钱包等。  /**  * entropy为上面通过SecureRandom生成的随机数组  **/  public List toMnemonic(byte[] entropy) throws MnemonicException.MnemonicLengthException {     //为了减少字数删来检查参数的代码           //计算entropyhash作为后面的checksum     byte[] hash = Sha256Hash.hash(entropy);详情开发I59案例2OO7需求3O69     //将hash转换成二进制,true为1,false为0。详情请看bytesToBits函数的解析     boolean[] hashBits = bytesToBits(hash);           //将随机数组转换成二进制     boolean[] entropyBits = bytesToBits(entropy);           //checksum长度     int checksumLengthBits = entropyBits.length / 32;       // 将entropyBits和checksum加起来,相当于BIP39中的ENT+CS     boolean[] concatBits = new boolean[entropyBits.length + checksumLengthBits];     System.arraycopy(entropyBits, 0, concatBits, 0, entropyBits.length);     System.arraycopy(hashBits, 0, concatBits, entropyBits.length, checksumLengthBits);       /**     *this.wordList是助记词列表。开发源码版:yy625019      *      **/     ArrayList words = new ArrayList<>();           //助记词个数     int nwords = concatBits.length / 11;     for (int i = 0; i < nwords; ++i) {       int index = 0;       for (int j = 0; j < 11; ++j) {         //java中int是由32位二进制组成,index左移1位,如果concatBits对应的位为true则将index对应的位设置位1         index <<= 1;         if (concatBits[(i * 11) + j])           index |= 0x1;       }开发逻辑:mrsfu123       //根据索引从助记词列表中获取单词并添加到words       words.add(this.wordList.get(index));     }     //得到的助记词       return words;       }

多链钱包系统开发详细及方案,多链钱包开发源码的评论 (共 条)

分享到微博请遵守国家法律