I run local private ethereum network using the below commands.
./geth --datadir=./data/test init genesis/genesis.json
./geth --datadir=./data/test --rpc --rpccorsdomain "http://localhost:8000" --rpcapi "db,eth,net,web3,personal,miner" --rpcaddr "localhost" --rpcport "8545"
I have installed chrome plugin for solidity Solidity realtime ethereum compiler and runtime.
I have below contract.
contract CalculatorV2 {
uint result;
event NumberAdded(uint n);
event NumberSubtracted(uint n);
event NumberMultiplied(uint n);
event NumberDivided(uint n);
function CalculatorV2(uint num) {
// constructor
result=num;
}
// returns the result
function getResult() constant returns (uint){
return result;
}
// result = result + num
function addToNumber(uint num) returns (uint) {
result += num;
NumberAdded(num);
return result;
}
// result = result - num
function substractNumber(uint num) returns (uint) {
result -= num;
NumberSubtracted(num);
return result;
}
// result = result * num
function multiplyWithNumber(uint num) returns (uint) {
result *= num;
NumberMultiplied(num);
return result;
}
// result = result / num
function divideByNumber(uint num) returns (uint) {
result /= num;
NumberDivided(num);
return result;
}
}
Then I clicked the node icon on the right side and choose web3 provider with value 'http://localhost:8545'.
When I click create button, this gives to error Error: authentication needed: password or unlock
.
I'm not sure where I've to save the authorize or login to compile and deploy the smart contract.
Best Answer
You can also try like:
or
after this, you will get something like:
And the account will be unlocked.