gradinkov / rudehash

NVIDIA miner written in PowerShell.
https://rudehash.org/
MIT License
9 stars 4 forks source link

Profiles #71

Closed gradinkov closed 6 years ago

gradinkov commented 6 years ago

Here's the example structure of a current JSON (there's more settings in real life, but this is just for demonstration):

{
  "Worker": "desktop",
  "Coin": "zec",
  "Pool": "suprnova",
  "Miner": "dstm"
}

This could be changed to something like this:

[
  {
    "id": 1,
    "Worker": "desktop",
    "Coin": "zec",
    "Pool": "suprnova",
    "Miner": "dstm"
  }
]

And then a "multi-profile" config would look like:

[
  {
    "id": 1,
    "Worker": "desktop",
    "Coin": "zec",
    "Pool": "suprnova",
    "Miner": "dstm"
  },
  {
    "id": 2,
    "Worker": "desktop",
    "Coin": "btcp",
    "Pool": "suprnova",
    "Miner": "excavator"
  }
]

If there's only one, RH would just start mining as it does now. But if RH detects that there's more than 1 profile, it'd ask the user to select one.

Now the only question that remains is, how well does PowerShell's ConvertTo/From-Json handle this.

gradinkov commented 6 years ago

An alternative option would be a command line argument to point to a different JSON file.

gradinkov commented 6 years ago

Useful links:

https://jsonformatter.curiousconcept.com/ https://jsoneditoronline.org/

gradinkov commented 6 years ago
{
  "ActiveProfile":2,
  "Profiles":
  [
    {
      "Worker":"desktop",
      "Coin":"zec",
      "Pool":"suprnova",
      "Miner":"dstm"
    },
    {
      "Worker":"desktop",
      "Coin":"btcp",
      "Pool":"suprnova",
      "Miner":"excavator"
    }
  ]
}
gradinkov commented 6 years ago

Quick solution:

{
  "ActiveProfile":0,
  "Profiles":[
    {
      "Pool":"zpool",
      "Algo":"equihash",
      "Coin":"",
      "Miner":"dstm",
      "Worker":"rudehash",
      "Currency":"USD",
      "ElectricityCost":0.1,
      "Watchdog":true,
      "Debug":false,
      "MonitoringKey":"",
      "MphApiKey":"",
      "Wallet":"1HFapEBFTyaJ74SULTJ5oN5BK3C5AYHWzk",
      "WalletIsAltcoin":false,
      "User":"",
      "Region":"",
      "ExtraArgs":""
    },
    {
      "Pool":"zergpool",
      "Algo":"hsr",
      "Coin":"",
      "Miner":"hsrminer-hsr",
      "Worker":"rudehash",
      "Currency":"USD",
      "ElectricityCost":0.1,
      "Watchdog":false,
      "Debug":true,
      "MonitoringKey":"",
      "MphApiKey":"",
      "Wallet":"1HFapEBFTyaJ74SULTJ5oN5BK3C5AYHWzk",
      "WalletIsAltcoin":false,
      "User":"",
      "Region":"",
      "ExtraArgs":""
    }
  ]
}

Final, preferred form:

{
  "Debug":false,
  "Worker":"rudehash",
  "Currency":"USD",
  "ElectricityCost":0.1,
  "MonitoringKey":"",
  "MphApiKey":"",
  "ActiveProfile":0,
  "Profiles":[
    {
      "Pool":"zpool",
      "Algo":"equihash",
      "Coin":"",
      "Miner":"dstm",
      "Watchdog":true,
      "Wallet":"1HFapEBFTyaJ74SULTJ5oN5BK3C5AYHWzk",
      "WalletIsAltcoin":false,
      "User":"",
      "Region":"",
      "ExtraArgs":""
    },
    {
      "Pool":"zergpool",
      "Algo":"hsr",
      "Coin":"",
      "Miner":"hsrminer-hsr",
      "Watchdog":false,
      "Wallet":"1HFapEBFTyaJ74SULTJ5oN5BK3C5AYHWzk",
      "WalletIsAltcoin":false,
      "User":"",
      "Region":"",
      "ExtraArgs":""
    }
  ]
}
gradinkov commented 6 years ago

Config generator + validator is ready. Now "all" that's left is actually using it that way. It seems there's a totally 1:1 match between JSON arrays/hashtables and PS arrays/hashtables so it should be pretty doable.

Certain keys will be on different levels, that's a change.

Gotta decide if I want to request user input on the active profile, or just use the JSON option. Hmm...

gradinkov commented 6 years ago

Or maybe, just maybe, it could be another config option lol. AskForProfile or something. If having such an option, gotta make sure that there's a timeout, otherwise mining will stop after a restart. Make sure to update ActiveProfile after each startup. Also do some pretty-print / format-table for the profiles.

FRW/compatcheck will not cover adding new profiles on top of the current one. done, only checks selected profile

Also gotta figure out indexing, config generator starts at 1! done, indexes are shifted

Will have to test if PowerShell reorders profiles, coz then we're in trouble. Then we gotta add an ID field and do some stupid lookups instead of direct indexing. But this will make validation way more difficult. Would prefer some sort of manual enforced sorting. Arraylists are not reordered apparently.

gradinkov commented 6 years ago

Select all when clicking in the json textarea done

gradinkov commented 6 years ago

Generate uuid from js done

gradinkov commented 6 years ago

Add to website for easy access? Or do installer, then we can have nice shortcuts.

gradinkov commented 6 years ago

Website is yes and no, it's neat to have, but it'll always validate against the latest schema, while the user may not have that. Prolly go the installer route, it has a lot of benefits.

gradinkov commented 6 years ago

I'll leave AskForProfile for now.