forknote / forknote-pool

Mining pool for Bytecoin/Forknote based coins such as Bytecoin and Dashcoin.
https://github.com/forknote/forknote-pool
GNU General Public License v2.0
122 stars 182 forks source link

Blockchain Explorer #45

Open bezzee opened 6 years ago

bezzee commented 6 years ago

Blockchain explorer is not displaying the blocks/transactions, it just shows the empty page with no values.

I've setup the pool in a subdirectory like http://xyz.com/pool And here is my front-end settings

var api = "http://xyz.com/pool:8117"; var api_blockexplorer = "http://xyz.com/pool:1118"; var poolHost = "xyz.com/pool";

And I've added this to the coin config in the pool

rpc-bind-ip=0.0.0.0 enable-blockchain-indexes=1 enable-cors=*

Please advise as to what I need to change to display the blockchain correctly.

pmitchev commented 6 years ago

are you able to make RPC to the daemon not from localhost?

bezzee commented 6 years ago

hmm I'm not sure how to check that. Could you please explain it? When I run the command from local machine and remote machine

curl 127.0.0.1:44873 -d '{"method":"getblockheaderbyheight","params":{"height":1}}' Requested url is not found

I get this error. It's the same when I tried from a different machine.

bezzee commented 6 years ago

My bad, I used a wrong url while testing the RPC method. With the right URL now I was able to RPC from local as well as remote machine (tested for the method getblockheaderbyheight and it returns values as expected).

Any idea what else I could check?

servc4 commented 6 years ago

Hi I have same issue... when I run command from console where the pool is runing curl demonhost:18081/json_rpc -d '{"method":"getblockheaderby height","params":{"height":100}}'

I get answer {"jsonrpc":"2.0","result":{"block_header":{"depth":1640,"difficulty":3948,"hash":"67cde8b9a3995b83ec2deecd97f567890ea1a56d964af7f0bdd5e2b77844a605","height":99,"major_version":3,"minor_version":0,"nonce":2149190104,"orphan_status":false,"prev_hash":"e95a546eebeb47916e310e763be0fa723079bdb865dda3a6b938054e21788d33","reward":70342174034331,"timestamp":1512523086},"status":"OK"}}

then in config I set var api_blockexplorer = "demonhost:18081"; and there is no results.. Any idea why ??

servc4 commented 6 years ago

Hi I made some changes in my source... and now answer on command curl -s -X POST 127.0.0.1:18081/json_rpc -d '{"params": {"hash" : "abb030db953218630ff656a6487e79098acc9b62b316e23c186b88ad1a9bad9a"} ,"jsonrpc":"2.0","id":"test","method":"f_block_json"}' -H 'Content-Type: application/json'

Is:

{"id":"test","jsonrpc":"2.0","result":{"block":{"alreadyGeneratedCoins":"1749749696798552973","alreadyGeneratedTransactions":29747,"baseReward":63694221767932,"blockSize":550,"depth":0,"difficulty":9609537,"effectiveSizeMedian":100000,"hash":"abb030db953218630ff656a6487e79098acc9b62b316e23c186b88ad1a9bad9a","height":26124,"major_version":3,"minor_version":0,"nonce":581693486,"orphan_status":false,"penalty":0.0,"prev_hash":"a39cc082b709231d5209ab7fd4ef51b29ed6c86ca2030a83afbc3ea9ee196971","reward":63694221767932,"sizeMedian":395,"timestamp":1517180998,"totalFeeAmount":0,"transactions":[{"amount_out":63694221767932,"fee":0,"hash":"95443f8a7fce21c57da6b1b2370f56cea0d48c2b096065908f05ddf685e93a4a","size":431}],"transactionsCumulativeSize":431},"status":"OK"}}

looks ok but explorer still not work any suggestion ??

flarecurrency commented 6 years ago

I got this error

(Thread 1) Error polling getblocktemplate {"code":"ECONNREFUSED","errno":"ECONNREFUSED","syscall":"connect"}

flarecurrency commented 6 years ago

I got the samething right now, but when I try this trough the web page its not even loading or something.

curl 127.0.0.1:38985/json_rpc -d '{"method":"getblockheaderbyheight","params":{"height":100}}'

result: {"jsonrpc":"2.0","result":{"block_header":{"depth":4711,"difficulty":4228,"hash":"0540de153be718e083038b5be10ffc173250a42a17a947339122fe01282078be","height":99,"major_version":3,"minor_version":0,"nonce":209761323,"orphan_status":false,"prev_hash":"71001a262f179dfdf70ab18c424617ce9c9e7a47ebf8c46ec070254a7dc76e2f","reward":1525302758107,"timestamp":1516014979},"status":"OK"}}

servc4 commented 6 years ago

Hi Forknote block explorer required more commands included in RPC Deamon server. Take a look on my command and answer from deamon is much different then yours. You need to add commands from forknote to your deamon after that hopefully will work.

Regards

flarecurrency commented 6 years ago

Hello,

Is the blockchain working by you?

servc4 commented 6 years ago

Hi not all info you can find on it but those are small thins what we need to resolve but is working.

regards

flarecurrency commented 6 years ago

Hello,

Could you share your code?

servc4 commented 6 years ago

Hi It's not mine ;) I use this one as a block explorer https://github.com/Karbovanets/Karbowanec-Blockchain-Explorer

Good lock

flarecurrency commented 6 years ago

Hello,

It's not the blockexplorer what is wrong, but the code from the pool, because it send the post and I get a response and the pool code don't show the information.

image

flarecurrency commented 6 years ago

@servc4 thanks

servc4 commented 6 years ago

Yes but like you see you ask about block 3333 and respond is with block 3332 That's why i decide to use https://github.com/Karbovanets/Karbowanec-Blockchain-Explorer it's work. Regards

servc4 commented 6 years ago

Hi I almost lunch properly working explorer but I have issue with CROS header Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:18081/getinfo. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

How I can resolve that problem .htaccess

Header set Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

Is not working I need to have ad-don in my browser to view page properly.

Regards

flarecurrency commented 6 years ago

@servc4 I fixed the blockchain explorer from the pool.

screenshot from 2018-02-01 16-11-07

You can fix the problem by changing this in your config.js

var blockchainExplorer = "http://YOUR POOL ADDRES/?hash={id}#blockchain_block";
var transactionExplorer = "http://YOUR POOL ADDRES/?hash={id}#blockchain_transaction";

next step is that you have to compile your blockchain again with some changes in the code;

  1. open this file with a editor src/Rpc/RpcServer.cpp
  2. add this under rule 165; response.addHeader("Access-Control-Allow-Origin", "*");
  3. recompile your blockchain and it works!
servc4 commented 6 years ago

You mean after line 165 response.addHeader("Content-Type", "application/json");

I need to add this response.addHeader("Access-Control-Allow-Origin", "*");

because I did that and recompile the source and is same...

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:18081/getinfo. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

blueavenue commented 6 years ago

It is solved the issue yet?

servc4 commented 6 years ago

Hi In file /src/HTTP/HttpResponse.cpp change:

HttpResponse::HttpResponse() { status = STATUS_200; headers["Server"] = "CryptoNote-based HTTP server"; }

on this:

HttpResponse::HttpResponse() { status = STATUS_200; headers["Server"] = "CryptoNote-based HTTP server"; headers["Access-Control-Allow-Origin"] = "*"; }

end build source. Regards

blueavenue commented 6 years ago

Thx i will try it and give feedback.

But i have no edit the RpcServer.cpp? Only the HttpResponse.cpp?

3ch0elite commented 6 years ago

Anyfix with using just forknote-linux? Only issue i have testing is blockdetails not showing i just get page 400 error not found seems to point to 0.0.0.0/cointicker/blockaddress

blueavenue commented 6 years ago

Feedback: It doesnt works. I build code again with the code snippets you all talk about here. My Blockchain Explorer doesnt work. Its empty page.

What Daemon you use? Forknote with config-file? Forknote without config-file? Or another Coin-Repo?

Additional Question:

What is the var api_explorer in the website config.js? And what var i have to put in?

Please help!

servc4 commented 6 years ago

You need to run your demon with additional --enable-blockexplorer in start command

Regards

blueavenue commented 6 years ago

EDIT: Blockchain Explorer works (changed nothing in the Coin Src, only gived apache2.conf the CORS Info):

Always set these headers. Header always set Access-Control-Allow-Origin "*" Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT" Header always set Access-Control-Max-Age "1000" Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, accept, client-security-token"

Then i saved the conf and do this in the command:

a2enmod headers

After that i restarted the apache2 server with:

supo service apache2 restart

Than in the pool-website config.js i put the correct API Port in.

But i have a new issue "Invalid API call"?

Is this because i have no SSL yet? Need i HTTPS for correct API working? A few days ago, i setup a pool and there stands ="Mining Pool is running" by calling the API (I think this was the time, when i run the domain with SSL, but not sure yet). Whats wrong? Thx for help.

The second issue is: I click on a block in the blockchain explorer and the website load and load and load and nothing shown... how can i solve it?

I did this like you wrote (with my Pool-Address in this case):

var blockchainExplorer = "http://62.75.139.132/pool/?hash={id}#blockchain_block";

var transactionExplorer = "http://62.75.139.132/pool/?hash={id}#blockchain_transaction";

Doesnt work.

------------- Old comment: Thx servc4 but disnt work. Have put this in the conf-file (like in the forknote-pool install instruction):

rpc-bind-ip=0.0.0.0 enable-blockexplorer=1 enable-cors=*

I tried further with:

./mycoind --config-file configs/mycoin.conf --enable-blockexplorer

But --enable-blockexplorer is not supported

What you mean with start command? Upstart Service?


blueavenue commented 6 years ago

THX to all! All works fine! The Pool is up! (62.75.139.132/pool) - Later with Domainname. (I edit Coin Source [http_server.cpp and rpc_server.cpp] and Build again)

Only the network site doesnt show me the pool and other informations. But i think, i can solve the issue the next days.

inzider commented 5 years ago

THX to all! All works fine! The Pool is up! (62.75.139.132/pool) - Later with Domainname. (I edit Coin Source [http_server.cpp and rpc_server.cpp] and Build again)

Only the network site doesnt show me the pool and other informations. But i think, i can solve the issue the next days.

Hi! Do you remember what you did to show the blocks in blockexplorer?