0

I am running a private Quorum chain consisting of 3 nodes with raft consensus. When I deploy a contract to the chain via web3 I get returned a hash and can then look up the transaction with the local geth console (geth attach qdata/geth.ipc) and check its status with eth.getTransaction(hash), so I get this:

{
  blockHash: "0x0000000000000000000000000000000000000000000000000000000000000000",
  blockNumber: null,
  from: "0xc58a28d310c76e8298fa086381e6f2da9f046c07",
  gas: 4700000,
  gasPrice: 0,
  hash: "0x75bf6fc10400fa493851b8105973e9b5aab2955dc5d87d217f13ed9562ccafbd",
  input: "0xc2f448268ee5019782beeaee884bc92112187a16af7b23df948fd0f867ecb2f41f34f34e477e2ddd53c74ef20fc48b0ebcda0a003f991f9c6e1a4bedfc65288d",
  nonce: 0,
  r: "0x3cd6c0a90a9b2367d6d47f081ad8509ea374f4db54bbf51eb9ace8360e50bc7a",
  s: "0x6d6cabc76a0d7774ada6ba753d06be0400353a5d3d42d85c92c4db7b8ad2f7bd",
  to: null,
  transactionIndex: 0,
  v: "0x26",
  value: 0
}

But there is no address! So why is the transaction still not mined?

EDIT: Here is the code I used to deploy the contract:

const Web3 = require('web3-quorum');
const web3 = new Web3(new Web3.providers.HttpProvider('http://..SERVER_ADDRESS..:22000'));

var abiArray = [{...ABI...}];
var simpleContract = web3.eth.contract(abiArray);
var bytecode = "0x6080604052348...";
const account = '0xc58a28d310c76...';

var nonce = web3.eth.getTransactionCount(account);
const contractData = {
    from: account,
    data: bytecode,
    gas: 0x47b760,
    privateFor: ["oUEMYuV2DOlgk88JxKx..."],
    nonce: '0x' + nonce
};

//contract instance
const contractInstance = simpleContract.new(123, contractData, function(e, contract) {
    if (e) {
        console.log("err creating contract", e);
    } else {
        if (!contract.address) {
            console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");
        } else {
            console.log("Contract mined! Address: " + contract.address);
            console.log(contract);
        }
    }
});
3
  • can you share the code that sent the transaction ? is it inside a loop ? how much did the transaction stay in pending ? – Kaki Master Of Time Dec 18 '18 at 16:42
  • @KakiMasterOfTime sure, I edited my question. Actually the pending tx is not the matter, its more about why there is no contract address after deployment and eth.getTransaction. – sunwarri0r Dec 18 '18 at 18:35
  • 1
    I think you should look at this. github.com/jpmorganchase/quorum/blob/master/docs/api.md#returns thought it might look the same, quorum has some key differences with the base ethereum, I think this is one of them. – Kaki Master Of Time Dec 18 '18 at 19:48
1

This could be maybe due to

  1. The nodes arent synced, so you could restart the whole setup and check do the transactions.
  2. Try to get the confirmations on the transactions done in the console.This code may help you
    web3.eth.sendSignedTransaction("0x" + transaction.serialize().toString('hex'), (_err, _res) => {
        if(_err){
            console.error("ERROR: ", _err);
        } else {
            console.log("success: ", _res);
        }
    }).on('confirmation', (confirmationNumber, receipt) => {
        console.log('=> confirmation: ' + confirmationNumber);
    })
    .on('transactionHash', hash => {       
       res.status(200).json({ Message : "success", Body : hash})
    })
    .on('receipt', receipt => {
        console.log('=> reciept');
        console.log(receipt);
    })
    .on('error', console.error);

});   

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.