Skip to content

Instantly share code, notes, and snippets.

@zelig
Created April 27, 2015 12:59
Show Gist options
  • Select an option

  • Save zelig/51b6efba577fb93936c6 to your computer and use it in GitHub Desktop.

Select an option

Save zelig/51b6efba577fb93936c6 to your computer and use it in GitHub Desktop.
primary = eth.accounts[0];
web3.fromWei(eth.getBalance(primary), "ether");
admin.contractInfo.newRegistry(primary)
source = "contract test {\n" +
" /// @notice will multiply `a` by 7.\n" +
" function multiply(uint a) returns(uint d) {\n" +
" a * 7;\n" +
" }\n" +
"} ";
contract = eth.compile.solidity(source);
eth.getBlock("pending", true).transactions
contractaddress = eth.sendTransaction({from: primary, data: contract.code });
//'0x7d96b2e7679a81ac8ccda3b722214577630200a5'
// console.log(contractaddress);
primary = eth.accounts[0];
web3.fromWei(eth.getBalance(primary), "ether");
source = "contract test {\n" +
" /// @notice will multiply `a` by 7.\n" +
" function multiply(uint a) returns(uint d) {\n" +
" a * 7 ;\n" +
" }\n" +
"} ";
eth.getCode(contractaddress)
abiDef = JSON.parse('[{"constant":false,"inputs":[{"name":"a","type":"uint256"}],"name":"multiply","outputs":[{"name":"d","type":"uint256"}],"type":"function"}]')
// contractaddress = '0xe71a03297ea1929bc239757f6f1396d460f5c01d'
var Multiply7 = eth.contract(abiDef);
var multiply7 = new Multiply7(contractaddress);
multiply7.multiply.call(6)
filename = "/tmp/info.json"
contenthash = admin.contractInfo.register(primary, contractaddress, contract, filename);
admin.contractInfo.get(contractaddress);
admin.contractInfo.registerUrl(primary, contenthash, "file://"+filename);
admin.contractInfo.get(contractaddress);
abiDef = JSON.parse('[{"constant":false,"inputs":[{"name":"a","type":"uint256"}],"name":"multiply","outputs":[{"name":"d","type":"uint256"}],"type":"function"}]')
var Multiply7 = eth.contract(abiDef);
var multiply7 = new Multiply7(contractaddress);
multiply7.multiply.call(6)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment