Decred Synopsis Of Basic Commands With Notes And Explanations About Each Of Them

Discussion in 'Technical Support' started by zero, Apr 3, 2016.

  1. 2017/12/15 - Decred v1.1.2 released! → Release Notes  → Downloads
  1. zero

    zero Full Member

    Jan 1, 2016
    288
    121
    Male
    #1 zero, Apr 3, 2016
    Last edited: Apr 5, 2016
    Usernames, Passphrases and Passwords - description examples, use your own:

    dcrd_username

    dcrd_password

    private_passphrase

    public_passphrase

    dcrwallet_username

    dcrwallet_password

    Note: (simple explanations given in parentheses for each command)

    Dummies notes: Use dcrd, dcrwallet and dcrctl in different command prompt windows.
    On command prompt you have to open/point the folder you have extracted the decred files for example for C:\Decred:
    cd\
    c:
    cd Decred


    !notes!

    !You have to change example values with yours of course!

    1) dcrd “commands”:


    dcrd --rpcuser="dcrd_username" --rpcpass="dcrd_password" (To start dcrd)

    Or

    dcrd --rpcuser="dcrd_username" --rpcpass="dcrd_password" --miningaddr=YourDecredAddressForMining (To start dcrd for solo pow mining, YourDecredAddressForMining is an example value, replace it with one of your wallet addresses)

    2) dcrwallet “commands”:

    Very important: !Wait for dcrd to completely sync to the exact latest block height before of any use of dcrwallet!
    You can easily check the latest block height on https://mainnet.decred.org/


    dcrwallet --create (To create a new dcrwallet or recreating your wallet from seed, close command prompt window after its successful creation or recreation for security reasons)

    First priority and most important note: !DO NOT give or show your seed words or seed hex to anyone! Store it, backup it, hide it and password protect it on a paper or digitally. If you make the big mistake of revealing your seed then your wallet is burned. If you make that mistake try to move your funds as soon as possible to another safe wallet of yours but it will maybe be too late for it, especially if you are PoS mining with most of your funds.!

    dcrwallet --username="dcrwallet_username" --password="dcrwallet_password" --walletpass="public_passphrase" --dcrdusername="dcrd_username" --dcrdpassword="dcrd_password" (To start your dcrwallet)

    Or

    dcrwallet --username="dcrwallet_username" --password="dcrwallet_password" --walletpass="public_passphrase" --dcrdusername="dcrd_username" --dcrdpassword="dcrd_password" --enablestakemining --balancetomaintain=180.1 --ticketmaxprice=10.3 --ticketaddress=P2SH_Pool_Address (To start dcrwallet for auto buying tickets for a stake pool and as voting backup, balancetomaintain-> Lowest value of balance to stay on your wallet no matter what - 180.1 is an example value, ticketmaxprice-> Max price for buying a ticket - 10.3 is an example value, P2SH_Pool_Address is an example value replace it with yours from stake pool)

    Note: In order to buy tickets or vote them, you should also unlock your wallet forever right after that in another command prompt window with this command:

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet walletpassphrase "private_passphrase" 0

    !Of course you have to be careful when you unlock your wallet forever(with no time limit) because someone with any kind of access to your pc will be capable of spending your funds and mess up with your wallet, so be careful where you use your wallet. And for security reasons close the command prompt window you used for unlocking your wallet and erase your cache if you can or at least copy something else a few times!

    Or

    dcrwallet --username="dcrwallet_username" --password="dcrwallet_password" --walletpass="public_passphrase" --dcrdusername="dcrd_username" --dcrdpassword="dcrd_password" --enablestakemining --balancetomaintain=180.1 --ticketmaxprice=10.3 (To start wallet 24/7 online for solo PoS mining, balancetomaintain-> Lowest value of balance to stay on wallet no matter what - 180.1 is an example value, ticketmaxprice-> Max price for buying a ticket - 10.3 is an example value)

    !In order to successfully solo PoS mining you have to run your wallet unlocked and dcrd and be online 24/7 with no downtime, I only recommend it if you can setup this on one of your own servers with downtime close to zero! Better use a stake pool instead.

    Note: In order to buy tickets or vote, you should also unlock your wallet forever right after that in another command prompt window with this command:

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet walletpassphrase "private_passphrase" 0


    !Of course you have to be careful when you unlock your wallet forever(with no time limit) because someone with any kind of access to your pc will be capable of spending your funds and mess up with your wallet, so be careful where you use your wallet. And for security reasons close the command prompt window you used for unlocking your wallet and erase your cache if you can or at least copy something else a few times!

    Dummies note for both dcrd and dcrwallet:

    On Windows use this combination of keys to stop dcrwallet and dcrd, when you want to: Ctrl + c (after you clicked on their command prompt window to choose them)

    3) dcrctl commands:

    !default it's an account name on these commands and by now almost everyone's spendable funds goes to that one, created and named by default as "default"!

    dcrctl -l (To list all the available commands)

    dcrctl -h (For dcrctl help)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet getbalance (To get your spendable balance)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet getbalance "default" 0 all (To get the total balance of your default account, locked and spendable funds)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet getbalance "*" 0 all (To get the total balance of all the accounts into your wallet, default + imported + anything else, locked and spendable funds)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet listtransactions (To get the latest transactions for your wallet)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet listtransactions * 999999 (To list up to 999999 transactions for your wallet, 999999 is an example value)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet getinfo (To get some basic info like current difficulty)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet getstakeinfo (To get stake info)

    Notes about what you’ll get with getstakeinfo:
    "poolsize" -> Current total number of tickets
    "difficulty" -> Current ticket price
    "allmempooltix" -> Tickets in mempool/to be mined
    "ownmempooltix" -> Your tickets in mempool/to be mined
    "immature" -> Your tickets included in a block/mined that will go live after 256 confirmations
    "live" -> Your tickets waiting to be voted
    "proportionlive" -> The proportion of your tickets compared to the poolsize
    "voted" -> Tickets of yours that got voted
    "totalsubsidy" -> Total profits from rewards you got from tickets voted
    "missed" -> Your tickets that didn’t got voted
    "proportionmissed" -> Your missed tickets compared to the total tickets you bought
    "revoked" -> Tickets of yours that removed from mempool
    (I think missed = revoked, at least in my case)

    !When a ticket voted – if I am not wrong – it also needs 256 confirmations/new blocks to mature so as the DCR you spend to buy it (its own ticket price) + current vote reward to become spendable, ticketfee isn’t returned!

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet walletpassphrase "private_passphrase" 120 (To unlock your wallet for the time you want, 120 -> Time in seconds - 0=forever – with no time limit, 120 is an example value, always be careful when you unlock your wallet)

    !You have to be careful when you unlock your wallet because someone with access to your pc will be capable of spending your funds and mess up with your wallet, so be careful where you use your wallet. And for security reasons close the command prompt window you used for unlocking your wallet and erase your cache if you can or at least copy something else a few times!

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet settxfee 0.01 (To set the transaction fee value, 0.01->tx fee value you want to set, default is 0.05 by now I am posting, 0.01 is an example value, I think txfee is resetting back to default every time you re-run your wallet but I am not sure)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet setticketfee 0.01 (To set the ticket fee value, 0.01->ticket fee value you want to set, default is 0.05 by now I am posting, 0.01 is an example value, I think ticket fee is resetting back to default every time you re-run your wallet but I am not sure)

    Note about fees: Be careful not to set very high fees by mistake so you won’t lose DCR for nothing. Also I have to say that sometimes I’ve seen more fees spend than the ones I’ve set for a transaction or a ticket buy, I am not sure why that happened or if I am wrong about it.

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet importscript your_script (For importing a redeem script from a stake pool, your_script is an example value replace it with yours from the stake pool, !Your wallet has to be unlocked to import the script!)

    Note about importscript: It is highly recommended to import the your script from stake pool into your wallet so as to be able to keep track of your tickets on pool with getstakeinfo command, if for some reason you’ll re-create your wallet from seed then you have to import your script again to your wallet.

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet sendtoaddress DecredAddressYouWantToSendAnAmount 10.01 (To send an amount of your funds that you want to someone’s address, 10.01 -> Amount of DCR you want to send, 10.01 is an example value change it with how many DCR you want to send, DecredAddressYouWantToSendAnAmount is an example value change it with the decred address you want to send funds, !Your wallet has to be unlocked to make this transaction and an additional txfee will also be deducted from your account!)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet purchaseticket "default" 10.1 1 P2SH_Pool_Address (For manual buying a ticket for your P2SH Pool Address – Example values: "default"-> Account name, 10.1-> Max ticket price, 1-> minconf, P2SH_Pool_Address-> your pool address, !Your wallet has to be unlocked for buying a ticket and an additional ticketfee will also be deducted from your account!)

    Note about manual buying tickets: Some users had problems not to be able to manually buying tickets with sufficient spendable balance, I personally think you’ll have less troubles if you start your dcrwallet for auto buying tickets with the appropriate setting/values.

    Note about Decred transactions: When you spend or send some of your balance for any possible reason you have to wait for your transaction to be included into a new block (sometimes it takes a few blocks) at that time you’ll probably get wrong balance – lower that the correct one, that’s normal and you can find the reasons for this into the forum. After a few blocks it will get fixed back to normal.

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet consolidate 99999 default (To transfer amounts from many of your addresses to only one of them, 99999-> number of addresses to consolidate, 99999 is an example value, !Your wallet has to be unlocked to consolidate and an additional fee will also deducted from your funds!)

    Note about consolidate: Consolidate seems to sometimes fix the manually buying tickets troubles or other spending problems, if you have a spending issue you can give it a try but do not consolidate all the time or for no reason because you’ll spend in fees for nothing.

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet walletlock (To lock wallet)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet getnewaddress (To get one of your wallet addresses as a return and you can use it for what you want it)

    dcrctl -u "dcrwallet_username" -P "dcrwallet_password" --wallet validateaddress DecredAddressYouWantToValidate (To check if a decred address is yours, if you get "ismine": true as a return then it is yours, DecredAddressYouWantToValidate is an example value replace it with the decred address you want to validate)

    Note about username and password: There is a way to setup conf files so you won’t have to use your username and password for dcrctl commands all the time but I don’t use conf files so if someone want might describe it in a new post or thread or you can search the forum about it.

    4) cgminer – PoW mining:

    For solo PoW mining edit cgminer's start_local.bat file before starting it to (cgminer v.0.0.4 for Windows x64):

    cgminer --blake256 -o https://127.0.0.1:9109 -u "dcrd_username" -p "dcrd_password" --cert "%LOCALAPPDATA%\Dcrd\rpc.cert"

    (dcrd_username, dcrd_password are example values so change them with yours, also users who may use --datadir flag have to change accordingly their cert location but they should already know this)

    !Before running the .bat file be sure you have dcrd running and fully synced to latest block with –miningaddr= flag!

    How long it takes for your rewards to become spendable: !If you solve a block it will take 256 confirmations/new blocks for its reward to mature and become spendable, but you’ll still be able to see it in your total balance or as immature in your transactions!

    Or

    For PoW mining on a pool edit cgminer’s start_local.bat file before starting it to how you’ll get instructed on your pool site help / getting started, a general example should look like this:

    cgminer --blake256 -o pool.link: _port_number -u webloginID.workername -p workerpassword

    (example values: pool.link -> link address of your pool, _port_number-> port given from your pool, your webloginID, your workername, your workerpassword)

    Note about mining software: There are many mining softwares for every occasion with decred algorithm support (cgminer, ccminer, sgminer and there is going to be a gominer) search about them and use the one that fits more for you.

    What you have to kept running on your system for the most common occasions:


    - Using your wallet: dcrd synced to the exact latest block height and then dcrwallet.

    - Pos mining on stake pool: dcrd synced to the exact latest block height and then dcrwallet unlocked only when you want to buy tickets with the appropriate settings, you can stop and close them after that.

    - Solo pos mining: dcrd synced to the exact latest block height and then dcrwallet unlocked and online 24/7 with the appropriate settings.

    - Solo pow mining: dcrd with --miningaddr=YourDecredAddressForMining flag synced to the exact latest block height and then cgminer or other miner with the appropriate settings.

    - Pow mining on a pool: Only cgminer or other miner with the appropriate settings is needed for this occasion.

    (Use dcrd, dcrwallet, dcrctl and your miner in different command prompt windows)

    General note: It’s important to use the latest Decred binary files and update them when a new release will be announced. You can check for the latest version here: https://github.com/decred/decred-release/releases/
    Updating is very easy, just download the latest compressed/container file (.zip for Windows) for your operating system, stop dcrd and dcrwallet that may be running and then extract and replace the old files with the newer ones and re-run them.

    Dcrd and Dcrwallet default folders location on Windows: :\Users\”user_name”\AppData\Local\

    Command prompt note for dummies: Especially for dcrctl commands, while on the same command prompt window you can use up and down arrows of your keyboard to re-use the most recent commands you already used so you won’t have to copy/paste or re-type them again and again.

    Some useful links:

    https://github.com/decred/decred-release/releases/

    https://dcrstats.com/

    http://d3c.red/

    https://mainnet.decred.org/

    https://github.com/decred

    https://bitcointalk.org/index.php?topic=1290358.0

    https://wiki.decred.org/

    And there is always a search tab on the forum.

    Extra: Correct Decred pronunciation from @davecgh : https://dl.dropboxusercontent.com/s/d4brp4otxbpfigv/decredpronunciation.mp3?dl=0

    It is obvious that most of the above will be history when a final and stable version of Paymetheus will be available for all the main operating systems. So if someone find it difficult to involve with Decred right now he can wait for it. I also have to say that personally I don’t recommend using the web wallet right now but if you want to use it anyway be sure NOT to run dcrwallet and web wallet at the same time (basically current web wallet it’s just an gui for your local dcrwallet).

    Final important note: Use them at your own responsibility. I don’t know if the above will work for everyone and I DO NOT take any responsibility if anything will go wrong by using the above commands or notes. I’ve tested them only on Windows 10 x64 Pro. The above it’s not a guide, it’s just a collection of the very basic commands that someone can already find spread through the entire forum threads, there is always a search button on forum and there are already many useful guides on it if you need one. I don’t know if I’ll be maintaining and update this post so things might change from time to time. If you find something wrong or feel there should be more explanation about something then post it. I just think it will might help, at least the Decred beginners.
     
    Szfinx, 418Sec, sambiohazard and 5 others like this.
  2. Ayush

    Ayush Full Member
    Advocate (Facebook)

    Jan 9, 2016
    512
    100
    Male
    .
    .
    Wow!
    That's a lot of work!!
    Appreciate it man!! Great job.
    If u don't mind I would say that some parts are really complicated.
    I use -

    dcrd -u USERNAME -P PASSWORD

    For the dcrd. Simpler command.
    And lastly - Keep up the good job.
     
    zero likes this.
  3. zero

    zero Full Member

    Jan 1, 2016
    288
    121
    Male
    #3 zero, Apr 4, 2016
    Last edited: Apr 4, 2016
    Thanks. Yes both commands will work. I know its a big post but I tried to explain as simple as I can almost all the basic commands I think someone will need at the time, plus some other general notes that might help. And someone can use the examples given by making its own passphrases, usernames and passwords and change them accordingly in the quotes. But well, things are changing and I also might be wrong about something.
     
  4. Ayush

    Ayush Full Member
    Advocate (Facebook)

    Jan 9, 2016
    512
    100
    Male
    .
    .
    One suggestion.
    If u write all the commands in BOLD then the commands will be easier to read and presentationally it will be better.
    And maybe consider adding a line between the command and its explanation.
     
    zero and sambiohazard like this.
  5. 418Sec

    418Sec Member
    Advocate (Twitter)

    Jan 3, 2016
    122
    65
    Male
    Good job man!
    This is a really good compilation! :)
     
    zero likes this.

Share This Page