I am getting an error today, when tried to mine a contract to ethereum testnet. Even after the transaction is mined successfully (I can check that in the Testnet), the call back is executing the code inside the error.
The callback function in my java script as follows:
function mine_pContract(byteCode, abi, estimatedGas) {
console.log(abi);
var MyContract = web3.eth.contract(JSON.parse(abi));
var myContractReturned = MyContract.new({
from: web3.eth.accounts[0],
data: byteCode,
gas:estimatedGas}, function(err, myContract) {
if (err) {
console.log("Error while mining the contract" + err)
}
else {
if (!myContract) {
console.log("Contract transaction sent. Transaction Hash" + myContract.transactionHash + "waiting to be mined");
}
else {
if (myContract.address === undefined) {
console.log("still mining. Transaction Hash= " + myContract.transactionHash)
}
else {
console.log("Contract mined. Address" + myContract.address);
}
}
}
});
}
The output is: still mining. Transaction Hash= 0x859cbff73bf7da136f1b5402f1d9a7948608d6ef82c9e5f956db3e576fa5d720 main.js:262
Error while mining the contractError: The contract code couldn't be stored, please check your gas amount.
But it was supposed to showthe following message Contract mined. Address: 0xxxxxxxx.
Any one can point out where is the problem?