dashhive / crowdnode-cli

Earn ~6% Interest on Dash via CrowdNode - CLI for Mac, Linux, and Windows
https://github.com/dashhive/crowdnode-cli
MIT License
4 stars 1 forks source link

QA Task 2 Reviews #16

Open riongull opened 2 years ago

riongull commented 2 years ago

This issue is for QA task 2 on Trello

This is similar in nature to QA task 1, but reduced in scope.

Task Steps

To complete your QA review do the following:

  1. Follow the README instructions to install crowdnode (including prerequisites).
  2. Run either the QuickStart or the Step-by-step method to stake at least 0.5 DASH on CrowdNode using this CLI.
  3. Comment below stating any problems, suggestions, etc, or just comment with your overall experience and whether or not you were able to successfully stake your Dash.
  4. Claim your reward on the Trello CrowdNode bounty card similar to Rion's claim
jojobyte commented 2 years ago

After successfully installing with npm install --location=global crowdnode-cli@v1, running crowdnode stake 10.0 returns the following error.

❯ crowdnode stake 10.0
Fail:
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:133:10)
    at Hash.ripemd160 (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/crypto/hash.js:39:31)
    at Hash.sha256ripemd160 (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/crypto/hash.js:44:15)
    at Address._transformPublicKey (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/address.js:263:26)
    at Address.fromPublicKey (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/address.js:332:22)
    at PrivateKey.toAddress (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/privatekey.js:393:18)
    at generateKey (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:783:17)
    at initKeystore (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:498:18)
    at async stakeDash (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:427:12)

crowdnode generate returns what appears to be the same error

❯ crowdnode generate  
Fail:
Error: error:0308010C:digital envelope routines::unsupported
    at new Hash (node:internal/crypto/hash:67:19)
    at Object.createHash (node:crypto:133:10)
    at Hash.ripemd160 (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/crypto/hash.js:39:31)
    at Hash.sha256ripemd160 (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/crypto/hash.js:44:15)
    at Address._transformPublicKey (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/address.js:263:26)
    at Address.fromPublicKey (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/address.js:332:22)
    at PrivateKey.toAddress (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/@dashevo/dashcore-lib/lib/privatekey.js:393:18)
    at generateKey (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:783:17)
    at main (~/.local/opt/node-v18.4.0/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:215:11)

Is a setup step missing from the instructions?

josuer08 commented 2 years ago

testing environment:

OS: OpenSUSE Tumbleweed Type: KVM virtual machine Node version: LTS (at the moment of posting)

Results:

I am up until this point able to install and run the crowdnode-cli perfectly with just the instructions provided in the README instructions , I am just waiting to refill my wallet so I can stake the 0.5 DASh, up until this point the only thing that could be seen as a problem was a message of multiple critical vulnerabilities when I installed crowdnode via NPM:

josuer08@Machine04:~> npm install --location=global crowdnode-cli@v1

added 110 packages, and audited 111 packages in 7s

14 packages are looking for funding
  run `npm fund` for details

3 moderate severity vulnerabilities

Some issues need review, and may require choosing
a different dependency.

The audit command shows how the vulnerable package is elliptic:

# npm audit report

elliptic  <6.5.4
Severity: moderate
Use of a Broken or Risky Cryptographic Algorithm - https://github.com/advisories/GHSA-r9p9-mrjm-926w
No fix available
node_modules/elliptic
  @dashevo/dashcore-lib  <=0.18.11 || >=0.19.0
  Depends on vulnerable versions of elliptic
  node_modules/@dashevo/dashcore-lib
    crowdnode  *
    Depends on vulnerable versions of @dashevo/dashcore-lib
    node_modules/crowdnode
      crowdnode-cli  *
      Depends on vulnerable versions of crowdnode
      node_modules/crowdnode-cli

This is the only thing that looked like a possible problem or realbreaker following the Quickstart guide.

Missing tests

Need to update this when I am able to stake dash

josuer08 commented 2 years ago

Error: error:0308010C:digital envelope routines::unsupported

That problem appears to happen in many other situations and I found a possible solution in here Can you please try that solution? and also, tell us more about your OS/node version so we can have more insight into that problem? @jojobyte

coolaj86 commented 2 years ago

@jojobyte @josuer08 Needs to be LTS (v16). Node v18 removes some insecure crypto algorithms that most of the cryptocurrencies (including Dash) rely on.

curl https://webinstall.dev/node@lts | bash

Then close and re-open your terminal.

cc/ @riongull We'll have to coordinate with DCG about this. I had just assumed they would have already fixed it. If they don't have plans, I can get a pure-JS implementation of RIPEMD160 and PR to dashcore-lib. Perhaps as part of this wallet tools I'll find a solution for elliptic as well.

jojobyte commented 2 years ago

@jojobyte @josuer08 Needs to be LTS. Node v18 removes some insecure crypto algorithms that most of the cryptocurrencies (including Dash) rely on.

curl https://webinstall.dev/node@lts | bash

Then close and re-open your terminal.

cc/ @riongull We'll have to coordinate with DCG about this. I had just assumed they would have already fixed it. If they don't have plans, I can get a pure-JS implementation of RIPEMD160 and PR to dashcore-lib. Perhaps as part of this wallet tools I'll find a solution for elliptic as well.

Was just about to post this. Thought v18 was the new LTS but realized it isnt when I ran webi node@lts. It is working with Node v16. v17 and v18 are no bueno.

jojobyte commented 2 years ago

ENV

OS: Pop!_OS 22.04 LTS
Type: 64-bit
Node.js: v16 / LTS (failed with v17 & v18)

Step-by-Step Path

After installing the correct version of Node.js (v16/LTS) then reinstalling crowdnode with npm install --location=global crowdnode-cli@v1 the long path worked almost all the way until the very last step, it failed on the crowdnode transfer XxYOURxOTHERxADDRESSx 5.0 with the following messages:

# Failed with this error with an external wallet address
❯ crowdnode transfer XxSOMExOTHERxADDRESSx 5.0

'XxSOMExOTHERxADDRESSx' does not match a staking key in ./ or ~/.config/crowdnode/keys/

# Failed with this error with the address generated by crowdnode-cli
❯ crowdnode transfer XxMYxCROWDNODExGENERATEDxADDRESSx 5.0
Enter passphrase: ********

Fail:
Error: bad file path or address
    at wifFileToAddr (~/.local/opt/node-v16.15.1/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:2002:11)
    at async transferBalance (~/.local/opt/node-v16.15.1/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:1700:17)
    at async main (~/.local/opt/node-v16.15.1/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:290:5)

The Full Process with Addresses redacted is below.

❯ webi node@lts                                 

Thanks for using webi to install 'node@' on 'Linux/x86_64'.
Have a problem? Experience a bug? Please let us know:
        https://github.com/webinstall/webi-installers/issues

Lovin' it? Say thanks with a Star on GitHub:
        https://github.com/webinstall/webi-installers

'node v16.15.1' already installed:
    ~/.local/opt/node => ~/.local/opt/node-v16.15.1

❯ crowdnode generate                            
Would you like to set an encryption passphrase? [Y/n]: 
Enter (new) passphrase: ******
Enter passphrase again: ******
Encrypting...

Done 🔐

Generated ~/.config/crowdnode/keys/XxMYxCROWDNODExGENERATEDxADDRESSx.wif 

~ took 2m5s 
❯ crowdnode load 0.103                          
Selected default staking key XxMYxCROWDNODExGENERATEDxADDRESSx

dash://XxMYxCROWDNODExGENERATEDxADDRESSx?amount=0.10300000

Use the QR Code above to load 10300000 (Đ) onto your staking key.

(waiting...)

Received 10300000

~ took 1m11s 
❯ crowdnode signup
Selected default staking key XxMYxCROWDNODExGENERATEDxADDRESSx
Checking CrowdNode API... (hotwallet XxCROWDNODExHOTWALLETxX)
Checking balance... 
Key:       Đ  0.10300000
CrowdNode: Đ  0.00000000
Dividends: Đ  0.00000000

Enter passphrase: ******

Requesting account...
    ✅ SignUpForApi

~ took 44s 
❯ crowdnode accept
Selected default staking key XxMYxCROWDNODExGENERATEDxADDRESSx
Checking CrowdNode API... (hotwallet XxCROWDNODExHOTWALLETxX)
Enter passphrase: ******

Accepting terms...
    ✅ AcceptTerms

~ took 46s 
❯ crowdnode deposit 0.01
Selected default staking key XxMYxCROWDNODExGENERATEDxADDRESSx
Checking CrowdNode API... (hotwallet XxCROWDNODExHOTWALLETxX)
reserving 50000 (Đ0.00050000) for withdrawals (--no-reserve to disable)
Initiating deposit of 1000000 (Đ0.01000000)...
Enter passphrase: ******

    ✅ DepositReceived

~ took 32s 
❯ crowdnode deposit     
Selected default staking key XxMYxCROWDNODExGENERATEDxADDRESSx
Checking CrowdNode API... (hotwallet XxCROWDNODExHOTWALLETxX)
reserving 50000 (Đ0.00050000) for withdrawals (--no-reserve to disable)
Initiating deposit of 9072699 (Đ0.09072699)...
Enter passphrase: ******

    ✅ DepositReceived

~ took 1m18s 
❯ crowdnode transfer XxSOMExOTHERxADDRESSx 10.0

'XxSOMExOTHERxADDRESSx' does not match a staking key in ./ or ~/.config/crowdnode/keys/

~ 
❯ crowdnode withdrawal 5.0
Selected default staking key XxMYxCROWDNODExGENERATEDxADDRESSx
Checking CrowdNode API... (hotwallet XxCROWDNODExHOTWALLETxX)
Initiating withdrawal of 5.0%...
Enter passphrase: ******

  => received '19580' (txlock)
API Response: WithdrawalQueued

~ took 36s 
❯ crowdnode transfer XxSOMExOTHERxADDRESSx 5.0 

'XxSOMExOTHERxADDRESSx' does not match a staking key in ./ or ~/.config/crowdnode/keys/

~ 
❯ crowdnode transfer XxFUNDINGxADDRESSx 5.0

'XxFUNDINGxADDRESSx' does not match a staking key in ./ or ~/.config/crowdnode/keys/

~ 
❯ crowdnode transfer XxMYxCROWDNODExGENERATEDxADDRESSx 5.0
Enter passphrase: ******

Fail:
Error: bad file path or address
    at wifFileToAddr (~/.local/opt/node-v16.15.1/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:2002:11)
    at async transferBalance (~/.local/opt/node-v16.15.1/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:1700:17)
    at async main (~/.local/opt/node-v16.15.1/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:290:5)

Quickstart Path

With the correct version of node already installed and staking key already generated, quickstart worked without issue.

❯ crowdnode stake 0.5
Checking CrowdNode account... 

dash://XxMYxCROWDNODExGENERATEDxADDRESSx?amount=0.50000000

Use the QR Code above to load 50000000 (Đ0.50000000) onto your staking key.

(waiting...)

Received 50000000
reserving 50000 (Đ0.00050000) for withdrawals (--no-reserve to disable)
Initiating deposit of 50009590 (Đ0.50009590)...
Enter passphrase: *********
incorrect passphrase
Enter passphrase: *********

    ✅ DepositReceived
josuer08 commented 2 years ago

Needs to be LTS (v16). Node v18 removes some insecure crypto algorithms that most of the cryptocurrencies (including Dash) rely on.

The reason why I stated those vulnerabilities @coolaj86 Is because with the installation method presented via webi that is the version (16) that gets installed and it does currently have the security problems mentioned.

But the rest worked without an issue

riongull commented 2 years ago

@jojobyte, did you have really slow internet at the time you tested? Seeing some very long times:

~ took 2m5s

@coolaj86 is the transfer function meant to only transfer to addresses in your local keystore? That might explain why it wasn't working for @jojobyte.

jojobyte commented 2 years ago

@jojobyte, did you have really slow internet at the time you tested? Seeing some very long times:

~ took 2m5s

@coolaj86 is the transfer function meant to only transfer to addresses in your local keystore? That might explain why it wasn't working for @jojobyte.

No, I think it's because I had to copy my password and was reading documentation between each command.

Regarding the transfer command, even the address the CLI created failed which may be a bug, but I also belatedly noticed the documentation for transfer mentions a to and from address but the example in the readme didn't.

riongull commented 2 years ago

@coolaj86, it looks like crowdnode status displays excessive precision.

CrowdNode Stake: 400307268 (Đ4.0030726763)

It should only have 8 digits after the decimal.

riongull commented 2 years ago

crowdnode balance minor table formatting issue

Looks to have one too many spaces in the Stakings heading:

Screen Shot 2022-07-07 at 21 01 48
coolaj86 commented 2 years ago

Looks to have one too many spaces in the Stakings heading:

The Apple default Terminal font strikes again!

It's miscalculating the visual width of the sign post.

coolaj86 commented 2 years ago

the documentation for transfer mentions a to and from address but the example in the readme didn't

Specifying the from address is supposed to be optional - using your currently selected key.

mathwhiz1212 commented 2 years ago

Depositing was easy. I just ran the commands to install Node, then CrowdNode, then deposit and, used the QR code to transfer the Dash. No problems. crowdnode help is somewhat of a wall of text but I suppose that can't be helped.

mathwhiz1212 commented 2 years ago

Withdrawing was not as clear.

crowdnode withdrawal 100 returned:

API Response: WithdrawalQueued

crowdnode status now tells me:

CrowdNode Stake: 0 (Đ0)

crowdnode transfer XxYOURxOTHERxADDRESSx 100 returns: does not match a staking key in ./ or ~/.config/crowdnode/keys/

Where's the Dash? Did I do something wrong?

Edit: After seeing the above comments, I added a from address, but still get nothing. After running crowdnode balance I get:

🔑 Holdings 🪧 Stakings 💸 Earnings
DashAddress Đ 0.60297223 Đ 0.00000000 Đ 0.00000000
Totals Đ 0.00000000 Đ 0.00000000 Đ 0.00000000

but it still fails if I try to transfer:

crowdnode transfer DashAddress OtherAddress 100 returns:

Fail:
Error: not enough funds available in utxos for XsZbk6QPVoRzZEkpdbqSvwtnoyTABqiF6Q
    at Object.dashApi.createPayment (/Users/joshmudge/.local/opt/node-v16.16.0/lib/node_modules/crowdnode-cli/node_modules/crowdnode/lib/dash.js:107:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async transferBalance (/Users/joshmudge/.local/opt/node-v16.16.0/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:1705:10)
    at async main (/Users/joshmudge/.local/opt/node-v16.16.0/lib/node_modules/crowdnode-cli/node_modules/crowdnode/bin/crowdnode.js:290:5)

Edit 2: Withdrawals are a percentage, transfers are the Dash amount, there wasn't a distinction in the readme. crowdnode transfer DashAddress OtherAddress 0.60297223 returns the same error. Edit 3: crowdnode transfer DashAddress OtherAddress 0.6 worked! So did crowdnode transfer DashAddress OtherAddress 0.0029

denzelbrown commented 2 years ago

Depositing was straightforward, I followed thee step-by-step tutorial to install node/crowdnode, then sent the dash via qr code from my phone on the dash wallet app on iOS. Staking my dash was successful!

coolaj86 commented 1 year ago

@josuer08 Fixed elliptic, waiting on upstream: https://github.com/dashevo/dashcore-lib/pull/268

@jojobyte @josuer08 Fixed ripemd160, waiting on upstream: https://github.com/dashevo/dashcore-lib/pull/267

coolaj86 commented 1 year ago

Cut v1.6.1 with various fixes.

Release Notes: https://github.com/dashhive/crowdnode.js/issues/36