Поднимаем ноду


 Нужно   Geth   Mist wallet    

   Geth - поднимает ноду.  

geth --fast --cache 1024 --dev --rpc --rpcaddr "0.0.0.0" --rpcapi "admin,debug,miner,shh,txpool,personal,eth,net,web3" console

personal.newAccount("123")

eth.accounts

miner.setEtherbase(eth.accounts[0])
eth.coinbase
miner.start()
miner.stop()
eth.getBalance(eth.coinbase)

loadScript("geth_scripts.js")
checkAllBalances()

%appdata%\Ethereum

 

function checkAllBalances() {
    var totalBal = 0;
    for (var acctNum in eth.accounts) {
        var acct = eth.accounts[acctNum];
        var acctBal = web3.fromWei(eth.getBalance(acct), "ether");
        totalBal += parseFloat(acctBal);
        console.log("  eth.accounts[" + acctNum + "]: \t" + acct + " \tbalance: " + acctBal + " ether");
    }
    console.log("  Total balance: " + totalBal + " ether");
};

 

 Поднияли ноду , запустили майнер , теперь можно запустить кошелек

mist.exe --rpc http://localhost:8545

 

генезис

Терь созданим определенный заранее блокчейн , для этого нужен файл генезиса

geth --fast --cache 1024  --datadir "c:/private-chain-data/"  init "c:/genesis.json"

geth --networkid 15 --fast --cache 1024  --datadir "c:/private-chain-data/" --rpc --rpcaddr "0.0.0.0" --rpcapi "admin,miner,shh,txpool,personal,eth,net,web3"   console

 

 

Пишем контракт

web3.fromWei(eth.getBalance(eth.coinbase),"ether")
eth.sendTransaction({from:  'ваш_адрес', to: 'адрес_получателя', value: web3.toWei(1, "ether")})