I'm looking to setup a cold wallet (to buy tickets, go offline, and receive stake rewards) and hot wallet (to stay online 24/7 and only vote). After reading through https://docs.decred.org/getting-started/user-guides/dcrwallet-tickets/ it's still not clear to me what commands to issue in each wallet to ensure this works. I'm using CLI for both wallets and they are unique (they don't have the same creation seed), and setup on separate computers. Any advice, particularly the command to issue to the ticket-buying wallet to purchase tickets allowing the hot wallet to vote; and anything special needed to be done to the hot wallet so it knows it needs to vote? I realize the pool is an option, but I want to continue with a decentralized setup so would like to stay solo.
Basically all you need to do is generate an address on your hot voting wallet then use that address as your ticket address when issuing purchase ticket commands
But keep in mind you'll see your balance go to 0 on your cold wallet and the balance go up on your hot wallet. But if you look closely at the balance categories it's lockedbytickets and votingauthority not actually spendable
this is the command you need to use on your ticketpurchasing wallet. ./dcrctl purchaseticket default spendlimit 0 "ticketaddress" numtickets
spendlimit is the totall amount of DCR your are willing to use to purchase the tickets, then obvi the numTickets is number of tickets you'd like to purchase
That's great news. Very simple. Thank you @ay-p. I envision this will be a Ds address and not a Dc address as with a pool. If you would, let me know if that is correct?
This guide is for setting up PoS voting using 2 or more wallets (one hot, one cold) on a single PC. If you are currently using the CLI tools with a single wallet that holds funds AND stays online to vote for tickets, this guide is for you. At the end of this post, you will have set up two separate wallets on a single PC. I have seen the different uses for hot/cold wallets, so I would like to clarify how I have used them in this guide. A "hot wallet" is one the that holds your Decred and is online. A "cold wallet" is one that holds Decred but it offline. The wallet we will be setting up is called the "voting wallet". It is kept online but has no funds linked to it. I was looking into this and I said somewhere else on another thread that I'd report back if I was able set this up successfully... Well, I did set it up successfully and I'm currently in the process of running my old/initial "hot" wallet to let all its tickets vote and I'm simultaneously running my new "voting" wallet to vote for the tickets I purchased from my hot wallet. Directory Setup Let's start with the directory structure. I'm running Windows on my primary machine but I have a backup Raspberry Pi running a version of Linux with a similar config (for redundancy). I am assuming you will also have to run two wallets simultaneously to let your existing hot wallet tickets vote while allowing your new voting wallet tickets to vote too. If you use a separate machine it is very straight forward, but this is how to do it on a single machine. Create your main Decred directory, called decred. Example: C:\Users\David\Desktop\decred Inside decred, create another folder called voting. This is strictly to separate your configuration files and data for your voting wallet away from your existing hot wallet. Alternatively, you could name the config files something different and place them in the decred folder, but I prefer separate folders. Example: C:\Users\David\Desktop\decred\voting Place the dcrd, dcrwallet, dcrctl, and promptsecret executables inside the decred folder. In the voting folder, place a copy of your existing dcrctl.conf and dcrwallet.conf files (or create new ones). We will modify these later. Also place the rpc.cert file in the voting folder. (rpc.cert can be found in the dcrd local appdata folder on your machine). Config File Setup Edit your dcrd.conf file in the hidden directory: C:\Users\David\AppData\Local\Dcrd. We need to tell dcrd to listen on another port for the new voting wallet. The default port is 9109, so we need to open another port for the 2nd instance. Add the following lines to your dcrd.conf file: Code: rpclisten=:9109 rpclisten=:9030 Now let's edit the config files in the voting folder. Your dcrwallet.conf file in the voting directory should look pretty close to this. Be sure to add your own username/password and the correct appdata directory (unless your username is David!). Note: It appears that the dev team is working on revamping the RPC client. I have only seen the latest (v1.0.3) dcrwallet with the new gRPC server options. The dcrctl utility doesn't appear to have the new gRPC implementation so the following config is kind of messy right now with both the gRPC and legacy RPC server configs. My wallets would not launch correctly without having both the grpclisten and rpclisten (even though it appears the gRPC server is not yet used). We will probably have to modify the configs when the gRPC server implementation is finished. Code: username=myusername password=mypassword appdata=C:\Users\David\Desktop\decred\voting rpcconnect=127.0.0.1:9030 rpclisten=:9031 grpclisten=:9032 promptpass=1 enablevoting=1 Now let's edit the dcrctl.conf file in the voting folder. You should have the same username and password as in the dcrwallet.conf file: Again, the only things in the voting folder should be the rpc.cert, dcrwallet.conf, and dcrctl.conf Code: rpcuser=myusername rpcpass=mypassword rpccert=C:\Users\David\Desktop\decred\voting\rpc.cert rpcserver=127.0.0.1:9031 You can mirror this setup multiple times by adding multiple folders in the decred folder. Each instance will need separate ports opened up in dcrd and you will have to tweak the dcrctl.conf and dcrwallet.conf files slightly like we have done here. The basic setup is done... now we move onto launching the new voting wallet, followed by interacting with the voting wallet. Launching/Creating the Voting Wallet If you have not created the voting wallet yet, create it with the following command. Make sure you change the listed directory to match your setup: Code: dcrwallet /C "C:\Users\David\Desktop\decred\voting\dcrwallet.conf" --create Go through the normal procedures by entering your seed or letting dcrwallet create a seed for you. It should be well known by this point, but in case it's not - write down your new seed! Launch the wallet with the following command. You can create a batch file with this exact command as well to launch your wallet easily in the future. Code: dcrwallet /C "C:\Users\David\Desktop\decred\voting\dcrwallet.conf" We used promptpass=1 in the config file, so you will be prompted for your password upon wallet startup. Enter that in and wait for the following message: Code: [INF] WLLT: The client has successfully connected to dcrd and is now handling websocket notifications Interacting With the Voting Wallet Every time you need to interact with the voting wallet, you must specify the config file in the command. For this reason, I highly suggest you create multiple batch files to make it easy to run the most common commands you'll be using. Here are some useful commands you may want to create a batch file for: Code: dcrwallet /C "C:\Users\David\Desktop\decred\voting\dcrwallet.conf --wallet getstakeinfo dcrwallet /C "C:\Users\David\Desktop\decred\voting\dcrwallet.conf --wallet getbalance dcrwallet /C "C:\Users\David\Desktop\decred\voting\dcrwallet.conf --wallet getnewaddress Purchasing Tickets for the Voting Wallet Generate a new address from your voting wallet with the getnewaddress command listed above. Copy this address for use in the next command. Ticket purchases are generated from your hot wallet. Because of the way we set this up, you don't need to specify any extra arguments in the ticket purchase command. The normal syntax will do. Issue the command normally, like this: Code: dcrctl --wallet purchaseticket "default" 50 1 "DsbBM2WbMaugVENwGGH8yMAJqXXXXXXXXXX" 5 "" 0 141500 In the command above, 50 is the maximum ticket price you will pay. The "DsbBM..." is the address you are giving voting rights to. It's the one you copied from your voting wallet that we just generated. Paste your address into the command (keep the quotes). The 5 immediately following the address is the number of tickets to buy. The 141500 is the block that this ticket transaction will be canceled at if it is not filled by that block. I would suggest copying this command into a text file so you can modify it as necessary. You can then check your voting wallet's stake info with the batch file you (hopefully) created earlier. When all your tickets are voted out of your main wallet, you can either lock it or take it offline entirely, leaving your voting wallet as the only wallet online at the time. When it comes time to purchase more tickets, fire up your old hot wallet and make your purchase using the steps above. Regarding balances... the voting wallet will show a balance that is the sum of the value of all the tickets you purchased using your old hot wallet. As your voting wallet votes, the balance decreases and the balance of your old hot wallet increases. The coins never actually touch the voting wallet, but it will show the amount of coins that it's responsible for. Taking the sum of the total balances between the two wallets will give you your real total balance (locked and unlocked coins). Hopefully this helps you and others here. I know other people (including myself) have asked before but there hasn't yet been anything this concrete.
@adam2312, I re-read your post and noticed that you said you are using separate computers for your voting/hot wallets. That basically means you only need to follow the steps above from the "Purchasing Tickets for the Voting Wallet" section. The rest of that is for setting both wallets up on a single computer. Good luck!
So I wrote the above guide with haste and didn't proofread it. I just went back through it and fixed some things.. It seems I was having an internal battle with choosing to use the term cold wallet or voting wallet All that is fixed now. It should be much easier to follow.
Amazing job David. This is what I was looking for and struggeling with for a few months. Thanks a lot.