In the greeter tutorial, the greeterContract is deployed using new:

var greeterContract = web3.eth.contract(greeterCompiled.greeter.info.abiDefinition);
var greeter = greeterContract.new(_greeting,{from:web3.eth.accounts[0], data: greeterCompiled.greeter.code, gas: 10000000000000}, function(e, contract){...

What exactly are the arguments I'm providing to the function?

Where in the go-ethereum source code is the new function defined?

Where in the go-ethereum source code is the web3 class defined?

1 Answer 1


The "new" is a nice form to write a sendTransaction.

The web3 interface transform your params using the contract abi to write the sendTransaction command.

contract.new(param_1, param_2, ..., param_n , options, callback)

The first parameters (param_1, .. , param_n) will be passed to your contract constructor.

Only the last two parameters can have extra meaning. See the implementation of function new to check how they check for these parameters.

  • In the greeter tutorial, the callback function is entered line by line on the geth console which i find rather cumbersome. Can I define the callback in a js script and load the function using loadScript and then supply the reference to that function as callback?
    – TMOTTM
    Jun 16, 2016 at 21:02
  • @TMOTTM Sorry, but I don't know. Generally I don't use the geth console for complex things like async transactions.
    – Ismael
    Jun 17, 2016 at 5:24

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.