Solidity Deployment – Error: Authentication Needed: Password or Unlock in Chrome Plugin

remixsolidity

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'.

Authorization error

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:

geth --datadir ~/ethereum-private-network/chaindata --nodiscover --rpc --rpccorsdomain "*" --unlock <addressWithoutQuotes> --password <passwordWithoutquotes>

or

geth --datadir ~/ethereum-private-network/chaindata --nodiscover --rpc --rpccorsdomain "*" --unlock <addressWithoutQuotes>

after this, you will get something like:

INFO [03-03|21:56:51] Starting peer-to-peer node               
instance=Geth/v1.7.3-stable-4bb3c89d/windows-amd64/go1.9
INFO [03-03|21:56:51] Allocated cache and file handles      
INFO [03-03|21:56:51] Disk storage enabled for ethash DAGs     
INFO [03-03|21:56:51] Initialising Ethereum protocol 
INFO [03-03|21:56:51] Loaded most recent local header
<some more information>
INFO [03-03|21:56:51] Starting P2P networking
INFO [03-03|21:56:51] RLPx listener up                         
INFO [03-03|21:56:51] HTTP endpoint opened: http://127.0.0.1:8545
Unlocking account 0x3230248b2c3dade18a183bb168fa6ff97fe5030f | Attempt 1/3
Passphrase: INFO [03-03|21:56:51] IPC endpoint opened: \\.\pipe\geth.ipc
<it will wait for few seconds here, type the password>
<some more information>
INFO [03-03|21:56:53] Mapped network port 
INFO [03-03|21:56:55] Unlocked account                        
address=0x3230248b2C3dADe18a183bB1E8Fa6ff97fE5030F

And the account will be unlocked.

Related Topic