0

I am trying to deploy smart contract using web3j. My code is as follows:

 @RequestMapping("/")
    public String index() throws Exception {
        Web3j web3j = Web3j.build(new HttpService("https://rinkeby.infura.io/v3/2a42af3ce74e407cae9e20a7e7001ddb"));
        String walletId = "97a0987c270cd6cfa77972b83026eb56524857c5";
        String walletSource = "resources/testnet-keystore/UTC--2018-09-26T00-58-36.238000000Z--" + walletId + ".json";
        System.out.println(walletSource);
        Credentials credentials = WalletUtils.loadCredentials("admin1234", walletSource);
        System.out.println(credentials);
        ProofOfExistence contract = ProofOfExistence.deploy(web3j, credentials, ProofOfExistence.GAS_PRICE,ProofOfExistence.GAS_LIMIT).send();;
           String contractAddress = contract.getContractAddress();
           return "Contract is deployed at address: " + contractAddress;
    }

I have started my geth console.When i try running the contract. I get funds insufficient error.I am using spring boot to run my applications. Any help would be appreciated!!

  • 1
    Are you sure you have Ether in the account and that you are synced up to date? – Lauri Peltonen Sep 26 '18 at 16:56
  • if you can post the code of your smart contract, that would be better. – Kaki Master Of Time Sep 26 '18 at 17:03
  • I used the following code to run geth "geth --rpcapi personal,db,eth,net,web3 --rpc --testnet --fast". How do i check Ether in the account and that you are synced up to date? @LauriPeltonen – aib92 Sep 26 '18 at 17:05
  • my smart contract code is : pragma solidity ^0.4.15; // Proof of Existence contract, version 1 contract ProofOfExistence { bytes32 public proof; function notarize(string document) { proof = proofFor(document); } function proofFor(string document) constant returns (bytes32) { return sha256(document); } } – aib92 Sep 26 '18 at 17:06
0

I had not funded my account with ether using rinkeby faucet. After funding account, it is giving me the expected output. thank you for the help!!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.