lmusarella / Pancakeswap-Prediction-Bot-2023

I rewrote the code of the PancakeSwap Prediction Game BOT by bobalice7, removing the malicious code where for each transaction to the smart contract it sent transactions to this wallet 0xfB669b0e0656036D747d6C6F2666e530139d2899.
MIT License
26 stars 6 forks source link

Bot hangs at Waiting for next round #7

Closed lloydwoods closed 1 year ago

lloydwoods commented 1 year ago

Just found your release and thought I would give it a whirl. I can launch it via yarn or npm, neither give me errors (oh, BTW, I did have to change the API constants from api.binance.com to data.binance.com as I was getting an error on that) but the bot runs and just sits eternally on "Waiting for next round: XXXXXX". It displays the correct upcoming round number, and will change if I close the script and re-launch it, but it never progresses past this point.

It is not writing anything to the logs, which I find interesting. image

lmusarella commented 1 year ago

Hi, thanks for reporting. Why was the Binance API url giving you an error? How long did you wait after the round started? usually after the round opens, you have to wait 1 minute before you see anything displayed.

lloydwoods commented 1 year ago

Binance API was saying bad response from server on bot launch. I'm in the US if that matters, found the other URL via a google search.

Oh yeah, I've waited way more than one minute. I've ran as my user, ran as root. Let it run for a few hours last night, still just sat at waiting for the next round no matter how long. Waiting time in the config is still 265000

lmusarella commented 1 year ago

I tried changing the binance url. I managed to start the bot correctly, with the default settings, except the simulated mode. Seems to work fine, try to see if the smart contract listeners are being invoked correctly. issue_7_test

lmusarella commented 1 year ago

To see if smart contract listeners are working. Try inserting console logs and relaunch the bot. I expect the message to be printed. Inside the pcs-bot.js file under EVENTS.START_ROUND_EVENT put a console.log. I made you a screenshot of how to do it.

console.log('START_ROUND_EVENT IS TRIGGHERED!');

issue_7_check

lloydwoods commented 1 year ago

Added that code and relaunched. It still just sits and sits on Waiting for next round. I don't see any additional log files, and nothing is printing on the screen that wasn't before. Where do you reference BSC_NODE_PROVIDER_URL? I'm wondering since I'm in the US and had issues hitting api.binance.com, but data.binance.com works fine for the price calls, I wonder if perhaps the BSC node isn't passing the traffic it should for the script?

lmusarella commented 1 year ago

Interesting, I'll check it out when I get home from work. Have you tried checking that the abi and url of the smart contract are correct?

rootisareservedword commented 1 year ago

@lloydwoods Noticed you said you were using the release. I haven't tried the release, but am having mostly success with cloning the repository. @lmusarella has done a fantastic job fixing a couple of issues that I have reported recently, but I'm not sure if the release version has been updated to reflect those changes. You might try just cloning the repo. Btw, thanks for pointing out about how to fix the Binance API errors. I am also getting those errors, so I will try changing the URL. Thanks!

lmusarella commented 1 year ago

Unfortunately I can't reproduce your case, however I released a new release and updated binance urls.

Try re-downloading the project from scratch.

I used https://www.quicknode.com/ to define my node on the BSC chain.

issue_7_bsc_node

lloydwoods commented 1 year ago

Yeah. I don't know either. I'm a Linux novice, but I think everything is in order. It didn't like the newest version of openjs originally, but I managed to install 14.16 which it was happy with. I cloned again and still no dice.

I was asking where in the code that BSC_NODE_PROVIDER_URL is defined? Like I found the constant files for the binance price, but I'm not seeing where BSC_NODE_PROVIDER_URL is defined in the code of this script, I was going to try some other URLs for it.

ghost commented 1 year ago

I'm having the same issue as @lloydwoods has, it;s stuck at waiting for next round i have also added the console.log as indicated above but it's not printing to the console that the smart contract is being triggered. Im using https://bsc-dataseed1.binance.org/ as the Node url provider?

BSC_NODE_PROVIDER_URL = https://bsc-dataseed1.binance.org

lloydwoods commented 1 year ago

I'm having the same issue as @lloydwoods has, it;s stuck at waiting for next round i have also added the console.log as indicated above but it's not printing to the console that the smart contract is being triggered. Im using https://bsc-dataseed1.binance.org/ as the Node url provider?

BSC_NODE_PROVIDER_URL = https://bsc-dataseed1.binance.org

Yeah, I know what node URLs to use, but the script itself calls BSC_NODE_PROVIDER_URL, what other files is that particular constant defined in so I can try a different URL to see if that's my issue? If I knew where in the script that BSC_NODE_PROVIDER_URL is actually defined by the URL I can edit that and try a different node.

rootisareservedword commented 1 year ago

You mean these? I think you really only need to edit the .env file. I'm using QuickNode and it doesn't hang on the first round.

image

lmusarella commented 1 year ago

To modify the variable: BSC_NODE_PROVIDER_URL you need to open the ".env" file.

I recommend using an editor or IDE like VisualStudio. Here is the ling for free download https://code.visualstudio.com/download

My node version is 17.1.0

I finally managed to replicate your problem. it is surely the fault of the URL of the node that you have chosen. I copied "https://bsc-dataseed1.binance.org/" in my BSC_NODE_PROVIDER_URL property and here is the result. The same problem.

issue_7_solved

We can see that round 156964 has already started but I didn't get any hits on the console. Your same problem.

issue_7_solved_1

I advise you to use https://www.quicknode.com/ and set up your own node. It's completely free and easy to stetup.

lloydwoods commented 1 year ago

@rootisareservedword OMG, I didn't even thing about it being in the env file.....that was the issue.

lloydwoods commented 1 year ago

@lmusarella You were correct, I built my own node and put that in and it's working perfectly now. Shoot me your BSC address, this is worthy of a little tip.

lmusarella commented 1 year ago

Perfect, thank goodness!

0x0C40e4F3606aE2F41DAc9bB67606f41284755350

This is my wallet, thank you for reporting it. If you like, we also leave a star on GitHub :D