steppsr / getxchtxPS

XCH Transaction Exporter : getxchtxPS [Powershell Edition]
Apache License 2.0
4 stars 0 forks source link

Add check to script to make sure user is on a farmer #5

Open steppsr opened 2 years ago

steppsr commented 2 years ago

Add check to script to make sure user is on a farmer. If user is on a harvester, the chia wallet commands will not return the needed data.

Jacek-ghub commented 2 years ago

It would be nice to somehow check whether port 9256 is open. On Linux, openssl can be used, and actually test for chia cert. Although, I don't know what could be done on Win side to do a similar test.

Although, as mentioned on chiaforum, one can ssh forward port 9256 to a remote box and run those scripts from there. This way, regardless of what OS is the (remote) node, the script can run on whatever OS is convenient for the user.

steppsr commented 2 years ago

This script isn't using the RPC API, it is running CLI commands and capturing the output. Using RPC in PowerShell required merging the Cert and Key into a PFX file, which you need additional software to complete (such as OpenSSL). I didn't want to require the the user to install more software which I why I used the CLI.

However, I should be able to use PowerShell to see if the Wallet port is open. Then if not I can give a graceful message to the user.

Test-NetConnection -ComputerName 127.0.0.1 -Port 9256