DurianStallSingapore / Zilliqa-Mining-Proxy

Mining Proxy between Zilliqa Nodes and Miners
https://proxy.getzil.com
GNU General Public License v3.0
28 stars 29 forks source link

API NiceHash #23

Closed muhmad-f-k closed 4 years ago

muhmad-f-k commented 5 years ago

Hi. its possibel to make it work with new Nicehash API? thank you.

muhmad-f-k commented 5 years ago

@ShengguangXiao There is anyway we can do something with target diff? like sett it highere the network diff? thank you.

ShengguangXiao commented 5 years ago

The new nice hash api we will put some effort on it when we have resource

muhmad-f-k commented 5 years ago

The new nice hash api we will put some effort on it when we have resource

Thank you.

muhmad-f-k commented 5 years ago

Hi. For info. The OLD NiceHash platform will close down on September 10, 2019

ShengguangXiao commented 5 years ago

@frode88 You can try the new nicehash api on branch test/nicehash_newapi, please send log to me if you find problem

muhmad-f-k commented 5 years ago

@ShengguangXiao Thank you alot. I will test and give you feedback.

muhmad-f-k commented 5 years ago

@ShengguangXiao Hi. what you mean with("your registered pool id on nice hash) you mean pool name? And I have one wish. Its possibel to make the proxy get highst price and make new order based on that price +1% ish. now proxy make order on price 2BTC. thank you.

ShengguangXiao commented 5 years ago

New nice hash platform need to register the pool first.

muhmad-f-k commented 5 years ago

New nice hash platform need to register the pool first.

Yes. I did register the pool on Nicehash. then I just use pool name i have on NH and set it in the config.

ShengguangXiao commented 5 years ago

I think cannot use pool name, you need to use API to find your pool id. Use get_my_pools function in private_api

muhmad-f-k commented 5 years ago

I think cannot use pool name, you need to use API to find your pool id. Use get_my_pools function in private_api

Done and it worked but one issue,

1 And one more thing. Proxy to slow to outbid aother orders. almost no chance getting hash on Nicehash:S

ShengguangXiao commented 5 years ago

The problem is fixed, now only stop active orders.

muhmad-f-k commented 5 years ago

@ShengguangXiao Thank you.

da-tai commented 5 years ago

I am trying to test on https://api-test.nicehash.com. I changed the url in pool.conf and made test keys. Got test BTC but I get this error.

[2019-09-06 18:17:04,734 INFO   poolserver.py:264] Start place order in nicehash
[2019-09-06 18:17:05,233 ERROR  runners.py:43] Task exception was never retrieved
future: <Task finished coro=<nice_hash_task() done, defined at /Zilliqa/Zilliqa-Mining-Proxy/zilpool/poolserver.py:248> exception=Exception('400: Bad Request: b\'{"error_id":"4341b922-ec9b-4749-a443-2e9adac376a7","errors":[{"code":60,"message":"Malformed request"}]}\'')>
Traceback (most recent call last):
  File "/Zilliqa/Zilliqa-Mining-Proxy/zilpool/poolserver.py", line 267, in nice_hash_task
    price=2, limit=1, amount=0.02, pool_id=config.nicehash["pool_id"])
  File "/Zilliqa/Zilliqa-Mining-Proxy/zilpool/nicehash.py", line 217, in create_hashpower_order
    return self.request('POST', '/main/api/v2/hashpower/order/', '', order_data)
  File /Zilliqa/Zilliqa-Mining-Proxy/zilpool/nicehash.py", line 152, in request
    raise Exception(str(response.status_code) + ": " + response.reason + ": " + str(response.content))
Exception: 400: Bad Request: b'{"error_id":"4341b922-ec9b-4749-a443-2e9adac376a7","errors":[{"code":60,"message":"Malformed request"}]}'
da-tai commented 5 years ago

Error when accessing privApi.get_top_price()

Traceback (most recent call last):
  File "/snap/pycharm-community/147/helpers/pydev/_pydevd_bundle/pydevd_exec2.py", line 3, in Exec
    exec(exp, global_vars, local_vars)
  File "<input>", line 1, in <module>
  File "Zilliqa/Zilliqa-Mining-Proxy/zilpool/nicehash.py", line 275, in get_top_price
    full_orders = pubAPI.get_active_orders2()
  File "Zilliqa/Zilliqa-Mining-Proxy/zilpool/nicehash.py", line 55, in get_active_orders2
    daggerOrders = [order for order in response if order['algorithm'] == 'DAGGERHASHIMOTO' and order['market'] == 'USA']
  File "Zilliqa/Zilliqa-Mining-Proxy/zilpool/nicehash.py", line 55, in <listcomp>
    daggerOrders = [order for order in response if order['algorithm'] == 'DAGGERHASHIMOTO' and order['market'] == 'USA']
TypeError: string indices must be integers
ShengguangXiao commented 4 years ago

@Swaggadan Please make sure your key and organization id is correct

ShengguangXiao commented 4 years ago

@Swaggadan The isssue Error when accessing privApi.get_top_price() is fixed, please sync with branch test/nicehash_newapi and try.

muhmad-f-k commented 4 years ago

thank you.

muhmad-f-k commented 4 years ago

Hello Boss. The proxy never get right price from NH and there is erro say set price more then 4digits.. and its very slow to get lastest price..

muhmad-f-k commented 4 years ago

@ShengguangXiao :)

ShengguangXiao commented 4 years ago

@frode88 Can you show me some logs, i test the function seems can get the the right price. From my test, i can get the standard order top price 2.2102 image

muhmad-f-k commented 4 years ago

@ShengguangXiao So bascily get top price first 2-3 times then on block 99-00 its never do price betting so lose miners on that block. So i look at the NH website and proxy its not always show the top price i see on NH on the proxy. and there is other problem- i did fix it but i dont think i did it the right way. you can maybe take a look at it? a5ba556c-819d-4031-8c09-25ff4d6d4e88

muhmad-f-k commented 4 years ago

@ShengguangXiao and sometime right before pow it kill the order. i dont know if need to change avg time or something.. Skjermbilde

ShengguangXiao commented 4 years ago

@frode88 Look at this PR to fix the set price error, i think nicehash have changed their API check input, it is more strict now. https://github.com/DurianStallSingapore/Zilliqa-Mining-Proxy/pull/29

muhmad-f-k commented 4 years ago

@ShengguangXiao Thank you for fast reply and help:) I have last question, How often check/ask for top price NH API.. its in second/how many second..

ShengguangXiao commented 4 years ago

@frode88 await asyncio.sleep(10), now it is every 10 seconds

muhmad-f-k commented 4 years ago

@ShengguangXiao thank you:)

muhmad-f-k commented 4 years ago

@ShengguangXiao Hi. One last thing i saw to day that it look like it only get top price from usa - when order on EU. takes around 5-10 sec before proxy see latest top price..

ShengguangXiao commented 4 years ago

@frode88 Right now, we only get top price from USA market, i also fixed in PR https://github.com/DurianStallSingapore/Zilliqa-Mining-Proxy/pull/29

muhmad-f-k commented 4 years ago

@ShengguangXiao wonderfull :) may explane why not getting rigt price always.. so if i reduce the await asyncio.sleep(10) it will check NH api very often yes?

muhmad-f-k commented 4 years ago

@ShengguangXiao Hi again. Is the proxy set not to check top price when the proxy doing real pow? i see miners get lost on the pow..:S and if it possibel to add to config how often proxy should check top price against nh api..

muhmad-f-k commented 4 years ago

@ShengguangXiao . Tested new code and get this erro..

Skjermbilde

proxy also try to place muliti orders.. its something with this line?

while True: txBlock = await blockchain.Zilliqa.get_current_txblock() logging.info(f"Current block number {txBlock}") txBlockMod = txBlock % 100 blockToPlaceOrder = config.nicehash.get("place_order_block", 97) if txBlockMod == blockToPlaceOrder and isNinceHashOrderPlaced is not True: logging.info(f"Start place order in nicehash")

create order

muhmad-f-k commented 4 years ago

@ShengguangXiao Hi. Maybe if you have time can take look at this part? return 2.98.. still dont get that what this do..

pubAPI = public_api(self.host)

result = self.get_orders()

    full_orders = pubAPI.get_active_orders2(self.config["location"])
    logging.info(f"full orders: {full_orders}")
    if not full_orders:
        return 2.98
    if excluded_orders is None:
        excluded_orders = []
    full_orders = [order for order in full_orders if order["type"] == 'STANDARD' and order["id"] not in excluded_orders]
    orders = [order for order in full_orders if float(order["speedLimit"]) >= min_limit_speed
              and float(order["acceptedCurrentSpeed"]) >= min_accepted_speed]

Skjermbilde as you see in this pic. proxy have no chance. after zil node send pow. proxy stop bidding and never see the top price. look like get only top price from newly created orders..

3- Proxy get all order like fixed and standar - fixed should be filterd out