TransWikia.com

LoadCredentials function returns file not found exception

Ethereum Asked by aib92 on December 23, 2021

I am using the following code to deploy my contract:

@RequestMapping("/")
public String index() throws Exception {
    Web3j web3j = Web3j.build(new HttpService("https://rinkeby.infura.io/v3/2a42af3ce74e407cae9e20a7e7001ddb"));

    String walletId = "97a0987c270cd6cfa77972b83026eb56524857c5";
    String walletSource = "~/testnet-keystore/UTC--2018-09-26T00-58-36.238000000Z--" + walletId + ".json";
    Credentials credentials = WalletUtils.loadCredentials("admin1234", walletSource);

    ProofOfExistence contract = ProofOfExistence.deploy(web3j, credentials, Contract.GAS_PRICE, Contract.GAS_LIMIT).send();;
       String contractAddress = contract.getContractAddress();
       return "Contract is deployed at address: " + contractAddress;
}

But i am getting this error:
“java.io.FileNotFoundException: ~/testnet-keystore/UTC–2018-09-26T00-58-36.238000000Z–97a0987c270cd6cfa77972b83026eb56524857c5.json”

Can anyone tell me what am i doing wrong??

One Answer

Found the solution: I had to add json file in my resource folder of spring boot application.

Answered by aib92 on December 23, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP