3

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?

3

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.

2
  • 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 '16 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 '16 at 5:24

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.