4

I have a lightwallet.dat file which I exported from ujomusic.com. It's in a different format to that used by geth. I don't expect geth will import it so can I create an account with the same number as that account, and using the private key somehow, transfer the funds to another account? This is so that I can get at the Ether in the account.

Can I retrieve the plaintext private key? If so, how do I do that?

The file looks like this:

{
    "encSeed":
{         "encStr":"U2FsdGVkX186DSL2uPp1vZO......","iv":"1cb31568e......","salt":"3a0d...."},
    "encHdRootPriv":    {"encStr":"U2FsdGVkX19FA0tZsR......","iv":"da5e226....","salt":"45034...."},
"hdIndex":1,
"encPrivKeys":{
"92f2f6b0cc1.......:{"key":"U2FsdGVkX183.....","iv":"5ec1968....","salt":"371302....."}},
"addresses":["0x92f2f6b......"],"keyHash":"f1af35a6222......",
"salt":{"words":[-918769374,1616628770,1822257817,983741528],"sigBytes":16}}
3
  • it's unclear what you are asking. what is a lightwallet.dat and what has it to do with ujomusic 'tiny human' with such heavy javascript that my browser tends to die?
    – q9f
    Jan 25, 2016 at 19:14
  • I'm preparing/trying an answer specifically for the ujomusic lightwallet; I think question title can be improved by being more specific, because the fundamental answer to the general question is "Yes".
    – eth
    Jan 25, 2016 at 23:05
  • I've reworded the title so it matches the specific detail in the question. I'll ask the general question as a separate one because I think it's useful to know too. Anyone seeing this - please vote for reopen. Jan 26, 2016 at 14:07

2 Answers 2

5

Based on an answer by user @Clovis:

npm install eth-lightwallet
node
>var lightwallet = require("eth-lightwallet")
>var upgrade = require("eth-lightwallet/lib/upgrade")
>var jsonStr='contents of ./app/users/admin/*.json file'
>var newJSON
>upgrade.upgradeOldSerialized(jsonStr, , function(err, tmpJSON) {newJSON=tmpJSON;console.log(newJSON);});
>keystore = lightwallet.keystore.deserialize(newJSON);
>var derivedKey;
>lightwallet.keystore.deriveKeyFromPasswordAndSalt('', '', function (err, pwDerivedKey) {derivedKey = pwDerivedKey;});
>var addresses = keystore.getAddresses();
>keystore.exportPrivateKey(addresses[0], derivedKey);

OLD answer

Ujo uses Lightwallet. Exporting from Lightwallet and then importing to Geth should help access the funds. (An alternative is to continue using Lightwallet APIs.)

Export from Lightwallet

In the directory where your lightwallet.dat is, run the following commands: obviously you need to use your own Ujo address and password. This assumes your system already has NodeJS.

npm install eth-lightwallet

node

> var lightwallet = require('eth-lightwallet')

> newJSON = lightwallet.keystore.upgradeOldSerialized(JSON.parse(fs.readFileSync('lightwallet.dat')), <password>)

> keystore = lightwallet.keystore.deserialize(newJSON)

> keystore.exportPrivateKey(<address>, <password>)
'7...bla'

In this example 7...bla is the private key. (I have omitted the output of the other commands above so that it's clearer.)

Import to Geth

Copy the private key

Paste the key in a text file, let's say must_delete_this.txt and import it with geth:

geth account import must_delete_this.txt

delete the file named must_delete_this.txt

2
  • The APIs have changed since this was written and the accepted answer to this question is better: ethereum.stackexchange.com/questions/3094/… Nov 20, 2017 at 13:40
  • Thanks, I tried editing as well as use deriveKeyFromPasswordAndSalt per your comment...
    – eth
    Nov 22, 2017 at 10:48
1

If you have the private key available, simply save it in a text file, let's say damn_private_key and import it with geth:

geth account import /path/to/damn_private_key

More details. Don't forget to delete the plain private key file on your disk.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.