Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup auto #1

Closed
Wellynounet opened this issue Mar 25, 2024 · 44 comments
Closed

Startup auto #1

Wellynounet opened this issue Mar 25, 2024 · 44 comments

Comments

@Wellynounet
Copy link
Collaborator

Wellynounet commented Mar 25, 2024

Hello , how to auto start program at startup ? and dont resetup everything

thanks again for this good script

@thebrumby
Copy link
Owner

thebrumby commented Mar 25, 2024

Hi, did you use a persistent session tool like SCREEN as described in the instructions? So long as you leave the server on 24/7 there is no need to set it up more than once.

It could be possible to modify it slightly to save the seed phrase, but I didn't consider this to be secure. Also, Telegram requires QR code or OTP to log in. So overall, it's best to use SCREEN and leave it constantly running in the background :)

You can watch a YouTube of me installing it and using screen here: https://www.youtube.com/watch?v=MjUquyLWPGw

@Wellynounet
Copy link
Collaborator Author

OK i understand why you dont save the seedphrase for security reason :)

and you use the selenium driver to connect in telegram not the APP telegram that why we need everytime to connect with QR code or OTP

my idea was to launch the telegram app once to go to the HOT accounts to see how much time is left before claim and to relaunch the script once claim is needed to save resources.

having several sessions on chrome uses up a lot of resources when it would only need to be activated for a few minutes a day :)

@thebrumby
Copy link
Owner

Ah, yes I understand now. I experimented with this before and just tried to reconnect later, but I couldn't get it to resume the session, even when trying to set a per-session directory:

chrome_options.add_argument("user-data-dir={}".format(session_path))

Do you have a suggestion on how to overcome this?

@Wellynounet
Copy link
Collaborator Author

sorry i can't program at all i have ideas but no idea how to implement them or even if it's possible haha

@thebrumby
Copy link
Owner

thebrumby commented Mar 26, 2024

Ah, no worries! From my understanding, the Python function used to emulate the user interacting with the Nearwallet game (Selenium), isn't really built for pausing and then resuming sessions exactly where they left off, especially without redoing the login process. Obviously, only having to log in once and then leave it running in the background with "screen" is the main benefit, although if the script crashes or the server reboots, then you lose the benefit.

It is something I'll keep trying to find a way around and with the wonder of GitHub, perhaps someone with deeper experience or a novel approach could suggest a method to conserve resources without compromising the script’s functionality. I truly appreciate your feedback on this issue. I plan to mark this issue as closed later, acknowledging that, while not perfect, the script serves its intended purpose for now. Thank you again for bringing this to our attention!

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Mar 31, 2024

hello, I just ask you why is it that after some time with my 3 accounts for claim the Hot I go from 60%-66% CPU usage to 88% - 91 % when there is nothing else on my server

yes its not powerfull but enough Its an N100 intel

it was the same with the old version too I'm with the last version 1.3.2

@thebrumby
Copy link
Owner

Hi! I believe the answer might relate to how Google Chrome operates or how your system manages free memory—though it's most likely Chrome.

For each wallet that claims simultaneously, the software creates a separate virtual instance of Google Chrome - on each instance, we log into telegram, and sign into the "game" using the private key. This Browser instance runs continuously, even when the Python script is merely waiting. If you close the Chrome instance, you'll lose your logged-in status with Telegram and the game.

You can check your available memory with the command below. If the free memory is really low, then the operating system might be swapping data in and out of the "cache".

free -m

You can also install and use a CPU usage monitor:

sudo apt install htop
htop

On my 4-core, 8GB virtual VPS, I am running 4 simultaneous wallet claims, which use about 2 GB of memory and about 25% CPU load. Using HTOP, I can see that the 4 "screen" instances each use 0% of the CPU. However, the four separate Google Chrome background processes are responsible for all the CPU usage.

Could you check if you're experiencing something similar?

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Mar 31, 2024

i have rebooted the server
that the screen shot
image

and the free -m command
image

i have 6 gigs of ram in my server & im runing lubuntu

@thebrumby
Copy link
Owner

thebrumby commented Mar 31, 2024

Yes, on my own server too, it's the same behavior. The CPU usage primarily stems from Google Chrome instances that are continually waiting for Selenium commands. Or, to put it another way, Google Chrome doesn't know we intend to sit idle for the next few hours, so is constantly running and waiting our commands. However, our Python script, in reality, remains inactive for the majority of the time, utilizing less than 1% of CPU resources. It only becomes active for a short period when initiating a claim, after which it returns to a state of inactivity, leveraging time.sleep() to wait until the next action is necessary.

Selenium, a third-party Python module our script utilizes, is responsible for facilitating interactions with Google Chrome browser sessions. However, Google Chrome operates independently of our script's intentions, maintaining readiness for interaction commands across each instance associated with our separate screen sessions. This continuous state of readiness results in persistent CPU usage.

Google Chrome's architecture is quite bulky, or consumes a lot of resources, because it allows for virtualization of the screen, enabling features like screenshot capture in our script's debugging functions, even in the absence of a GPU or physical monitor.

Some example of what Chrome is doing in the background are:

image image image image

All this is being created or constantly virtualised by the Google process, not knowing when our script will come to life and start to instruct the interactions.

I hope this makes sense? Phil.

@thebrumby
Copy link
Owner

thebrumby commented Mar 31, 2024

Perhaps on my days off next week, I will investigate again if there is a reliable way to close and resume the sessions by closing and reopening the driver. If I can make it save the state successfully, then I will update the public code. Right now, the code has three main functions, log into Telegram, log into the game, and handle the claims. Only the first time does it to the log in Telegram and log into the game, then afterward it just loops the claim function. If I can refine it to save the status and only open Chrome when it needs to make the claim, I will do so. But with my initial attempts at this, it never really saved it, and I had to log back in before every claim, which defeated the benefit of an auto-claim script :)

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Mar 31, 2024

no need if it's normal that it increases the processor use it's fine with me it was just to know

thanks for the script again

Perhaps on my days off next week, I will investigate again if there is a reliable way to close and resume the sessions by closing and reopening the driver. If I can make it save the state successfully, then I will update the public code. Right now, the code has three main functions, log into Telegram, log into the game, and handle the claims. Only the first time does it to the log in Telegram and log into the game, then afterward it just loops the claim function. If I can refine it to save the status and only open Chrome when it needs to make the claim, I will do so. But with my initial attempts at this, it never really saved it, and I had to log back in before every claim, which defeated the benefit of an auto-claim script :)

@thebrumby
Copy link
Owner

Thank you once again for the feedback, and I hope our discussions help others in understanding the script's functionality. I welcome further comments if you have them, or any future suggestions. Certainly, the two login functions pose the greatest challenge due to the developers trying to stop automated scripts, which is why I previously tried minimizing interactions with these components (to enhance the script's reliability and reduce the chance of errors). Your input, and that of other users, is important as we strive to improve this tool. Thanks, Phil.

@thebrumby thebrumby reopened this Apr 2, 2024
@thebrumby
Copy link
Owner

thebrumby commented Apr 2, 2024

I truly appreciate your encouragement and suggestions for enhancing the script. I'm excited to share that significant progress has been made in my local setup. Now, when the Python script is not actively logging in or claiming, it offloads the Chrome Driver. This means that, even with four sessions open, when idle, it's using less than 1% CPU usage and only a few hundred MBs of RAM.

Additionally, if you restart the script, or even if you reboot the machine and keep the session names the same for each individual session, the script now remains logged into both Telegram and the app without storing your seed phrases or passwords! This opens the door for those familiar with tools like PM2 to fully automate the process, reloading the scripts after a reboot. While I don't plan to formally adopt this as the primary method, I intend to update the Read Me documentation to highlight this possibility.

Your feedback has been key in driving this project forward, and tomorrow I will upload the updates, providing there are no errors overnight. Thanks, Phil.

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 2, 2024 via email

@thebrumby
Copy link
Owner

thebrumby commented Apr 2, 2024

Hey Welly,

I've conducted numerous tests across a variety of virtual servers and the results seem quite promising:

  1. You can continue utilizing SCREEN to manage separate sessions, as we've done previously.
  2. Once the login process is fully complete (for both Telegram and entering the Seed Phrase), the script will save your progress and close down Chrome, minimizing resource use.
  3. As a result, CPU and RAM usage remains low when the script is idle and simply passing time between claims, rather than the high usage before.
  4. Restarting the script with the same session name you previously used should automatically resume where you left off, without needing to log in each time.
  5. As an alternative to 4) above, initiating the script with "python3 claim.py mySession", where "mySession" is the exact spelling of a previous session name, will bypass the initial setup options and directly proceed to resuming your session.
  6. Given the ability to pass the session name as a command line arguement, you could now leverage PM2 or a similar process manager to automatically reload your session in the event of a script crash or server reboot.
  7. I'm aiming to keep this project accessible for all users of all levels, so while PM2 usage is beyond the scope of what I want to directly support here, those familiar with it should find integrating it straightforward. Meanwhile, SCREEN remains a user-friendly alternative for those less accustomed to PM2.

I'm eager to hear how this updated approach works out for you. Please let me know how you get on!

Best regards,
Phil.

PS: You'll need to access each account once more with HotWalletClaimer > 1.3.3 code version (to allow it to save a logged in session) before you can try the new method to resume it with python3 claim.py mySession :)

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 2, 2024 via email

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 2, 2024 via email

@thebrumby
Copy link
Owner

Great to hear all 3 are working. I have 4 different games accounts who all use the script to claim on the one server (me, my wife, and 2 friends). Sometimes I log in with different Telegram accounts, and sometimes all from mine, so I knew that it should be possible. Pleased to hear deleting the old or corrupted folders means it's now working for all 3 simultaneously.

@thebrumby
Copy link
Owner

Hey Welly, I said I wouldn't do it, but then found time anyway! I have now added a section on automating through script crashes and server reboots using PM2!

https://github.com/thebrumby/HotWalletClaimer?tab=readme-ov-file#pm2

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 4, 2024

Absolutely, I automated everything by following the tutorial.
image

and i use :
pm2 logs

image

to check everything work fines

and it uses absolutely no resources 1 % cpu and 26 mo ram for each wallet

image

@thebrumby
Copy link
Owner

Awesome, thanks for the detailed feedback. I added "PM2 log" to the list of commands in the readme - I forgot all about that!

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 4, 2024

image

hey , brumby i get errors sometimes i dont know why

edit probleme solved :after using the debug option i find its stuck on the QR code

i'am connected with Qr code

@thebrumby thebrumby reopened this Apr 5, 2024
@thebrumby
Copy link
Owner

Hey brother,

Yes, indeed that is one of the most common issues. It says linked in the iPhone, but then it's not linked. There is also another issue when it types "/start" to bring up the link, in the HereWalletBot chat window, if something got typed or out of place with that window, then the script can't interact as normal. There will be a slightly refined version today or tomorrow that's now waiting for the pending claim button to stop spinning before it reads the "time to fill", and it has a few tweaks around starting a new session, but ultimately, if it's either of these 2 issues, then only the user can do it :)

@thebrumby thebrumby reopened this Apr 5, 2024
@thebrumby
Copy link
Owner

thebrumby commented Apr 5, 2024

Hey Welly,

If you get chance, can you test version 1.3.5 for me?

  • It should be cleaner in handling cases when a previous session is aborted part-way through - deleting the previous progress and starting from a clean folder.

  • In addition, there is now the option to reset the session in case things get screwed up:

image
  • I created a new function that handles the interaction with the game elements at each step, which should now be more standardized & resilient!
image
  • At the end of the sign-in section there is now the option to park the script for restarting with PM2:
image
  • I replaced some of the fixed length timers with dynamic timers (which move on as soon as they see something change), so it should be faster and give a few extra seconds to scan the QR code!

  • I introduced a new feature after the claim is made, if there is a spinner visible to say the claim is still pending (at times of high network or in-game lag) it will wait up to 4 minutes for the spinner to disappear before reading the time for the next claim, or move on as soon as the spinner stops.

image

Any feedback on how it works would be appreciated! Thanks in advance, Phil.

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 6, 2024

Hi brumby, I've just downloaded the new version.

everything is fine , except this error

thorium_oVaycRUmc7

and when its starting on pm2
is not logging is my 9th account too
image
maybe am rate limited too
but so far so good

but when i try to reconect with
image

i have this errror he try to connect only with OTP not the saved cookie
and the OTP method never work for me
image

and sometime its lagging
image

thanks again BrumB

@thebrumby
Copy link
Owner

thebrumby commented Apr 6, 2024

Thanks for the info, looks like it's all linked to the ability/inability to find the central box. It might be that the session got detached/logged out and is back at the QR code screen. I'll add some additional information and checks around that. Thanks for the feedback.

@Wellynounet
Copy link
Collaborator Author

image

and too much time to wait

@thebrumby
Copy link
Owner

OK cool, thanks Welly.

  • The screenshot method not working if you force to log in again was an oversight on my part! That should be fixed.
  • All the issues around the "lag" of not finding the central box are almost certainly that the account got logged out. It now checks if the QR code (log in) screen is showing again and displays warning messages if it is.
  • I added warning about not stopping the script while Chrome Driver is active, this almost always logs us out.
  • The last issue, with too much time to wait is caused by lag on the game site. I put in checks for this and correctly explain the script will check back in one hour to see if it needs to claim again or just update the timer.

The code is updated again (still 1.3.5). If you see more issues, please let me know.

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 6, 2024

OK cool, thanks Welly.

  • The screenshot method not working if you force to log in again was an oversight on my part! That should be fixed.
  • All the issues around the "lag" of not finding the central box are almost certainly that the account got logged out. It now checks if the QR code (log in) screen is showing again and displays warning messages if it is.
  • I added warning about not stopping the script while Chrome Driver is active, this almost always logs us out.
  • The last issue, with too much time to wait is caused by lag on the game site. I put in checks for this and correctly explain the script will check back in one hour to see if it needs to claim again or just update the timer.

The code is updated again (still 1.3.5). If you see more issues, please let me know.

Thanks for fast troubleshooting :)
any idea how to update the scrpt without redoing everything with loging

@thebrumby
Copy link
Owner

thebrumby commented Apr 6, 2024

Hi Welly,

PM2 doesn't check to see if the file system was updated, so simply saving 'claim.py' in your 'HotWalletBot' folder shouldn't affect anything that is running - they will just continue to run on the previous code.

However: If the script crashes, if you start a new session, or if you stop/start or restart a PM2 session, then the new code will apply.

So, if you wanted just to restart one session to test, then you can just do 'pm2 restart [session number or name]' and only the named one will use the new code.

Also, it's probable, that if the script reached its natural endpoint (I mean, it got to the end and is waiting for the next claim time), then it should restart or resume ok even with the new. code

Cheers 🍻

@Wellynounet
Copy link
Collaborator Author

Thanks all working great and fast !=
no more issues

@thebrumby
Copy link
Owner

Good to hear, let's hope they don't change anything in the game mechanics now, and it will keep "mining" for many months to come :)

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 7, 2024

hello BrumB

, hope you have a nice sunday :)

here the error i encountered frequently when he restart the session

image

@thebrumby thebrumby reopened this Apr 8, 2024
@thebrumby
Copy link
Owner

thebrumby commented Apr 8, 2024

Hey Welly,

Thanks for the coffee! it looks like you're session is getting logged out for some reason, which is what's causing this issue.

I've added some error checking that should generate the error, but prevent the code from crashing in v1.3.6.

Also in the new update...

  • I've added a new lock mechanism that will only allow one claim at a time, if others are due, they'll wait a short time until the active claim has finished - this might prevent some crashes if the concurrent claims are too big a load on the server's resources. It will let even people with smaller servers be able to claim a higher number of wallets, but more importantly, if a server restarts it won't cause a surge of claims, it'll process them one by one.

  • I've added a beta feature that saves a copy of the session into a new folder called "./backups", which happens straight after the seed phrase has been entered; it will later try to restore the backup to the "./selenium" folder if the live session crashes. You'll need to log into each account using v.1.3.6 to activate the feature, although you don't need to "upgrade" them all at once. From my initial tests, the new code detected the session had crashed, restored the backup, and continued to read the claim timer successfully!

Otherwise, your issue with it losing the session in the TG app might be linked to the maximum number of devices that can be linked at one time or something, we'll have to see how the new changes go as to whether it helps or not. I'm running 4 sessions on 1 TG account, and no issues from my side.

Let me know how you get on :) Cheers

@Wellynounet
Copy link
Collaborator Author

hi brumby , i've updated the script I'm testing if it works still a bit wobbly it must come from too many accounts on the same telegram and I'll divide into groups

@thebrumby
Copy link
Owner

Cool, let me know how you get on :)

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 8, 2024

Hello Brumby ,

more than 10 h that the script turns I separated in 2 account TLG different and not had problem the problem had to come from the 5 account no problem 6 account it crashes

we'll see if it survives the night .
don't worry about the 7 restart because I haven't deleted the name and it counts from before
image

@thebrumby
Copy link
Owner

Fingers crossed then! Seems this version is pretty stable, although noted about the maximum number of game accounts per Telegram account. There might not be anything I can do to improve that. Lef’s see.

@Wellynounet
Copy link
Collaborator Author

Fingers crossed then! Seems this version is pretty stable, although noted about the maximum number of game accounts per Telegram account. There might not be anything I can do to improve that. Lef’s see.

Yes its me on Telegram :)

@Wellynounet
Copy link
Collaborator Author

image

30 h without restart or bug everything work fine

@thebrumby
Copy link
Owner

Thanks Welly, for your help in testing the script. Hopefully now the bugs seem fixed we will have a reliable way of automated claiming for a long time to come!

@thebrumby
Copy link
Owner

Hey Welly,

I released v1.3.8 as the devs introduced a few new hurdles to jump through!

@Wellynounet
Copy link
Collaborator Author

Wellynounet commented Apr 10, 2024

les to jump through!
i see something about hold wallet i pull new things

image
no issue for like 50 h :)

great he re use the last known info no need to reconect

its possible to add info for wallet like wallet address or hot in balance

@thebrumby
Copy link
Owner

Hey Welly,

I've incorporated your suggestion to reduce the number of console messages, or more precisely, to adjust the verbosity level between 1 and 3. Level 1 displays mainly error messages or minimal details per claim. Level 2 shows the main steps of each claim, but without all the detail. Level 3 provides all the nitty gritty intricate details of every step.

Cheers, BrumB!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants