I am simplying trying to create a new contract on the testnet. I am using IFURA as a node and here is my code:

var createInvoice = function(){
    fs.readFile('./ethereum/contracts/invoice.sol', 'utf8', function(err, contractCode) {
        if(err) console.log("error: " + err);
        var contractCompiled = solc.compile(contractCode, 1); // 1 activates the optimiser
        for (var contractName in contractCompiled.contracts) {
            var greeterContract = web3.eth.contract(JSON.parse(contractCompiled.contracts[contractName].interface));
            greeterContract.new({from:wallet, data: contractCompiled.contracts[contractName].bytecode, gas: 1000000}, function(e, contract){
                if(!e) {
                    if(!contract.address) {
                        console.log("Contract transaction send: TransactionHash: " + contract.transactionHash + " waiting to be mined...");
                    } else {
                        console.log("Contract mined! Address: " + contract.address);
                } else {
                    console.log("web3js error: " + e);

I keep getting the same error:

web3js error: Error: Invalid JSON RPC response: ""

I am not sure what could cause the error, it seems like my code works but the parameters that I parse to greeterContract.new are not correct but I am not sure which one.

Thanks for the help.

  • 1
    That error usually is caused by the node not accepting your commands. I'd check if your connection to infura is working correctly.
    – Ismael
    Aug 4, 2017 at 15:06

1 Answer 1


The Problem is that I could simply not access my IFURA Node, I changed it to a localhost node and it worked fine.

  • Adding my INFURA key to a secret file also worked for me. Dec 14, 2017 at 22:21

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.