org.web3j.crypto.Wallet.createStandard()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(1.7k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中org.web3j.crypto.Wallet.createStandard()方法的一些代码示例,展示了Wallet.createStandard()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Wallet.createStandard()方法的具体详情如下:
包路径:org.web3j.crypto.Wallet
类名称:Wallet
方法名:createStandard

Wallet.createStandard介绍

暂无

代码示例

代码示例来源:origin: web3j/web3j

public static String generateWalletFile(
    String password, ECKeyPair ecKeyPair, File destinationDirectory, boolean useFullScrypt)
    throws CipherException, IOException {
  WalletFile walletFile;
  if (useFullScrypt) {
    walletFile = Wallet.createStandard(password, ecKeyPair);
  } else {
    walletFile = Wallet.createLight(password, ecKeyPair);
  }
  String fileName = getWalletFileName(walletFile);
  File destination = new File(destinationDirectory, fileName);
  objectMapper.writeValue(destination, walletFile);
  return fileName;
}

代码示例来源:origin: web3j/web3j

@Test
public void testEncryptDecryptStandard() throws Exception {
  testEncryptDecrypt(Wallet.createStandard(SampleKeys.PASSWORD, SampleKeys.KEY_PAIR));
}

代码示例来源:origin: web3j/web3j

@Test
public void testCreateStandard() throws Exception {
  testCreate(Wallet.createStandard(SampleKeys.PASSWORD, SampleKeys.KEY_PAIR));
}

代码示例来源:origin: ethjava/web3j-sample

/**
 * 创建钱包
 *
 * @param password 密码
 */
public static void createWallet(String password) throws InvalidAlgorithmParameterException, NoSuchAlgorithmException, NoSuchProviderException, CipherException, JsonProcessingException {
  WalletFile walletFile;
  ECKeyPair ecKeyPair = Keys.createEcKeyPair();
  walletFile = Wallet.createStandard(password, ecKeyPair);
  System.out.println("address " + walletFile.getAddress());
  ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper();
  String jsonStr = objectMapper.writeValueAsString(walletFile);
  System.out.println("keystore json file " + jsonStr);
}

相关文章

微信公众号

最新文章

更多