nimiq / mining-pool

Nimiq Mining-Pool Server
Apache License 2.0
39 stars 34 forks source link

Add Device Label #12

Closed ryan-rowland closed 6 years ago

ryan-rowland commented 6 years ago

Expect optional deviceLabel field in REGISTER message, saving it to a new table called device, indexed by id. This can be used like:

CREATE PROCEDURE getUserDevices(IN address VARCHAR(28), IN seconds INT)
BEGIN
  SELECT device.label as label, COUNT(DISTINCT share.device) as deviceCount, SUM(share.difficulty) * 65536 / seconds as hashRate
    FROM share, device, user
    WHERE user.address = address
    AND share.user = user.id
    AND device.id = share.device
    AND share.datetime > (UNIX_TIMESTAMP(now()) - seconds) * 1000
    GROUP BY device.label;
END

See: https://github.com/nimiq-network/core/pull/395 https://github.com/nimiq-network/developer-reference/pull/23

ryan-rowland commented 6 years ago

See https://github.com/nimiq-network/mining-pool/pull/14