thebrumby / HotWalletClaimer

Looking to optimize your earnings with HOT tokens on the Near Protocol? How about Wave on SUI? Tree on BSC? Or Vertus on Ton? This Python script simplifies the process by monitoring your account status within popular Telegram apps, ensuring rewards are claimed at the correct time.
MIT License
89 stars 31 forks source link

Startup auto #1

Closed Wellynounet closed 2 months ago

Wellynounet commented 3 months ago

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

thanks again for this good script

thebrumby commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

I tried to do something similar like saving the telegram session cookies to use them on each account. just by saving the seed phrase but chat gpt is not very good

it's a bit painful to reset the connection to telegram and the seedphrase each time I've had 3 power cuts in 2 days and I'm in a very civilized country :)

can't wait to test your changes

welly


De : thebrumby @.> Envoyé : mardi 2 avril 2024 18:23 À : thebrumby/HotWalletClaimer @.> Cc : Wellynounet @.>; Author @.> Objet : Re: [thebrumby/HotWalletClaimer] Startup auto (Issue #1)

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 reboot the machine but keep the session names consistent across each individual session, the script now remains logged into both Telegram and the app without storing your seed phrases. 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.

— Reply to this email directly, view it on GitHubhttps://github.com/thebrumby/HotWalletClaimer/issues/1#issuecomment-2032509780, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVAZVDLDOWNFOGXUYH4LI3TY3LLR7AVCNFSM6AAAAABFHAQMMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZSGUYDSNZYGA. You are receiving this because you authored the thread.Message ID: @.***>

thebrumby commented 3 months ago

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 commented 3 months ago

hey , brumby

I just downloaded the new script no worries everything works as well as expected without consuming a huge amount of resources than the previous ,

big improvement I'm very happy thank you very much :) However it must come from me I try to connect my 3rd account on the same telegram like the other 2 and I have this problem I have tested 5 times tjr the same I even reinstalled everything script nothing to do my first account and cursed :)

the other accounts have all been connected with the Qr code provided in the session name folder. like the not working one

maybe it will work tomorow :)

the python3 claim.py session-name work great too auto connect 🙂

thanks again for the amazing job 🙂


De : thebrumby @.> Envoyé : mardi 2 avril 2024 22:07 À : thebrumby/HotWalletClaimer @.> Cc : Wellynounet @.>; Author @.> Objet : Re: [thebrumby/HotWalletClaimer] Startup auto (Issue #1)

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 anew.
  5. Initiating the script with "python3 claim.py mySession", where "mySession" is your previous session, 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.

— Reply to this email directly, view it on GitHubhttps://github.com/thebrumby/HotWalletClaimer/issues/1#issuecomment-2033006429, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVAZVDIJIOTRISNKKD6P4TLY3MFYZAVCNFSM6AAAAABFHAQMMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZTGAYDMNBSHE. You are receiving this because you authored the thread.Message ID: @.***>

Wellynounet commented 3 months ago

forget about this part :

"the other accounts have all been connected with the Qr code provided in the session name folder. like the not working one

maybe it will work tomorow :) "after deleting the folder welly in screenshot and selenium all working great for all my 3 account


De : marc hang @.> Envoyé : mardi 2 avril 2024 22:44 À : thebrumby/HotWalletClaimer @.> Objet : RE: [thebrumby/HotWalletClaimer] Startup auto (Issue #1)

hey , brumby

I just downloaded the new script no worries everything works as well as expected without consuming a huge amount of resources than the previous ,

big improvement I'm very happy thank you very much :) However it must come from me I try to connect my 3rd account on the same telegram like the other 2 and I have this problem I have tested 5 times tjr the same I even reinstalled everything script nothing to do my first account and cursed :)

the other accounts have all been connected with the Qr code provided in the session name folder. like the not working one

maybe it will work tomorow :)

the python3 claim.py session-name work great too auto connect 🙂

thanks again for the amazing job 🙂


De : thebrumby @.> Envoyé : mardi 2 avril 2024 22:07 À : thebrumby/HotWalletClaimer @.> Cc : Wellynounet @.>; Author @.> Objet : Re: [thebrumby/HotWalletClaimer] Startup auto (Issue #1)

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 anew.
  5. Initiating the script with "python3 claim.py mySession", where "mySession" is your previous session, 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.

— Reply to this email directly, view it on GitHubhttps://github.com/thebrumby/HotWalletClaimer/issues/1#issuecomment-2033006429, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVAZVDIJIOTRISNKKD6P4TLY3MFYZAVCNFSM6AAAAABFHAQMMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMZTGAYDMNBSHE. You are receiving this because you authored the thread.Message ID: @.***>

thebrumby commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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 commented 3 months ago

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

Wellynounet commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

Hey Welly,

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

image image image image

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

Wellynounet commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

image

and too much time to wait

thebrumby commented 2 months ago

OK cool, thanks Welly.

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

Wellynounet commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

Thanks all working great and fast != no more issues

thebrumby commented 2 months ago

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 commented 2 months ago

hello BrumB

, hope you have a nice sunday :)

here the error i encountered frequently when he restart the session

image

thebrumby commented 2 months ago

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...

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 commented 2 months ago

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 commented 2 months ago

Cool, let me know how you get on :)

Wellynounet commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

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 commented 2 months ago

image

30 h without restart or bug everything work fine

thebrumby commented 2 months ago

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 commented 2 months ago

Hey Welly,

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

Wellynounet commented 2 months ago

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 commented 2 months ago

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!