当前位置: 首页>>代码示例>>Java>>正文


Java WalletUtils.loadCredentials方法代码示例

本文整理汇总了Java中org.web3j.crypto.WalletUtils.loadCredentials方法的典型用法代码示例。如果您正苦于以下问题:Java WalletUtils.loadCredentials方法的具体用法?Java WalletUtils.loadCredentials怎么用?Java WalletUtils.loadCredentials使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.web3j.crypto.WalletUtils的用法示例。


在下文中一共展示了WalletUtils.loadCredentials方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpClass

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
@BeforeClass
    public static void setUpClass() throws IOException, CipherException {

        credentials = WalletUtils.loadCredentials("password", KEY_FILE1);
        testData1 = TestData.staticGenerate(credentials.getAddress());

        parity = Parity.build(new HttpService("http://localhost:8545"));
//        parity.personalUnlockAccount(credentials.getAddress(), "password", new BigInteger("100000"));

        Cmc cmc = Cmc.load(CMC_ADDR, parity, credentials, GAS_PRICE, GAS_LIMIT);
        cmcWrapper = new CmcWrapper(cmc);
        // cmcWrapper.bootstrap();
        String dnsManagerAddress = cmcWrapper.getAddress(APP_NAME);

        SolDnsApp solDnsApp = SolDnsApp.load(dnsManagerAddress, parity, credentials, GAS_PRICE, GAS_LIMIT);
        solDnsAppWrapper = new SolDnsAppWrapper(solDnsApp);
    }
 
开发者ID:kabl,项目名称:sol-dns,代码行数:18,代码来源:SolDnsAppWrapperTest.java

示例2: loadCredentials

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
public static Credentials loadCredentials(EthKeyProperties keyProperties) {
    if (keyProperties.getKeyLocation() != null) {
        try {
            return WalletUtils.loadCredentials(keyProperties.getKeyPassword(), keyProperties.getKeyLocation());
        } catch (Exception e) {
            throw Throwables.propagate(e);
        }
    } else if (keyProperties.getPrivateKey() != null) {
        return Credentials.create(keyProperties.getPrivateKey());
    } else {
        throw new IllegalStateException("Either node.eth.key-location or node.eth.test.private-key required");
    }
}
 
开发者ID:papyrusglobal,项目名称:state-channels,代码行数:14,代码来源:EthereumConfig.java

示例3: getCredentials

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
public Credentials getCredentials() {
    if (credentials != null) {
      return credentials;
    }

    try {
      String fileWithPath = getFile().getAbsolutePath();
      credentials = WalletUtils.loadCredentials(password, fileWithPath);

      // TODO verify again (performance issue gone now?)
// tried to figure out where the time is used up
//      File file = new File(fileWithPath);
//      ObjectMapper objectMapper = ObjectMapperFactory.getObjectMapper(); // 8sec
//      WalletFile walletFile = objectMapper.readValue(file, WalletFile.class);
//      ECKeyPair keyPair = org.web3j.crypto.Wallet.decrypt(password, walletFile); // > 30s
// -> "culprit" is Wallet.generateDerivedScryptKey() inside of Wallet.decrypt
//      Credentials credentials = Credentials.create(keyPair);

      return credentials;
    }
    catch (Exception e) {
      LOG.error("failed to access credentials in file '" + getFile().getAbsolutePath() + "'", e);
      return null;
    }
  }
 
开发者ID:BSI-Business-Systems-Integration-AG,项目名称:trading-network,代码行数:26,代码来源:Account.java

示例4: sign

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
public void sign(String pinCode, WalletInfo walletInfo) throws CantSignedException {
    try {
        final String fullPassword = pinCode + walletInfo.getSalt();

        if (getEcKeyPair() != null) {
            credentials = Credentials.create(getEcKeyPair());
        } else {
            credentials = WalletUtils.loadCredentials(fullPassword, getWalletPath());
        }
    } catch (IOException | CipherException e) {
        e.printStackTrace();
        throw new CantSignedException();
    }
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:15,代码来源:Wallet.java

示例5: getModumToken

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
@Bean
public ModumToken getModumToken() throws IOException, CipherException {
    Web3j web3j = Web3j.build(new HttpService());
    try {
        Credentials credentials = WalletUtils.loadCredentials(password, account);
        return ModumToken.load(contract, web3j, credentials, ManagedTransaction.GAS_PRICE, Contract.GAS_LIMIT);
    } catch (FileNotFoundException e) {
        return null;
    }
}
 
开发者ID:modum-io,项目名称:tokenapp-backend,代码行数:11,代码来源:Web3.java

示例6: getSignedWallet

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
public static Wallet getSignedWallet(String walletFile, String pinCode, String salt)
        throws CantSignedException
{
    try {
        Credentials credentials = WalletUtils.loadCredentials(pinCode + salt, walletFile);
        return new Wallet(walletFile, credentials);
    } catch (IOException | CipherException e) {
        e.printStackTrace();
        throw new CantSignedException();
    }
}
 
开发者ID:humaniq,项目名称:humaniq-android,代码行数:12,代码来源:Wallet.java

示例7: PaperWallet

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
public PaperWallet(String passPhrase, File walletFile) {
	// check if provided file exists
	if(!walletFile.exists() || walletFile.isDirectory()) { 
		System.err.println(String.format("%s file does not exist or is a directory", WALLET_ERROR));
	}
	
	try {
		credentials = WalletUtils.loadCredentials(passPhrase, walletFile);
	} 
	catch (Exception e) {
		System.err.println(String.format("%s failed to load credentials with provided password", WALLET_ERROR));
	}
}
 
开发者ID:matthiaszimmermann,项目名称:ethereum-paper-wallet,代码行数:14,代码来源:PaperWallet.java

示例8: getCredentials

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
public Credentials getCredentials(String passPhrase) throws Exception {
	if (credentials != null) {
		return credentials;
	}

	try {
		String fileWithPath = getFile().getAbsolutePath();
		credentials = WalletUtils.loadCredentials(passPhrase, fileWithPath);

		return credentials;
	}
	catch (Exception e) {
		throw new Exception ("Failed to access credentials in file '" + getFile().getAbsolutePath() + "'", e);
	}
}
 
开发者ID:matthiaszimmermann,项目名称:ethereum-paper-wallet,代码行数:16,代码来源:PaperWallet.java

示例9: getFullWallet

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
public Credentials getFullWallet(Context context, String password, String wallet) throws IOException, JSONException, CipherException {
    if (wallet.startsWith("0x"))
        wallet = wallet.substring(2, wallet.length());
    return WalletUtils.loadCredentials(password, new File(context.getFilesDir(), wallet));
}
 
开发者ID:manuelsc,项目名称:Lunary-Ethereum-Wallet,代码行数:6,代码来源:WalletStorage.java

示例10: loadCredentials

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
public void loadCredentials(String password, File file) throws IOException, CipherException {
  credentials = WalletUtils.loadCredentials(password, file);
}
 
开发者ID:AtlantPlatform,项目名称:atlant-android,代码行数:4,代码来源:MyWallet.java

示例11: PapyrusMember

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
public PapyrusMember(String address, Web3j web3j, File credentials, String pass) throws IOException, CipherException {
    this.address = address;
    this.transactionManager = new RawTransactionManager(web3j, WalletUtils.loadCredentials(pass, credentials));
}
 
开发者ID:papyrusglobal,项目名称:smartcontracts,代码行数:5,代码来源:PapyrusMember.java

示例12: openWallet

import org.web3j.crypto.WalletUtils; //导入方法依赖的package包/类
/**
 * Abrir una cuenta ethereum
 *
 * @param password
 * @param walletName
 * @return
 * @throws Exception
 */
public Credentials openWallet(String password, String walletName) throws Exception {
    Credentials credentials = WalletUtils.loadCredentials(password, WALLET_PATH + walletName);
    return credentials;
}
 
开发者ID:jestevez,项目名称:ethereum-java-wallet,代码行数:13,代码来源:EthereumWallet.java


注:本文中的org.web3j.crypto.WalletUtils.loadCredentials方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。