diff --git a/Test.eth b/Test.eth new file mode 100644 index 0000000..08e9d1c --- /dev/null +++ b/Test.eth @@ -0,0 +1,13 @@ +pragma solidity ^0.4.18; + +contract Test { + int256 a = 0; + + function set(int256 n) public { + a += n; + } + + function get() public constant returns(int256) { + return a; + } +} \ No newline at end of file diff --git a/geth_console.js b/geth_console.js new file mode 100644 index 0000000..741d308 --- /dev/null +++ b/geth_console.js @@ -0,0 +1,29 @@ +var Web3 = require('web3'); +var fs = require('fs'); +var web3 = new Web3(); +web3.setProvider(new web3.providers.HttpProvider('http://home.mrdev023.fr:8545')); + +var account = undefined +if(!fs.existsSync('account.json')){ + var password = Math.random().toString(36).substring(2, 15) + Math.random().toString(36).substring(2, 15);; + web3.eth.personal.newAccount(password).then(function(address){ + var obj = {"address": address, "password": password}; + console.log(address); + fs.writeFile('account.json', JSON.stringify(obj), 'utf8',run); + account = obj + run(); + }) +} else { + fs.readFile('account.json', 'utf8', function readFileCallback(err, data){ + if (err){ + console.log(err); + process.exit(1); + } else { + account = JSON.parse(data); //now it an object + run(); + }}); +} + +function run() { + +} \ No newline at end of file