As far as I understood from the docs there should be a web3.eth.personal object, but there isn't.
This was allredy mentioned in https://github.com/ethereum/web3.js/pull/288 , but the linked Info in the tread is missing. Or is there another way to load and unlock a account with web3?
This is part of the admin interface. We might add it at some point. Especially the c++ implementation will eventually use a nodejs script to attach to the admin interface, which will also need these endpoints.
There there currently no way to load and unlock a account with web3-API?
I can can only work with unlocked user? This will prevent anyone from providing webservices with the API.
Or did I miss something else?
This API is not available by default over HTTP, so you would need either to use IPC or you add them specifically as flags.
Then you could use something like: https://github.com/ethereum/mist/blob/master/modules/web3Admin.js
@frozeman The web3Admin.js trick only works wih ipc provider. The JSON-HTTP still returns the command unlockAccount is not implemented...
you need to start you geth with the ipcapi flag:
--ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3"
https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options
Great. Thank you.
Alexandre Naverniouk
On Mon, Feb 15, 2016 at 1:47 AM, Fabian Vogelsteller <
[email protected]> wrote:
Closed #388 https://github.com/ethereum/web3.js/issues/388.
—
Reply to this email directly or view it on GitHub
https://github.com/ethereum/web3.js/issues/388#event-550447421.
I'm not sure if I understood. Maybe someone can clearify.
Summarizing:
In order to use personal API in my web3 based App:
1) I need to start geth with rpc and ipc API
geth --rpc --rpccorsdomain="*" --ipcapi "admin,db,eth,debug,miner,net,shh,txpool,personal,web3" --ipcpath "/tmp/geth.ipc"
2) I should implement personal API (or the required functions) simmilar to the web3Admin.js
Remaining questions
After I can Use IPC functionality over RPC? (This sounds somehow strange to me)
How do I know the specific parameters for personal API?
If it is "so easy", why nobody implemented it yet?
@digitaldonkey I am not sure if this will help you but I was facing a related issue and tried the geth command you had listed but it didn't work. I eventually found a command that did though.
After starting the node with the following geth command:
geth --rpc --rpcaddr="0.0.0.0" --rpccorsdomain="*" --rpcapi="db,eth,net,web3,personal,web3"
I was able to unlock an account and send a transaction using web3 in a node.js script like so:
var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
web3.personal.unlockAccount('sendingAccountAddress', "accountPassword")
web3.eth.sendTransaction({
from: 'sendingAccountAddress',
to: 'receivingAccountAddress',
value: web3.toWei(0.1, "ether")
});
DISCLAIMER: there is a reason this isn't the default operating mode, default mode prevents someone from being able to transfer ETH out more easily
Most helpful comment
@digitaldonkey I am not sure if this will help you but I was facing a related issue and tried the geth command you had listed but it didn't work. I eventually found a command that did though.
After starting the node with the following geth command:
I was able to unlock an account and send a transaction using web3 in a node.js script like so:
DISCLAIMER: there is a reason this isn't the default operating mode, default mode prevents someone from being able to transfer ETH out more easily