{"action":"created","issue":{"url":"https://api.github.com/repos/ConsenSys/eth-lightwallet/issues/60","repository_url":"https://api.github.com/repos/ConsenSys/eth-lightwallet","labels_url":"https://api.github.com/repos/ConsenSys/eth-lightwallet/issues/60/labels{/name}","comments_url":"https://api.github.com/repos/ConsenSys/eth-lightwallet/issues/60/comments","events_url":"https://api.github.com/repos/ConsenSys/eth-lightwallet/issues/60/events","html_url":"https://github.com/ConsenSys/eth-lightwallet/issues/60","id":135819014,"number":60,"title":"Astronomical issue with private keys to sign tx.","user":{"login":"chrisforrester","id":16688316,"avatar_url":"https://avatars.githubusercontent.com/u/16688316?v=3","gravatar_id":"","url":"https://api.github.com/users/chrisforrester","html_url":"https://github.com/chrisforrester","followers_url":"https://api.github.com/users/chrisforrester/followers","following_url":"https://api.github.com/users/chrisforrester/following{/other_user}","gists_url":"https://api.github.com/users/chrisforrester/gists{/gist_id}","starred_url":"https://api.github.com/users/chrisforrester/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrisforrester/subscriptions","organizations_url":"https://api.github.com/users/chrisforrester/orgs","repos_url":"https://api.github.com/users/chrisforrester/repos","events_url":"https://api.github.com/users/chrisforrester/events{/privacy}","received_events_url":"https://api.github.com/users/chrisforrester/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-02-23T18:16:23Z","updated_at":"2016-02-24T20:24:55Z","closed_at":null,"body":"secret seed is \"erupt consider beyond twist bike enroll you salute weasel emerge divert hundred\"\r\n\r\nwith keystore password \"password\"\r\nwith hdPath = \"m/44'/60'/0'\"\r\n\r\nthe private key that is returned is a 62 character hex value.\r\n\r\n\r\nexample code:\r\n(using lightwallet.keystore.deriveKeyFromPassword(password, function(err, pwDerivedKey))\r\n\r\nvar keystore = new lightwallet.keystore(secretSeed, pwDerivedKey);\r\nvar hdPath = \"m/44'/60'/0'\"; //as defined in SLIP44    \r\n\r\nkeystore.addHdDerivationPath(hdPath, pwDerivedKey, {curve: 'secp256k1', purpose: 'sign'});\r\nkeystore.generateNewAddress(pwDerivedKey, 1, hdPath);  //Generate a new address\r\n\r\nvar incompleteAddress = keystore.getAddresses(hdPath)[0];\r\nkeystore.setDefaultHdDerivationPath(hdPath);\r\nvar hexSeedETH = keystore.exportPrivateKey(incompleteAddress, pwDerivedKey);\r\n\r\n\r\n\r\n..\r\n\r\nhexSeedETH.length = 62.\r\n\r\n\r\nsomething like a:\r\n\r\nfunction pad(num, size) {\r\n    var s = num+\"\";\r\n    while (s.length < size) {\r\n        s = \"0\" + s;\r\n    }\r\n    return s;\r\n}\r\n\r\nwith a:\r\n\r\nhexSeedETH = pad(hexSeedETH, 64);\r\n\r\nreturns valid private keys that can sign for this address for the ethereumjs-tx module, and this library's signtx function.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ConsenSys/eth-lightwallet/issues/comments/188440276","html_url":"https://github.com/ConsenSys/eth-lightwallet/issues/60#issuecomment-188440276","issue_url":"https://api.github.com/repos/ConsenSys/eth-lightwallet/issues/60","id":188440276,"user":{"login":"christianlundkvist","id":6892901,"avatar_url":"https://avatars.githubusercontent.com/u/6892901?v=3","gravatar_id":"","url":"https://api.github.com/users/christianlundkvist","html_url":"https://github.com/christianlundkvist","followers_url":"https://api.github.com/users/christianlundkvist/followers","following_url":"https://api.github.com/users/christianlundkvist/following{/other_user}","gists_url":"https://api.github.com/users/christianlundkvist/gists{/gist_id}","starred_url":"https://api.github.com/users/christianlundkvist/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/christianlundkvist/subscriptions","organizations_url":"https://api.github.com/users/christianlundkvist/orgs","repos_url":"https://api.github.com/users/christianlundkvist/repos","events_url":"https://api.github.com/users/christianlundkvist/events{/privacy}","received_events_url":"https://api.github.com/users/christianlundkvist/received_events","type":"User","site_admin":false},"created_at":"2016-02-24T20:24:55Z","updated_at":"2016-02-24T20:24:55Z","body":"Hi @chrisforrester, I did a test and was able to generate the same address from the truncated (31 byte) private key as from the padded (32 byte) private key. So this is good and means that logically the system treats both keys the same. I think the error occurs in the conversion between base64 and hex, I'll implement a padding."}}