{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2393","repository_url":"https://api.github.com/repos/ethereum/go-ethereum","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2393/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2393/comments","events_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2393/events","html_url":"https://github.com/ethereum/go-ethereum/issues/2393","id":144795618,"number":2393,"title":"personal_unlockAccount takes much time, expected?","user":{"login":"hievan2016","id":18085443,"avatar_url":"https://avatars.githubusercontent.com/u/18085443?v=3","gravatar_id":"","url":"https://api.github.com/users/hievan2016","html_url":"https://github.com/hievan2016","followers_url":"https://api.github.com/users/hievan2016/followers","following_url":"https://api.github.com/users/hievan2016/following{/other_user}","gists_url":"https://api.github.com/users/hievan2016/gists{/gist_id}","starred_url":"https://api.github.com/users/hievan2016/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hievan2016/subscriptions","organizations_url":"https://api.github.com/users/hievan2016/orgs","repos_url":"https://api.github.com/users/hievan2016/repos","events_url":"https://api.github.com/users/hievan2016/events{/privacy}","received_events_url":"https://api.github.com/users/hievan2016/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-31T05:44:51Z","updated_at":"2016-04-04T10:48:27Z","closed_at":null,"body":"#### System information\r\n\r\nGeth\r\nVersion: 1.3.5\r\nGit Commit: 34b622a24853e1cf550238e8c8be6dfa4178cd35\r\nProtocol Versions: [63 62 61]\r\nNetwork Id: 1\r\nGo Version: go1.6\r\nOS: linux\r\n\r\n\r\n#### Actual behaviour\r\n\r\nWe use personal_unlockAccount RPC API to unlock an account, seems the time used to finish this\r\noperations is somehow related to the number of miner threads started, that is, more time is used\r\nwhen more miner threads are started, is this expected?\r\n\r\nBelow is the time used (second) vs miners, \r\n\r\n1-2s          1  miner\r\n~20s         2  miners\r\n~50s         4 miners\r\n\r\nThe questions are:\r\n\r\n1. is it expected? \r\n2. And is any solution to reduced the time used to unlock an account (except using less miners)?\r\n\r\n#### Steps to reproduce the behaviour\r\n\r\n1. start geth using this cmd with --minerthreads  1/2/4/... separately\r\n\r\n./geth --rpc --rpcaddr=\"0.0.0.0\" --rpccorsdomain=\"*\" --rpcapi=\"db,eth,net,web3,personal,web3\"  --verbosity=3 --maxpeers=0  --networkid 482771 --genesis ~/test/genesis.json --nodiscover --datadir ~/.hdether --minerthreads=\"1\" --mine\r\n\r\n2. run this cmd to see the time used for each case\r\n\r\ndate; curl http://localhost:8545 -X post --data '{\"jsonrpc\":\"2.0\",\"method\":\"personal_unlockAccount\",\"params\":[\"0x2ba878e691f4fb6c934a7a4b8abc7022186a7a5a\", \"123456\", 30000000],\"id\":1}'; date\r\n\r\nIe. the outout for 4 miners is (51s)\r\n\r\nubuntu@VM-44-75-ubuntu:~$ date; curl http://localhost:8545 -X post --data '{\"jsonrpc\":\"2.0\",\"method\":\"personal_unlockAccount\",\"params\":[\"0x2ba878e691f4fb6c934a7a4b8abc7022186a7a5a\", \"123456\", 30000000],\"id\":1}'; date\r\nThu Mar 31 13:26:24 CST 2016\r\ncurl: (52) Empty reply from server\r\nThu Mar 31 13:27:15 CST 2016\r\n\r\n\r\n#### Backtrace\r\n\r\n````\r\n[backtrace]\r\n````\r\n"},"comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/comments/205238417","html_url":"https://github.com/ethereum/go-ethereum/issues/2393#issuecomment-205238417","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2393","id":205238417,"user":{"login":"bas-vk","id":4280775,"avatar_url":"https://avatars.githubusercontent.com/u/4280775?v=3","gravatar_id":"","url":"https://api.github.com/users/bas-vk","html_url":"https://github.com/bas-vk","followers_url":"https://api.github.com/users/bas-vk/followers","following_url":"https://api.github.com/users/bas-vk/following{/other_user}","gists_url":"https://api.github.com/users/bas-vk/gists{/gist_id}","starred_url":"https://api.github.com/users/bas-vk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bas-vk/subscriptions","organizations_url":"https://api.github.com/users/bas-vk/orgs","repos_url":"https://api.github.com/users/bas-vk/repos","events_url":"https://api.github.com/users/bas-vk/events{/privacy}","received_events_url":"https://api.github.com/users/bas-vk/received_events","type":"User","site_admin":false},"created_at":"2016-04-04T10:48:27Z","updated_at":"2016-04-04T10:48:27Z","body":"It is hard to determine if this is expected in your situation. It depends on free available cpu's. Unlocking an account takes significant cpu resources and if miners (or other processes) are using these cpu's then they will be shared. That will cause the unlock to take more time. Since you described a relation between the number of miners and the time it takes to unlock this is probably the scenario.\r\n\r\nYou have several options:\r\n1. don't use account management in geth but use external signing and submit transactions with [eth_sendRawTransaction](https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sendrawtransaction). You can unlock/sign messages on a different computer which is not mining, or use a different algorithm to protect your keys which is lighter and secure enough for your situation. If you are using web3 Consensys made something that you might want to take a [look at](https://github.com/ConsenSys/hooked-web3-provider).\r\n2. Use the `lightkdf` parameter. This uses the same algorithm but with reduced security margin. It is up to you to determine if this is secure enough for your situation. Note, this is **not** recommended and only works with new keys."}}