區塊鏈多鏈錢包開發詳情版丨區塊鏈多鏈錢包系統開發實現技術方案及邏輯

xiaofufu發表於2023-02-27

  It can be divided into single-currency wallet,multi-currency wallet and all-currency wallet


  Single currency wallet:As the name implies,it is a blockchain wallet that only serves a single blockchain digital asset.Because it usually only supports a single blockchain main chain platform,it is also called the main chain wallet,which is generally developed by the project party or community.


  Multi-currency wallet:a wallet that supports multiple blockchain digital assets.Multiple blockchain digital assets can be a blockchain main chain and tokens set around the main chain protocol,or different digital assets on multiple blockchain main chains.


  All-currency wallet:a blockchain wallet that supports all types of blockchain main chain digital assets and token assets.


  public DeterministicSeed(byte[]entropy,String passphrase,long creationTimeSeconds){詳情及方案:MrsFu123


  ...


  this.seed=MnemonicCode.toSeed(mnemonicCode,passphrase);


  ...


  }


  public static byte[]toSeed(List<String>words,String passphrase){


  checkNotNull(passphrase,"A null passphrase is not allowed.");


  //To create binary seed from mnemonic,we use PBKDF2 function


  //with mnemonic sentence(in UTF-8)used as a password and


  //string"mnemonic"+passphrase(again in UTF-8)used as a


  //salt.Iteration count is set to 4096 and HMAC-SHA512 is


  //used as a pseudo-random function.Desired length of the


  //derived key is 512 bits(=64 bytes).


  //將助記詞連線起來,以空格作為分隔符。pass格式:"aa bb cc dd..."


  String pass=Utils.SPACE_JOINER.join(words);


  String salt="mnemonic"+passphrase;


  final Stopwatch watch=Stopwatch.createStarted();


  //使用PBKDF2SHA512生成64位的種子


  byte[]seed=PBKDF2SHA512.derive(pass,salt,PBKDF2_ROUNDS,64);


  watch.stop();


  log.info("PBKDF2 took{}",watch);


  return seed;


  }


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69956839/viewspace-2937214/,如需轉載,請註明出處,否則將追究法律責任。

相關文章