Welcome to the Dash Forum!

Please sign up to discuss the most innovative cryptocurrency!

Exporting/importing privkey issues

Discussion in 'Daemon and QT Wallet Guides' started by aka teslaalset, Feb 28, 2017.

  1. aka teslaalset

    aka teslaalset New Member

    Joined:
    Feb 28, 2017
    Messages:
    9
    Likes Received:
    3
    Trophy Points:
    3
    Using QT wallet and exporting privkey to an unused QT Wallet on another PC, the new wallet's DASH credit does not reflect the wallet's credit that I exported the privkey from. The 'clone' wallet shows many spend transitions while I did not manually initiate these.
    This may be due to the fact that I exported the privkey from my original wallet while not finializing a mixing action (PrivateSend state at 20%).
    I retried this action after I finished a mixing options ( PrivateSend state indicated 100%), but no improvements achieved.

    Any clue on how to get my clone wallet in sync again with the original wallet?
     
  2. stan.distortion

    stan.distortion Active Member

    Joined:
    Oct 30, 2014
    Messages:
    839
    Likes Received:
    492
    Trophy Points:
    133
    Did you use the console to export the private key or did you use a backup copy of the wallet.dat file? PrivateSend uses a lot of addresses and the wallet only generates 1000 by default so needs to generate new pools of 1000 addresses when it runs out, I'm not certain but iirc the private key won't re-create the newly generated addresses. The most recent wallet.dat file wont have that issue but if mixing is used a lot it needs to be backed up often, older backups wont contain newly generated pools of addresses so coins can be lost permanently.
     
  3. aka teslaalset

    aka teslaalset New Member

    Joined:
    Feb 28, 2017
    Messages:
    9
    Likes Received:
    3
    Trophy Points:
    3
    I used the console to generate the private key of wallet #1 (using the dumpprivkey command) and then imported this private key via de console (using importprivkey command) of wallet #2.
     
    • Like Like x 1
  4. stan.distortion

    stan.distortion Active Member

    Joined:
    Oct 30, 2014
    Messages:
    839
    Likes Received:
    492
    Trophy Points:
    133
  5. robbie47

    robbie47 New Member

    Joined:
    Feb 25, 2017
    Messages:
    2
    Likes Received:
    1
    Trophy Points:
    3
    Copying wallet.dat may be the solution, I'll try this later.

    In principle QT Wallet should support exporting / importing private keys though.
    My current observations are that it looks like it needs multiple consecutive export / import actions between involved wallets until the issue is resolved.
    Mixing may have played a role, which may require as many private key actions as mixing addresses that have been applied by the mixing action of the original wallet.
    I repeated the action today and observed a new private key being generated by the original wallet. Problem is that my other PC is at my working office.
    I'll bring that one back home tomorrow, so I can perform the repeating action at home during one evening.
     
  6. stan.distortion

    stan.distortion Active Member

    Joined:
    Oct 30, 2014
    Messages:
    839
    Likes Received:
    492
    Trophy Points:
    133
    You're running the same wallet on multiple clients? That should really be avoided, come to think of it I've not heard it warned against for a long time now but it can cause all sorts of issues, that address generation issue for one but there are others. Maybe it could be possible to modify the client to create a single private key for all addresses but it would probably result in some extremely long private keys! It could be an interesting option, probably better keeping paper wallets to just a few addresses for long term storage though.
     
  7. UdjinM6

    UdjinM6 Official Dash Dev
    Dash Core Team Moderator

    Joined:
    May 20, 2014
    Messages:
    3,637
    Likes Received:
    3,536
    Trophy Points:
    1,183
    Exporting single private key (or private key for all receiving addresses) won't work here if you mixed coins because what mixing essentially does it sends coins in a special transaction to you fresh new addresses which are controlled by fresh new private keys. This is why we have 1000 keys by default (unlike 100 in bitcoin) and autobackup function. This is also why you should refresh your backup copy of wallet.dat after you mixed a lot. To have access to you funds on another computer you can either copy wallet.dat or use dumpwallet/importwallet commands.
     
    • Like Like x 2
  8. aka teslaalset

    aka teslaalset New Member

    Joined:
    Feb 28, 2017
    Messages:
    9
    Likes Received:
    3
    Trophy Points:
    3
    I am exporting the private key of the first DASH wallet I activated.
    I then imported this private key into two new wallets on different laptops.
    No wallet.dat file has been exchanged.

    Now I understand what caused the trouble I am facing.
    This shows that developers of wallets (for PC platforms) should be very careful in launching wallets with too much options for common users that have no knowledge these complexities. The Android version is much better with respect to simplicity.

    I've attached the outlne of the situation.
    The exchange of privkey (W1) occurred while mixing DirectSend status was as 20% (mixing stopped manually).
    Problem now is that W3 is not reflecting the right credit and won't update to a situation where credit is correct.
     

    Attached Files:

    #8 aka teslaalset, Mar 1, 2017
    Last edited: Mar 1, 2017
  9. stan.distortion

    stan.distortion Active Member

    Joined:
    Oct 30, 2014
    Messages:
    839
    Likes Received:
    492
    Trophy Points:
    133
    "wallet.dat" and "private key" are essentially the same thing except (as you're experiencing) there can be multiple private keys in a single wallet and that's where things are going wrong, you have the initial private key in both wallets but you don't have the key(s) for the newly generated addresses. Again, running the same wallet on multiple clients is extremely bad practice and can easily result in lost funds, it should be avoided at all costs unless you know exactly what your doing and how to address all the risks involved.

    The problem is those kind of things where just common knowledge a few years back when a full Bitcoin node could be run on a regular PC but then it became far too heavy for regular users so practically everyone switched to much simpler lightweight clients. The same will happen with Dash as transaction volumes continue to rise but running full nodes will always have complications, an endless chain of fool-proofing mechanisms could be built up but there's not much point because that's what Masternodes do, incentivise administration of full nodes and expand on their capabilities so things can be as simple and streamlined as possible for regular users. Unfortunately PrivateSend still needs a full client, it will be possible with lightweight clients very soon and in simple installations the full client works just fine but it can still have these kind of pitfalls when things get complicated.
     
    • Like Like x 1
  10. aka teslaalset

    aka teslaalset New Member

    Joined:
    Feb 28, 2017
    Messages:
    9
    Likes Received:
    3
    Trophy Points:
    3
    The pitfall has been the YouTube instruction video.
    This created the impression that things are easy and common to do so.
    Luckily, I just did some low value playing around to understand the ins and out of DASH exchange.

    Thanks for being so pro-active in this forum, guys!
     
    #10 aka teslaalset, Mar 1, 2017
    Last edited: Mar 1, 2017
    • Like Like x 1
  11. stan.distortion

    stan.distortion Active Member

    Joined:
    Oct 30, 2014
    Messages:
    839
    Likes Received:
    492
    Trophy Points:
    133
    I wish I'd seen that vid before, it would've made things much simpler. Cheers :) Yeah, the terminology can get confusing sometimes, "wallet" and "private key" get treated as the same thing but it ain't so simple. Glad you where cautious and didn't get caught out by it :) A couple of months ago someone here lost a significant amount through that, they'd been using PrivateSend a lot and only had an old backup to restore from after a system failure, not a massive amount lost but still enough to hurt.
     
  12. aka teslaalset

    aka teslaalset New Member

    Joined:
    Feb 28, 2017
    Messages:
    9
    Likes Received:
    3
    Trophy Points:
    3
    dumpwallet / importwallet worked for my second wallet running under Windows. That second wallet is now in sync with the 'master wallet'.

    I am having problems importing my original wallet file using importwallet command of my macbook QT wallet.
    In what OSX folder do I need to place the wallet file? Or how do I direct to the right OSX folder using the importwallet command?
     
    #12 aka teslaalset, Mar 1, 2017
    Last edited: Mar 1, 2017
  13. stan.distortion

    stan.distortion Active Member

    Joined:
    Oct 30, 2014
    Messages:
    839
    Likes Received:
    492
    Trophy Points:
    133
  14. aka teslaalset

    aka teslaalset New Member

    Joined:
    Feb 28, 2017
    Messages:
    9
    Likes Received:
    3
    Trophy Points:
    3
    To finish off the topic after I resolved the issues reported, thanks to the help offered in this discussion thread, here's what I did in total:

    - Exchanged the wallet file of the wallet1 to wallet2 and wallet2 by using the console commands dumpwallet and importwallet. This synchronized the original transactions made by wallet1
    - Exchanged the wallet file of the wallet2 to wallet3 using the console commands dumpwallet and importwallet. This synchronized the aditional transactions done by wallet2.

    For Windows 7 the default directory of the file created by the dumpwallet command can be found in directory C:\Program Files\DashCore
    For OSX the default directory is the root directory of the harddisk.

    All wallets are in sync with each other now.
    I totally agree with the comments that one should avoid using wallets that need to by synchronized using the same wallet files.
    It's much smarter to use separate wallets and transfer DASH using the payment route although this may require a small fee.
     
    • Like Like x 1
  15. Roslyn

    Roslyn Member

    Joined:
    Aug 22, 2014
    Messages:
    105
    Likes Received:
    41
    Trophy Points:
    78
    What is code -8?

    unlocked wallet first,
    console command: dumpwallet file
    Code:
    cannot open wallet dump file (code -8)
     
  16. UdjinM6

    UdjinM6 Official Dash Dev
    Dash Core Team Moderator

    Joined:
    May 20, 2014
    Messages:
    3,637
    Likes Received:
    3,536
    Trophy Points:
    1,183
    it's "invalid parameter" meaning that file you provided as a parameter can't be opened for some reason - path doesn't exist or you have no permissions to write there
     
  17. Kerry Jordan

    Kerry Jordan New Member

    Joined:
    Nov 29, 2017
    Messages:
    4
    Likes Received:
    1
    Trophy Points:
    3
    Thanks for the explanation. It worked for me.
     
  18. AnniePerez

    AnniePerez New Member

    Joined:
    Jan 31, 2018
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    1
    Thanks for the explanation. It worked for me.