6

I'm trying to deploy a smart contract (7 nodes sample from Quorum) using web3j. It fails at get() to get the contract wrapper object. If I check the logs, a new transaction will show up, but if I call any contract function, it will give me a null pointer exception. My code looks like this:

    String deployeraccount = "0xed9d02e382b34818e88b88a309c7fe71e65f419d";
    String privfor = "QfeDAys9MPDs2XHExtc84jKGHxZg/aj52DTh0vtA3Xc=";

    try {

        Quorum quorum = Quorum.build(new HttpService("http://localhost:22000"));

        ClientTransactionManager transactionManager = new ClientTransactionManager(
                quorum, deployeraccount, Arrays.asList(privfor));

        BigInteger gasPrice = BigInteger.valueOf(30000);
        BigInteger gasLimit = BigInteger.valueOf(100000); 
        BigInteger initialWeiValue = BigInteger.valueOf(0);
        Uint256 initVal = new Uint256(BigInteger.valueOf(0));

        System.out.println(">> Before deploy");

        Future<Simplestorage> ft = Simplestorage.deploy(    quorum, 
                                                            transactionManager, 
                                                            gasPrice, 
                                                            gasLimit, 
                                                            initialWeiValue, 
                                                            initVal     );
        System.out.println(">> deploy");

        while (!ft.isDone()) {
                Thread.sleep(500);
        }

        System.out.println(">> after wait");

        Simplestorage ss = ft.get();

I already tried changing the gas value, but still got the same issue. Thanks.

  • I used the default wrapperobject.GAS_PRICE and wrapperobject.GAS_LIMIT. Now it works. – vincent Aug 3 '17 at 7:32
  • 1
    Could you create an answer adding a few more details of what you did? Comments shouldn't be relied on to exist forever, and if you add an answer it may get some upvotes :-) – Richard Horrocks Aug 22 '17 at 15:53
  • @RichardHorrocks I added that thin information as an answer. I did make it a community wiki though, as I didn't feel comfortable getting credit for an answer that wasn't mine. Plus a community wiki allows people to enhance it. – David Ammouial Feb 21 '18 at 1:27
  • This implementation now is deprecated with the quorum 4.0.6v. Do you update de Web3j quorum version?? – UnexpectedCharacter Feb 7 at 8:10
0

Note: This is a community wiki from the author's own response in a comment. Let's improve on it.

I used the default wrapperobject.GAS_PRICE and wrapperobject.GAS_LIMIT. Now it works.

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.