Rpc Authentication Failure

Discussion in 'Connectivity' started by anvoice, Feb 8, 2016.

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

    anvoice Member

    Dec 22, 2015
    229
    78
    Male
    #1 anvoice, Feb 8, 2016
    Last edited: Feb 8, 2016
    No matter what I seem to do, always get an RPC authentication failure from the daemon upon trying to connect dcrwallet to it. Running start_local.bat produces the same failure in this case. Any ideas?

    Edit: accidentally posted in technical development instead of technical support. Move if possible please. Hectic.
     
    bolbativvi likes this.
  2. bolbativvi

    bolbativvi New Member

    Jan 21, 2016
    26
    2
    Male
    the same
     
  3. anvoice

    anvoice Member

    Dec 22, 2015
    229
    78
    Male
    #3 anvoice, Feb 8, 2016
    Last edited: Feb 8, 2016
    If you're trying to mine, you can try it without the wallet (just daemon). Then it seems to work, but the cgminer screen for me is blank (but mining).
     
  4. David

    David Sr. Member

    Jan 22, 2016
    364
    207
    Male
    USA
    Step 1. Start dcrd: (If you are on Windows, you have to disable TLS. If you are NOT on Windows, then delete the notls options in my example below)
    Code:
    dcrd -u user -P pass --notls
    Step 2. (Assuming you have your wallet generated, Start dcrwallet):
    Code:
    dcrwallet -u user -P pass --noclienttls --noservertls
    Where user and pass are the same credentials in each command. Are you using config files or are you specifying all options for each daemon in the command line (like in my examples above)?
     
  5. anvoice

    anvoice Member

    Dec 22, 2015
    229
    78
    Male
    You're quoting the testnet guide: it's a bit different on mainnet. I got everything working so far except the connection of the wallet to the daemon (yes I have it running). I'm using the CLI.
     
  6. David

    David Sr. Member

    Jan 22, 2016
    364
    207
    Male
    USA
    The only difference on mainnet when compared to testnet is the "--testnet" flag. If you had it working on testnet, remove the testnet flags and everything should be good to go. I believe the only thing the testnet flag did was change the port to use. So, if you're using a .conf file, make sure the port to connect to the localhost RPC server is set to 9109 (mainnet port) and not 19109 (testnet port).
     
  7. anvoice

    anvoice Member

    Dec 22, 2015
    229
    78
    Male
    Not from what I understand. Some flags got changed, e.g. --rpcuser instead of -u, and now there is the wallet passphrase to consider. My configuration file is properly made too, everything works except the authentication.
     
  8. David

    David Sr. Member

    Jan 22, 2016
    364
    207
    Male
    USA
    Here is a very basic mainnet dcrwallet.conf file:

    Code:
    username=same-user-as-dcrd
    password=same-pass-as-dcrd
    noclienttls=true
    noservertls=true
    walletpass=public-wallet-key-if-applicable
    If, when you generated your mainnet wallet, you chose to apply an additional layer of security to your wallet after entering the first passphrase, the additional password goes in walletpass. If you went with the default option of "no", then you can remove the walletpass entry.
     
  9. anvoice

    anvoice Member

    Dec 22, 2015
    229
    78
    Male
    I went with yes (not a bad idea since this is mainnet). Anyway the point is, I'm pretty sure I ran all CLI commands correctly, including the walletpass. So my issue persists for now.
     
  10. sambiohazard

    sambiohazard Sr. Member

    Jan 21, 2016
    844
    372
    flags were changed because devs suggested use of full flags to remove confusion e.g. --rpcuser instead of -u which both do the same job. Also latest version of cgminer can now handle TLS on windows so --notls flags are not required if you want to use TLS(more secure). You can try my guide for mainnet which a few people have used successfully including me.

    https://forum.decred.org/threads/pr...import-mining-guide-use-at-your-own-risk.472/
     
    ClokworkGremlin and David like this.
  11. David

    David Sr. Member

    Jan 22, 2016
    364
    207
    Male
    USA
    What CLI commands are you using? If you have .conf files setup for dcrd and dcrwallet, the only thing you need to run in the CLI is "dcrd" and "dcrwallet". No flags are needed since each executable will reference the individual .conf files in C:\Users\username\AppData\Local\dcr____\
     
  12. sambiohazard

    sambiohazard Sr. Member

    Jan 21, 2016
    844
    372
    check your dcrwallet & dcrd folder in local appdata folder if it has rep.cert & rpc.key files in it. If not you probably didn't run with TLS. If one of them has it try copying into other folder and rerunning the daemon & wallet.
     
  13. anvoice

    anvoice Member

    Dec 22, 2015
    229
    78
    Male
    I did follow that guide. Everything was put in correctly,, the wallet .cert file is there, and if it wasn't it would be giving a different error (can't find .cert file). So it seems as if the issue is the wrong password/username, but I checked those many times.
     
  14. drunkenmugsy

    drunkenmugsy Sr. Member
    Advocate (Reddit)

    Dec 28, 2015
    405
    218
    Male
    So they should be the same? Mine are different.
     
  15. davecgh

    davecgh Hero Member
    Developer Organizer

    Dec 31, 2015
    642
    788
    Male
    United States
    The easiest thing to do if you are having username/password issues with RPC is to start with something super basic that you know works.

    For example, literally use "USER" for you username and "PASS" for your password.

    First terminal:
    dcrd --rpcuser="USER" --rpcpass="PASS"

    Second terminal:
    dcrctl --rpcuser="USER" --rpcpass="PASS" getblockcount


    Once you have that woring you can change the username and password and start adding the other options like --miningaddr. After that, you can move onto dcrwallet, etc.
     
    sambiohazard and David like this.
  16. anvoice

    anvoice Member

    Dec 22, 2015
    229
    78
    Male
    Thanks for the response dave. All that works for me no problem. Mining works fine too (except the blank cgminer screen), just the wallet that refuses to connect. I checked that the username/password matches properly multiple times.
     
  17. drunkenmugsy

    drunkenmugsy Sr. Member
    Advocate (Reddit)

    Dec 28, 2015
    405
    218
    Male
    I think what is messing me up is the public/private passphrase. It does not seem to want to use what I set it to or I am using the switches improperly. What is the exact cmd to enable stake mining with the wallet and then what is the exact cmd to unlock the wallet? dcrd does not need these passphrases correct? Neither does cgminer?
     
  18. anvoice

    anvoice Member

    Dec 22, 2015
    229
    78
    Male
    I can't tell you about the stake mining as I can't get my wallet to work, but you're right in that dcrd and cgminer don't need the passphrase.
     
  19. David

    David Sr. Member

    Jan 22, 2016
    364
    207
    Male
    USA
    Stake mining is enabled when you launch dcrwallet and bring your wallet online with the flag --enablestakemining
    The wallet is unlocked with the command:
    Code:
    dcrctl --wallet walletpassphrase yourwalletpassword timeinseconds
     
  20. drunkenmugsy

    drunkenmugsy Sr. Member
    Advocate (Reddit)

    Dec 28, 2015
    405
    218
    Male
    This is getting ridiculous. I had testnet working great. I mined and staked over 1500 coins.

    This is what I get:
    Code:
    dcrctl -u user -P pass --wallet walletpassphrase [B][I]publicphrase[/I][/B] 0
    401 Unauthorized.
    
    In dcrwallet cli:
    dcrwallet -username user -Password pass --dcrdusername=user --dcrdpassword=pass --enablestakemining --balancetomaintain=200.0 --ticketmaxprice=5
    
    16:23:25 2016-02-08 [WRN] WLLT: Ticket purchase for stake mining is enabled, but tickets could not be purchased because the wallet is currently locked!
    16:23:48 2016-02-08 [WRN] DCRW: Unauthorized client connection attempt
    
    Mining is busted too. I just keep getting "Found share for Pool 0!" nothing is being accepted.
     

Share This Page