0

Very new to Geth and Ethereum, and I'm just trying to create my first contract and deploy it to my private blockchain using Geth.

Geth version 1.7.3

Below is my Solidity contract code:

pragma solidity ^0.4.8;

contract Test {
uint256 public value;

function Test() {
    value = 123;    
}
}

I have compiled this contract with the browser compiler and Copying the Web3 deployment instructions from the Remix browser compiler into geth console, and I have also tried using the built in solidity compiler on my mac to compile and create a new contract. i'll note I'm not compiling from inside geth console, as I know that doesn't work anymore, I keep getting the error when I call:

testContract.new(<ContractCode>)

Below is the output of the code I run with the compiled contract with the error:

var test = testContract.new({ from: eth.accounts[0], data: "0x" + testOutput.contracts["Test.sol:Test"].bin, gas: 18000000000},
function (e, contract) {
  console.log(e, contract);
  if (typeof contract.address !== 'undefined') {
  var test = testContract.new({ from: eth.accounts[0], data: "0x" + 
  testOutput.contracts["Test.sol:Test"].bin, gas: 18000000000},
    function (e, contract) {
    console.log(e, contract);
    if (typeof contract.address !== 'undefined') {
    console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
  }
});
Error: exceeds block gas limit undefined
  • I've done a lot of research on this issue. I have tried to start my geth node using " --targetgaslimit " with an exorbitantly high value and that still gives me the "Error: exceeds block gas limit undefined" – Nate Schreiner Dec 16 '17 at 19:22
  • LINK TO STACKEXCHANGE ANSWER I WAS TRYING ethereum.stackexchange.com/questions/15435/… – Nate Schreiner Dec 16 '17 at 19:23
0

If your error is in geth, then I can recommend you to read this article about Deploying A Smart Contract. Be sure to set your private chain correct, to have account, to have balance >0, to unlockAccount before deploying contract.

As you've mentioned in your question that you are new to geth. It might be helpful to point that before you dive into deploying smart contracts in geth, be sure to read some articles on how to set up ethereum node using geth. Hope that will help!

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.