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 = null;
int sleepDuration = 2 * 1000;
int attempts =50;
final ClientTransactionManager clientTransactionManager = new ClientTransactionManager(this.quorum, ethFirstAccount, ethFirstAccount, privateFor);

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

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


public class PersonalGasProvider extends StaticGasProvider {
    public static final BigInteger GAS_LIMIT = DefaultGasProvider.GAS_LIMIT;
    public static final BigInteger GAS_PRICE = BigInteger.ZERO;

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

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

Exception in thread "main" org.web3j.protocol.exceptions.TransactionException: Transaction receipt was not generated after 100 seconds for transaction: 0xbb0792515b9b84bb6d41956925027db0d8b4636470c475987b882993a257f974 at org.web3j.tx.response.PollingTransactionReceiptProcessor.getTransactionReceipt(PollingTransactionReceiptProcessor.java:51) at org.web3j.tx.response.PollingTransactionReceiptProcessor.waitForTransactionReceipt(PollingTransactionReceiptProcessor.java:29) at org.web3j.tx.TransactionManager.processResponse(TransactionManager.java:72) at org.web3j.tx.TransactionManager.executeTransaction(TransactionManager.java:51) at org.web3j.tx.ManagedTransaction.send(ManagedTransaction.java:87) at org.web3j.tx.Contract.executeTransaction(Contract.java:291) at org.web3j.tx.Contract.create(Contract.java:333) at org.web3j.tx.Contract.deploy(Contract.java:387) at org.web3j.tx.Contract.lambda$deployRemoteCall$10(Contract.java:496) at org.web3j.protocol.core.RemoteCall.send(RemoteCall.java:30)

This java code works randomly because 10% of the executions the code finish the execution succesfully. But The other 90% of the executions appear the error.

The flow is the following:

  1. Quorum 7nodes example deployed into a remote server
  2. Smart-contract wrappers packaged into a JAR
  3. A simple code execute the wrappers deploy method

Any idea about what happend?

EDIT

With this chages the error persist and the IDE warn me about that deploy constructor is deprecated

final ClientTransactionManager clientTransactionManager = new ClientTransactionManager(this.quorum, ethFirstAccount, /* ethFirstAccount */null, privateFor, attempts, sleepDuration);
final Users users = Users.deploy(this.quorum, clientTransactionManager, BigInteger.valueOf(0), BigInteger.valueOf(30000000) /* contractGasProvider */).send();
1

I've seen that issue before when the transaction was stuck on the pending queue (on an older version of quorum with a defect that could cause transactions to be stuck pending). I suggest you check that the transaction is hitting the geth node, and whether it's stuck on the pending queue. If you have an old quorum version then try v2.2.3.

I don't have the Token contract code, but I tried your code with a SimpleContract and it works fine for me, except that I had to use my own GasProvider to get it to compile:

public class DeployGasProvider extends StaticGasProvider{

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

Here is the code I'm using:

ClientTransactionManager clientTransactionManager = new ClientTransactionManager(this.quorum, ethFirstAccount, ethFirstAccount, privateFor);

ContractGasProvider contractGasProvider = new DeployGasProvider();
SimpleStorage tokens = SimpleStorage.deploy(this.quorum, clientTransactionManager, contractGasProvider).send();
  • The trasanction appear pending in the geth console. Can you provide the values that you set to the GAS_PRICE and GAS_LIMIT values? Now I´m going to try increasing the version o fQuorum. Actually Im using the quorum 2.2.1 version. I will notice you the advances. Many thxs !! – UnexpectedCharacter Apr 29 at 6:39
  • 1
    I'm using the values from the default: GAS_LIMIT = 4300000L GAS_PRICE = 22000000000L – Satpal Sandhu Apr 29 at 10:15
  • Ok Im going to apply the values. But in a a Quorum environment it have sense to give a GAS_PRICE?? – UnexpectedCharacter Apr 29 at 11:11
  • 1
    You're correct - it doesn't really make sense to supply a GAS_PRICE, but I believe it is replaced with zero under the covers (else my transactions would have been rejected by quorum). Personally, I prefer to keep the GAS_PRICE, to keep the code more 'standard'. – Satpal Sandhu Apr 29 at 15:22
  • Now the smart-contract deploy works fine. I increase the Quorum version to the 2.2.3. So many thanks !! – UnexpectedCharacter May 2 at 8:38

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.