theQRL / QRL

Quantum Resistant Ledger
https://theqrl.org/
MIT License
417 stars 109 forks source link

RPC block template #902

Closed sammy007 closed 6 years ago

sammy007 commented 6 years ago

So how to get block template? On medium you claim

ability to mine in existing pools, using existing mining software.

There is no rpc documentation, after quick code search I see that there is no even a trace of this functionality.

jleni commented 6 years ago

Mining pool integration is something that we are working on at the moment. What you are refering to is the complete feature set. We will have the JSON-RPC interface for the mining pools soon.

I noticed that you've been also actively developing mining pools. Maybe we can cooperate and help you with the integration. Feel free to contact us or join our Discord channel.

sammy007 commented 6 years ago

I am banned on qrl reddit, discord, slack... Just thought beta is beta, where feature set is already sealed. I have no plans in visible future to develop a pool for this algo, if you claim it will work with existing pools it will also work with my solo stratum which is available for free and will probably require only small changes. My policy is to charge exorbitant amount of money from ICO projects, never reached an agreement so far lol.

sammy007 commented 6 years ago

We will have the JSON-RPC interface for the mining pools soon.

How soon is now? There is literally nothing for devs not familiar with this code to play with rpc. Is it too hard to provide a markdown docs with 3 API calls described?

cyyber commented 6 years ago

Here is the node-cryptonote-pool which has been modified to work with QRL codebase. https://github.com/cyyber/node-cryptonote-pool/

Following is the customized QRL config.json file for cryptonote-pool (make sure to update pool address) https://github.com/jleni/qrl_dpool/blob/master/config.json

sammy007 commented 6 years ago

Offtopic, how to join testnet from master branch or maybe launch a private one?

cyyber commented 6 years ago

You need to wait for next hard fork. We have not yet hard forked network with latest codebase that supports pool mining. Although if you are interested, you can run your private network to establish the pool and setup all other stuffs related to pool mining.

sammy007 commented 6 years ago

That's what I am asking for, any documentation?

cyyber commented 6 years ago

If you would like to start your private one, you need to override the configuration file.

https://github.com/theQRL/QRL/blob/master/README.md This above link includes how to override config.json Just override peer_ip list in config.json.

Use following command to start your testnet with much less pain. qrl wallet_gen cp wallet.qrl ~/.qrl/

sammy007 commented 6 years ago
curl -X POST -H "Content-Type: application/json" --data '{"id":0,"jsonrpc":"2.0","method":"getblocktemplate","params":{"reserve_size":9,"wallet_address":"Q0106009aeec11a402bb2abfdc0f02dcefcfba8620395a686555e61cd31b37e7a07a4730fab798e"}' http://127.0.0.1:9009/json_rpc

Getting response: @@.

I see no http endpoint changes in your node pool fork, definitely missing something. or I am getting malformed reply due to some weird qrl node state?

cyyber commented 6 years ago

You need to run this grpcProxy.py https://github.com/theQRL/QRL/blob/master/qrl/grpcProxy.py This will support HTTP endpoint at port 18081

sammy007 commented 6 years ago

Consider different port for RPC, it's a conflict with Monero, there is no reason to copy rpc port if you decided to use same algo. It's confusing and annoying, some pools will definitely run both on same server.

cyyber commented 6 years ago

We will make these ports configurable, nothing will be hardcoded, and sure, will look for other ports to avoid conflict.

sammy007 commented 6 years ago

So this rpc service is not a part of default application? You can really make many lives easier if mining rpc will listen on 127.0.0.1:PORT by default without tons of configs. There are tons of coins and every need to add their own "special things".

cyyber commented 6 years ago

Yes for now the rpc service is not a part of default application. But will be added soon.

sammy007 commented 6 years ago

python3 qrl/grpcProxy.py

Traceback (most recent call last):
  File "qrl/grpcProxy.py", line 227, in <module>
    payment_slaves = read_slaves(config.user.mining_pool_payment_wallet_path)
  File "qrl/grpcProxy.py", line 21, in read_slaves
    with open(slaves_filename, 'r') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/home/.qrl/payment_slaves.json'

Why not /home/CURRENT_USER/.qrl ?

sammy007 commented 6 years ago

Missing payment_slaves.json is also confusing, where to get it?

sammy007 commented 6 years ago

Just remove the peer_ip in config.json

There is no config.json, there is config.yml in ~/.qrl. And there is no peer_ip param in it.

cyyber commented 6 years ago

You need atleast two nodes, to set it up correctly. One of the node will be a mining node, but will not be running grpcProxy.py. You can directly start that node using command qrl --randomizeSlaveXMSS

The another node should be a node with pool service enabled. You may use following command into the 2nd node (running pool service).

qrl wallet_gen qrl -r --host 104.237.3.185 slave_tx_generate (make sure you enter access_type 1 ) move the newly generated slaves.json into ~/.qrl/ qrl -r --host 104.237.3.185 slave_tx_generate --otsidx 1 (make sure you enter access_type 0 ) rename this file from slaves.json to payment_slaves.json and move it to ~/.qrl/

Now run your node, wait for the 2nd node to start mining. As soon as it successfully starts mining, you need to stop the node. Override config mining_enabled to False This will stop your node from mining alone. Restart the node.

In order to override config. you can copy the config.yml from https://github.com/theQRL/QRL The default config.yaml is already mentioned there. You can create the file ~/.qrl/config.yml and override any of the above mentioned settings.

Once you have done this, there is no need to keep running the 1st node that you started. You can surely shut it down and let the pool continue mining.

sammy007 commented 6 years ago

But it still need '/home/.qrl/payment_slaves.json' and ignores current user.

cyyber commented 6 years ago

I have mentioned above, how to generated payment_slaves.json Read again, my last comment.

sammy007 commented 6 years ago

Haven't you see that it want /home/.qrl VS cirrent /home/ME/.qrl?

cyyber commented 6 years ago

You can move that to /home/.qrl/ instead of what I mentioned above

sammy007 commented 6 years ago

Maybe it requires a fix instead?

cyyber commented 6 years ago

Before the hardfork yes, processes will be simplified from what it is now.

sammy007 commented 6 years ago

Ok, I am done, 8 months after scamming people with ICO you ended up with defunct script.

cyyber commented 6 years ago

Good luck

barrystyle commented 6 years ago

@sammy007

curl -X POST -H "Content-Type: application/json" --data '{"id":0,"jsonrpc":"2.0","method":"getblocktemplate","params":{"reserve_size":9,"wallet_address":"Q0106009aeec11a402bb2abfdc0f02dcefcfba8620395a686555e61cd31b37e7a07a4730fab798e"}' http://127.0.0.1:9009/json_rpc Getting response: @@.

perhaps try send it valid json? you're missing a brace at the end of what you're sending.

sammy007 commented 6 years ago

@barrystyle I am not missing a brace, only in my post it's not valid. I am using my existing stratum with this crap and it simply does not support reserve_size which is required for job distribution otherwise same job goes to miners and they will hash same job.

curl -X POST -H "Content-Type: application/json" --data '{"id":0,"jsonrpc":"2.0","method":"getblocktemplate","params":{"reserve_size":9,"wallet_address":"Q0106009aeec11a402bb2abfdc0f02dcefcfba8620395a686555e61cd31b37e7a07a4730fab798e"}}' http://127.0.0.1:18081/json_rpc
{"jsonrpc": "2.0", "error": {"code": -32602, "message": "Invalid params", "data": {"message": "getblocktemplate() got an unexpected keyword argument 'reserve_size'", "args": ["getblocktemplate() got an unexpected keyword argument 'reserve_size'"], "type": "TypeError"}}, "id": 0}
curl -X POST -H "Content-Type: application/json" --data '{"id":0,"jsonrpc":"2.0","method":"getblocktemplate","params":{"wallet_address":"Q0106009aeec11a402bb2abfdc0f02dcefcfba8620395a686555e61cd31b37e7a07a4730fab798e"}}' http://127.0.0.1:18081/json_rpc
{"jsonrpc": "2.0", "result": {"height": 5534, "difficulty": 146746, "status": "OK", "blocktemplate_blob": "cbfbd9a26d83388fa54892917f61e56985422fe0aa9bb75058db8187c4b8db9086e892f8b9c28c0000000022e6c67d71a4bdb15b92ac57baef2c506e0b071ad5a872c365fa9545edee5d7d19f984afddb4cbf136"}, "id": 0}

You can see 00000000 in a response, here you will put a nonce from miner, but another reserved zero bytes needed to set a pool nonce and then send this job to miner. So basically, current state of QRL is that you need to run a pool per miner which is just retarded.

sammy007 commented 6 years ago

This commit of him demonstrates that they simply have no clue https://github.com/cyyber/node-cryptonote-pool/commit/2edca30538754c1e69b8e2b88146fb532e975519

With extra nonce option nothing will work, without extra nonce pool is not a pool.

cyyber commented 6 years ago

@sammy007 Aware of that, work in progress with it.

sammy007 commented 6 years ago

Okay cool. Thanks. I don't understand why you can't make grpcproxy a part of qrl already without any extra action, we need to test software and prepare servers. Any rush last moment is annoying for everyone, causes scandals.

cyyber commented 6 years ago

@sammy007 We are looking to make that part of pip. Unfortunately, there was same change in setuptools, due to which, older pyscaffold was not working and so pip is not working right now. We had updated pyscaffold recently and changes to the project. Release will be done soon that will also include grcpProxy

sammy007 commented 6 years ago

I see some commits related to extra nonce over last 3 days, is it supposed to be fixed? If yes, here is my output using 6a35a6d3150507f8e99f88263cee44ec3a9f6ccb:

{"result": {"status": "OK", "blocktemplate_blob": "1514dd73241d8a7dd3b49deea2d524701c6319b5c4b5234e2b7d36207005a1c95b9eb0c457a1b70000000000000000b73884b533c62aa25459cc27bea7ade3398c2a3346a12f8a68ce192c69e31bafbc001c2a1f", "reserved_offset": 0, "height": 1169, "difficulty": 30399}, "id": 0, "jsonrpc": "2.0"}

reserved_offset: 0 is kinda strange. And I am getting unexpected keyword argument 'reserve_size' as well.

cyyber commented 6 years ago

You need to wait for next hard fork & release.

barrystyle commented 6 years ago

@sammy007 you're aware several pools (including myself) were using that modified cryptonote repo with no issues? as far back as a week (or further) and successfully solving blocks.. the job of any stratum is to divide the nonce ranges to scan equally per miner; thats not purely up to extranonce itself..

sammy007 commented 6 years ago

OMG stop teaching me ok? I am talking about interface. I see it clearly that there is extra 4 bytes available now, hence 8 total.

sammy007 commented 6 years ago

Currently there is uint32 for extra nonce. I would like to specify reserve size of 8 bytes vs default 4 hence it will be possible to shard stratums with the same block template. That's how it works in Monero. I was just confused that there is no way currently to request more. According to @cyyber I assume it will be implemented soon.

cyyber commented 6 years ago

It has been implemented, we were testing the pool. Commit will be available soon.