1

SCENARIO:

I have the following code:

final String hostUrl = this.deployerProperties.getProperty("quorum.host.url");
final String hostPort = this.deployerProperties.getProperty("quorum.host.port");
final String host = hostUrl + ":" + hostPort;
final HttpService httpService = new HttpService(host);

this.admin = Admin.build(httpService);
this.quorum = Quorum.build(httpService);

final EthAccounts ethAccounts = this.quorum.ethAccounts().send();
final String ethFirstAccount = ethAccounts.getAccounts().get(0);
final PersonalUnlockAccount personalUnlockAccount = this.admin.personalUnlockAccount(ethFirstAccount, "").send();
if (!personalUnlockAccount.accountUnlocked()) {
        throw new IllegalStateException("Account " + ethFirstAccount + " can not be unlocked!");
} 

final List<String> privateFor = new ArrayList<>();
final ClientTransactionManager clientTransactionManager = new ClientTransactionManager(this.quorum, ethFirstAccount, ethFirstAccount, privateFor);

final ContractGasProvider contractGasProvider = new DefaultGasProvider();
//final ContractGasProvider contractGasProvider = new DeployGasProvider();

final Tokens tokens = Tokens.deploy(this.quorum, clientTransactionManager, contractGasProvider).send();

When I execute the code. I get the following error:

Caused by: java.lang.RuntimeException: Error processing transaction request: Non-200 status code: &{Status:400 Bad Request StatusCode:400 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Content-Type:[text/plain] Content-Length:[96] Connection:[keep-alive]] Body:0xc423004080 ContentLength:96 TransferEncoding:[] Close:false Uncompressed:false Trailer:map[] Request:0xc4200ea500 TLS:}

The line that make the Token deploy breaks the execution. Googleing I found similar issue in this site: LINK So I decided to create my own GasProvider.

import org.web3j.tx.gas.StaticGasProvider;
import java.math.BigInteger;
import org.web3j.tx.ManagedTransaction;

@SuppressWarnings("deprecation")
public class DeployGasProvider extends StaticGasProvider{


public static final BigInteger GAS_LIMIT = BigInteger.valueOf(22_000_000_000L);

public static final BigInteger GAS_PRICE = ManagedTransaction.GAS_PRICE;

    public DeployGasProvider() {
        super(GAS_PRICE, GAS_LIMIT);
    }
}

But the error persists. The environment is the following:

  • Web3jQuorum v4.0.6
  • Quorum v2.2.21
  • Solcjs v0.4.24

I try fixing with this post answer. But still returning the same

1 Answer 1

3

The issue here is that you've provided a 'privateFor' value - quorum therefore treats it like a private transaction; however the privateFor value you've provided is an empty list, so it gets rejected. If you provide a null value for privateFor then you'll find that it works fine.

(BTW that GASLIMIT value in DeployGasProvider is pretty high, so you may find that it fails due to exceeding the block gas limit.)

2
  • Nice men, that solve my issue. Many thanks !!! Mar 20, 2019 at 9:11
  • Im going to change the gasLimit but in the moment i´m was usign this value po testing porpouse Mar 20, 2019 at 9:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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