Skip to content

Instantly share code, notes, and snippets.

@linagee
Last active June 10, 2021 17:03
Show Gist options
  • Save linagee/c011d1a2f7de0c359d07 to your computer and use it in GitHub Desktop.
Save linagee/c011d1a2f7de0c359d07 to your computer and use it in GitHub Desktop.
var helloEthereumContract = 'contract testContract { function go() constant returns (string) { return "Hello Ethereum!"; }}'
var helloEthereumCompiled = web3.eth.compile.solidity(helloEthereumContract)
var ethereumContract = web3.eth.contract(helloEthereumCompiled.testContract.info.abiDefinition);
var helloEthereum = ethereumContract.new({from:eth.coinbase, data: helloEthereumCompiled.testContract.code, gas: 199352}, function(e, contract){
console.log("CALLBACK!");
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);
console.log(contract);
}
} else {
console.log("error");
console.log(e);
}
})
(Once it has been deployed, takes some time, check TX on etherchain.org)
helloEthereum.go()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment