Making a wallet for Masternode setup using dumpprivkey and importprivkey

chaeplin

Active Member
Core Developer
Mar 29, 2014
749
356
133
* This guide use dumpprivkey and importprivkey
* Purpose of this guide is less hassle in wallet backup.
* Tested in testnet
* user ms06 and user ms05
* As address(private key) for NM is in both wallet, spend in main wallet could spend some portion of NM's 1K.
----> This will not break backup, but masternode could be invalided.

* If you spend using NM's wallet, backup is breaked, you should backup NM wallet also.
Keypool is diffrent in both wallet, so do not spend using NM's wallet.
Use backuped wallet, then backup backuped wallet.

* http://paper.darkcoin.io/
Code:
Spend your Darkcoins by importing your private key to the client wallet. 
Keep in mind when you import your single key to a Darkcoin p2p client and 
spend funds your key will be bundled with other private keys in the p2p client wallet. 
When you perform a transaction your change will be sent to another Darkcoin address 
within the p2p client wallet. You must then backup the p2p client wallet and 
keep it safe as your remaining Darkcoins will be stored there. 
Satoshi advised that one should never delete a wallet.


* Other scenario.
: dump privkey of existing NMs, import to existing(or new) wallet.



Code:
dumpprivkey <darkcoinaddress>
Reveals the private key corresponding to <darkcoinaddress>
Code:
importprivkey <darkcoinprivkey> [label] [rescan=true]

Adds a private key (as returned by dumpprivkey) to your wallet.
This may take a while, as a rescan is done, looking for existing transactions.
Note: There's no need to import public key, as in ECDSA (unlike RSA) this can be computed from private key.

* current main wallet, user ms06
Code:
[email protected]:~> darkcoind listaddressgroupings
[
    [
        [
            "mjSs4eLL18NsVcobKjSJsGChkK6YyeaZSr",
            1234.00000000,
            "ttt"
        ]
    ],
    [
        [
            "muj9oHwCtoWLcrALSfV7yQS2yh1KLpbXo6",
            1425.60000000,
            "0"
        ]
    ],
    [
        [
            "mgosBEJMvd27HiHcm1LLJqTekMAkaxHAvZ",
            5511.50020000,
            "123"
        ],
        [
            "mvz342xruamQuhz8XVwBy2tW15e3rFXZCK",
            0.04720000
        ]
    ]
]

* make a new address
Code:
[email protected]:~> darkcoind getaccountaddress NM01
n4kjkQ4GoB56gwhZDsTr9kWoc1cuKeBcqZ
* backup wallet
Code:
[email protected]:~> darkcoind backupwallet ~/darkcoind_wallet_0099.dat
* tx 1k to new address
Code:
[email protected]:~> darkcoind walletpassphrase password_long 100
[email protected]:~> darkcoind sendfrom 123 n4kjkQ4GoB56gwhZDsTr9kWoc1cuKeBcqZ 1000
49a28459d2adf8ebdd975bcc21c03090ea3398837143063e945fdd5a589c3162
* check balance
Code:
[email protected]:~> darkcoind listaddressgroupings
[
    [
        [
            "mjSs4eLL18NsVcobKjSJsGChkK6YyeaZSr",
            1234.00000000,
            "ttt"
        ]
    ],
    [
        [
            "muj9oHwCtoWLcrALSfV7yQS2yh1KLpbXo6",
            425.60000000,
            "0"
        ]
    ],
    [
        [
            "n4kjkQ4GoB56gwhZDsTr9kWoc1cuKeBcqZ",
            1000.00000000,
            "NM01"
        ]
    ],
    [
        [
            "mgosBEJMvd27HiHcm1LLJqTekMAkaxHAvZ",
            4508.69300000,
            "123"
        ],
        [
            "mxuX4HiZsw37Uy75kJwZYxs2gg9psMRcaW",
            2.80720000
        ],
        [
            "mvz342xruamQuhz8XVwBy2tW15e3rFXZCK",
            0.04720000
        ]
    ],
    [
        [
            "mgfmNyUwU92wKDRjJHHberGGudiBSNjyDw",
            1000.00000000,
            "NM02"
        ]
    ]
]
* dump privkey of new address
Code:
[email protected]:~> darkcoind dumpprivkey n4kjkQ4GoB56gwhZDsTr9kWoc1cuKeBcqZ
cQjuUGLHWqDTnyZRpMzejNd5wKjpHRWqJYMFUgjdjScuChewJnFA



* at user ms05, new wallet.
* balance is zero
Code:
[email protected]:~/.darkcoin> darkcoind listaddressgroupings
[
]
* import privkey
Code:
[email protected]:~/.darkcoin> darkcoind importprivkey cQjuUGLHWqDTnyZRpMzejNd5wKjpHRWqJYMFUgjdjScuChewJnFA 0 true
[email protected]:~/.darkcoin> darkcoind listaddressgroupings
[
    [
        [
            "n4kjkQ4GoB56gwhZDsTr9kWoc1cuKeBcqZ",
            1000.00000000,
            "0"
        ]
    ]
]
* encrypt wallet
Code:
[email protected]:~/.darkcoin> darkcoind encryptwallet passphrase
wallet encrypted; DarkCoin server stopping, restart to run with encrypted wallet. The keypool has been flushed, you need to make a new backup.
done.


As long as you backup main wallet, backup of NM wallet(user ms05 wallet) is not needed.
 
Last edited by a moderator:

yidakee

Well-known Member
Foundation Member
Apr 16, 2014
1,812
1,168
283
Yeah +1
I did this because I run multiple nodes and imported all private keys in one local backup wallet.
So with this method, we can have a separate wallet containing all the masternodes 1k addresses there? So we can manage all the payouts from that wallet? I did not know that was possible! How cool!

I had always thought the privatekey was valid for the entire poolkey of that wallet. In essence, having the privatekey was the equivalent having a wallet.dat backup. Guess I was wrong.
 

chaeplin

Active Member
Core Developer
Mar 29, 2014
749
356
133
So with this method, we can have a separate wallet containing all the masternodes 1k addresses there? So we can manage all the payouts from that wallet? I did not know that was possible! How cool!

I had always thought the privatekey was valid for the entire poolkey of that wallet. In essence, having the privatekey was the equivalent having a wallet.dat backup. Guess I was wrong.
Read red color letter.

When spend, there should be grate care.
 
  • Like
Reactions: yidakee

yidakee

Well-known Member
Foundation Member
Apr 16, 2014
1,812
1,168
283
Will do chaeplin! Also read more on the subject before attempting anything. Thanks! Much to learn :cool:
 

yidakee

Well-known Member
Foundation Member
Apr 16, 2014
1,812
1,168
283
Just dont use the masternode to send funds at all.
Now I am totally lost. In testnet, hot wallet setup, with the wallet config'ed to masternode=1, after payouts, say you have 1250 DRKs in the balance. We would try to send 251, but darkcoind would not let you. Basically it locked the 1k in. At least that was the way before 0.9.6. Sending out 250 would go through ok.

Now with local/remote, after you shut down the local wallet, if you want to cash out payouts, you have to fire up the local wallet with "darkcoind" - but no need to issues "masternode start" as the handshake has been done before. But masternode=1 is still in config file. I haven't tested the 1k deposit lock since, but say you have 1030 DRK by month's end, and want to cash out, what is the problem of sending out, for example 29 DRK ?

1k deposit would still be there.

I understand that if you dumpprivkey and import into a different wallet, and move out funds from the 1k deposit, this will break the Node. But if you always sure to cash out under 1k, will that be a problem?
 

Lariondos

Well-known Member
Foundation Member
Apr 8, 2014
89
62
158
If you want to be absolutely sure not to spend a fraction of your 1k and use the QT client, enable the coin control feature and select only other adresses as inputs. With daemon commands this should also be possible, didn't try that.
 
  • Like
Reactions: chaeplin

bgaer

New Member
Jun 21, 2014
6
1
3
is it possible to have the masternode payments go to a seperate wallet then the masternode 1k coin wallet?
 

ScioMind

Member
May 28, 2014
183
73
88
I tried the dumpprivkey on my masternode. I though private keys always start with "7" but mine did not. Tried putting it into a paper-wallet generator to see if it would output the correct darkcoin address, but it replied "Not a valid private key."
What does all this mean?
 

vertoe

Three of Nine
Mar 28, 2014
2,573
1,652
1,283
Unimatrix Zero One
I tried the dumpprivkey on my masternode. I though private keys always start with "7" but mine did not. Tried putting it into a paper-wallet generator to see if it would output the correct darkcoin address, but it replied "Not a valid private key."
What does all this mean?
Ignore the paperwallet check, that is broken (someone noticed that somewhere else).
All my masternode private keys start with X and work as desired.
It's the compressed format or something...
 

Propulsion

The buck stops here.
Feb 26, 2014
1,008
468
183
Dash Address
XerHCGryyfZttUc6mnuRY3FNJzU1Jm9u5L
I've been doing this for awhile. Really makes everything easier for maintainability.

When transferring coins from these addresses, all you need to use is coin control. No issues whatsoever.

Also note, it's safe to have a backup of the original MN wallet backed up as well as the wallet with the imported key.
 

ScioMind

Member
May 28, 2014
183
73
88
Ignore the paperwallet check, that is broken (someone noticed that somewhere else).
All my masternode private keys start with X and work as desired.
It's the compressed format or something...
You're right! I searched a bit more and found a paper wallet which does validate the private key returned by the wallet. I am going to host a copy of this on PlanetCrypton.com, and when I do I will return to this thread and let you know. Could be several days, as I am swamped by my to-do list right now.