[Ethereum] How to Unlock account via web3js without geth(web3-extended doesn’t work)


Need to unlock account to call contracts functions on client side. So i need to use web 3 or web 3 extanded. But it doesn't work.Method are not availebly.
Maybe you know some others ways how to call function specially in IOS-app.

Best Answer

You can invoke the unlockAccount method of personal from your Web application. I am using Web3 0.18.2 version.

In the below mentioned method call last parameter is duration i.e how long the account will be kept unlocked in seconds. It is optional. You can use any of the ways.

When you start your node using Geth you need to expose personal through rpc. I use this parameter "--rpcapi "db,eth,net,web3,personal". Although it is not recommended to expose personal over rpc.

Code Sample
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545")); web3.personal.unlockAccount("(account address)", "(pass phrase)");

web3.personal.unlockAccount("(account address)", "(pass phrase)", 500);

Related Topic