This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var greeterSource = 'contract greeter { function greet(bytes32 input) returns(bytes32) { if (input == "") { return "Hello, World!"; } return input; } }' | |
var greeterCompiled = eth.compile.solidity(greeterSource).greeter | |
var primaryAccount = eth.accounts[0] | |
var greeterAddress = eth.sendTransaction({data: greeterCompiled.code, from: primaryAccount}); | |
//var greeterAddress = eth.sendTransaction({data: greeterCompiled.code, from: primaryAccount, gas: 100000, gasPrice: web3.toWei(10, "szabo")}); | |
greeterContract = eth.contract(greeterCompiled.info.abiDefinition); | |
greeterInstance = new greeterContract(greeterAddress); | |
greeterInstance.greet.call(""); | |
//greeterInstance.greet.call("Hi"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> loadScript('multiplycontract3.js'); | |
I0623 00:53:34.579946 7800 api.go:38] eth_compileSolidity ["contract test { f | |
unction multiply(uint a) returns(uint d) { return a * 7; } }"] | |
conI0623 00:53:34.883964 7800 api.go:38] eth_coinbase [] | |
tract.info.abI0623 00:53:34.887964 7800 api.go:38] eth_sendTransaction [{"dat | |
a":"0x601880600c6000396000f30060e060020a6000350463c6888fa181146000575b91905056", | |
"from":"0x5a94963b463aab83b683d5367ed4e877245c1e16"}] | |
iDefinition==[object Object] | |
I0623 00:53:34.896964 7800 transaction_pool.go:216] (t) 3561393439363362 => [ | |
NEW_CONTRACT] (0x69ed40) 5b53f3e1c5889d0783f61cf97ea180630b65b4be04cb9428d8045ea |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source = "contract test { function multiply(uint a) returns(uint d) { return a * 7; } }" | |
contract = eth.compile.solidity(source).test; | |
MyContract = eth.contract(contract.info.abiDefinition); | |
myMultiply7 = MyContract.new({from: web3.eth.coinbase, data: contract.code}) | |
console.log("calling myMultiply7.multiply.call(6, {from:web3.eth.coinbase}"); | |
fortytwo = myMultiply7.multiply.call(6, {from:web3.eth.coinbase}); | |
console.log("result="+fortytwo); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please unlock account 5a94963b463aab83b683d5367ed4e877245c1e16. | |
Passphrase: | |
Account is now unlocked for this session. | |
I0622 14:06:04.972357 7216 transaction_pool.go:216] (t) 3561393439363362 => [NEW_CONTRACT] (0x69ed40) 9aff116f24c8b6fda475f8ecc564aeaedf95ba79724ec0cf95572b6 | |
7e4c0c531 | |
I0622 14:06:04.976357 7216 xeth.go:977] Tx(9aff116f24c8b6fda475f8ecc564aeaedf95ba79724ec0cf95572b67e4c0c531) created: 91e1f6f1cb49d5348c3a430e159b38ace2d5ec7 | |
4 | |
I0622 14:06:04.979357 7216 state_object.go:199] 5a94963b463aab83b683d5367ed4e877245c1e16: #0 1022195609807912070000 (- 101265192087930000) | |
I0622 14:06:04.983357 7216 statedb.go:228] (+) 91e1f6f1cb49d5348c3a430e159b38ace2d5ec74 | |
I0622 14:06:04.985357 7216 state_object.go:199] 5a94963b463aab83b683d5367ed4e877245c1e16: #1 1022195609807912070000 (- 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
source = "contract test { function multiply(uint a) returns(uint d) { return a * 7; } }" | |
contract = eth.compile.solidity(source).test; | |
MyContract = eth.contract(contract.info.abiDefinition); | |
address = MyContract.new({from: web3.eth.coinbase, data: contract.code}) | |
console.log("contract created address="+address); | |
var Multiply7 = eth.contract(contract.info.abiDefinition); | |
console.log("Multiply7="+Multiply7); |