Auto rebake rewards on BakedBeans.io

Overview

Auto rebake script For BakedBeans miner on BSC

Background

I write code for a living and have worked in the finance space for the past 4 years. I wrote this bot because I live a busy schedule and if anything in the tech world requires simple repetitive actions, it can always be automated. The baked beans project recommends to rebake (compound) every day for 6 days and then on the 7th you can "eat" to claim back rewards.

This script has been written to automate that whole process with the ability to configure variables to tweak the scripts behaviour. For example, the default behaviour will rebake 4 times a day (REBAKES_PER_DAY) for 6 days (REBAKE_DAYS). After it's reached the required REBAKE_DAYS, it will enter "EAT DAY" and then wait 24 hours to eat (It does this to make sure we get the maximum reward from the day). It will then reset all the counters and restart the cycle.

Even though this script is labelled BakedBeans miner, it can be trivially adapted to automate many other miner dApps and BakedBeans forks. This would require code changes and replacing the smart contract calls to the desired projects functions.

Note: Make sure to have enough BNB in your wallet for gas fees as each rebake costs gas.

Configurations

Mandatory:

  • BSC_PRIVATE_KEY
    • The private key for your wallet
  • REBAKES_PER_DAY (default set to 4)
    • The number of times to rebake (compound) in 24 hours

Optional:

  • REBAKE_DAYS (default set to 6)
    • Rebakes for n days and eats on n+1 (After a full 24 hours for maximum reward). If not set, the script will continue to rebake indefinitely.
  • MIN_REWARD_AMOUNT_TO_REBAKE (default set to 0.01)
    • Won't rebake if the current reward amount is lower than this value

Note: It is necessary to add your wallets private key as this script works directly with the smart contract and would need to make transactions with your wallet i.e. rebaking and eating. This script is unlike other "auto" bots in that it doesn't require your browser to be open.

You can find your wallets private key in MetaMask

Account Options (3 dots) > Account Details > Export Private Key

Running the script

Local or VPS

Setup

Clone/fork the repo and edit the .env file to add the mandatory and any optional configs. You can also just choose the Download ZIP option found under the Code button in GitHub. Extract the ZIP and then double click the run.bat

This batch script will check if the correct required .env configs are there, then it will check if you have node installed on your machine. If it's not installed, it will automatically download it by opening your browser. You'll need to complete the installation yourself and then once it's successfully done, double click or run the run.bat script again. That's all you need to do. See below for images of the batch file running.

Note: Batch scripts only work on Windows. For Linux or Mac you'll need to run: sudo apt update && sudo apt install node and then run: npm install && npm start (after modifying the .env file).

The script will run fine this way but just note that the script will need to be running (obviously) in order for you to rebake/eat. There is local file persistence logic which holds the running counters of the script, meaning even if you restart it still has the needed metadata available.

Persisted metadata

Metadata variables Description
"REBAKE_COUNT" Running count of rebakes to know when it's time to EAT
"EAT_DAY_START_TIME" Waits for 24 hours after this time to eat
"LAST_BAKE_TIME" Waits for (24 / REBAKES_PER_DAY) hour(s) from this time to rebake again

Note: This is the same data persisted by redis when using the Heroku setup

Deploy to Heroku - FREE

Prerequisite:

  • GitHub account
  • Heroku account

This means you don't need to have the script running on your machine 24/7 as Heroku will host the script on their containers.

Steps: (Approx 10 minutes)

  1. Create a new app on Heroku
  2. Fork this repository to your own GitHub account
  3. Connect your forked repo to Heroku (Choose GitHub under Deploy)
  4. Add keys to config vars section (Found under Settings)
  5. Add the Redis To Go add-on (Nano price plan - FREE)
  6. Turn off the web dyno and turn on worker dyno

Explained:

You'll need to make an account on Heroku and create a new app. You can call this anything, mine is called bakedbeans-autostake. Then fork this repo and hook it up to Heroku, the deployment method is GitHub. I've included a heroku Procfile that selects the correct worker dyno.

Note: Make sure you are using the worker dyno and switch of the default web dyno otherwise it will pollute your logs with web dyno errors.

With the sensitivity of the data required by the script and since we're deploying it to Heroku, don't add your values in the .env file. In this case you'll need to add all mandatory and any optional keys to the Config vars section in Heroku. Heroku encrypts this so it's safe to keep confidential data here. You don't need to delete the .env, Heroku will prioritise the values in it's config vars automatically.

Redis To Go

The way Heroku works, it recycles dynos every 24 hours, which obviously is not ideal as we need to keep track of how many rebakes we're up to etc. If the script is restarted, it loses the in memory count. To work around this, I've added redis support into the script, this is to persist the running counts outside of the script so that we still have them after restarts. All you need to do is enable the add-on in Heroku for Redis To Go and choose the Nano price plan which is free. Once added it will automatically add a config var named REDISTOGO_URL. Now you're all set.

You can check the logs in Heroku to see if it's running correctly.

Log outputs

Local

Local

Heroku

Heroku

Local batch file use

On first run it will check if node is installed, if not installed it will download it in the browser

WindowsBatNodeInstall

If node is detected it will automatically install packages, create the exe and run it.

WindowsBatSetup2

On subsequent runs where the exe exists, it ask if any changes have been made to the .env and if not, will proceed to run the exe.

WindowsBatSetup3

If changes have been made to the .env it will refresh the exe and create it again.

WindowsBatSetup4

Considerations

If you like this please consider using my referral link, I'd really appreciate it

https://bakedbeans.io/?ref=0xCb7DCb16e7738C01BEf5F74AC727dE2da44AfD6F

If you're feeling extra generous, send any tips here :)

0xCb7DCb16e7738C01BEf5F74AC727dE2da44AfD6F

Disclaimer: Note this is unaudited code and is not production ready for financial transactions.

You might also like...

Automatic Role Adder Is Usually Used In Coding Servers Which Give Access To Codes By Subbing To Their Channel So This Helps Them To Auto Role People :)

Automatic Role Adder Setup Guide Automatic Role Adder Is Usually Used In Coding Servers Which Give Access To Codes By Subbing To Their Channel So This

Dec 23, 2022

Auto-compounder app for Cosmos blockchains using Authz

Auto-compounder app for Cosmos blockchains using Authz

REStake REStake allows delegators to grant permission for a validator to compound their rewards, and provides a script validators can run to find thei

Dec 29, 2022

Rename image after pasting, support name pattern and auto renaming.

Rename image after pasting, support name pattern and auto renaming.

Obsidian paste image rename This plugin is inspired by Zettlr, Zettlr shows a prompt that allows the user to rename the image, this is a great help if

Jan 2, 2023

A web component for progressively-enhanced auto-expanding textareas

A web component for progressively-enhanced auto-expanding textareas

Elastic Textarea A web component for progressively-enhanced auto-expanding textareas. This web component progressively enhances the native textarea: a

Jan 9, 2023

Utilities for auto-translating the Tera DataCenter based on XML files

xml-dc-translator Requires latest version of node.js, download here: https://nodejs.org/. Utility for auto-translating the Tera DataCenter based on XM

Sep 6, 2022

Responsive, auto-saving To-Do List single page application made from scratch using JavaScript only

Project Name To-Do List Website Name What's Next? (TO-DO List) Clone the Project git clone https://github.com/Zeraltz/todo-list.git Built With HTML, C

Jun 25, 2022

🌗 1 line of code to apply auto dark / light theme and support custom theme for your website. Super fast and lightweight theme library.

themes.js A super lightweight and fast Theme library with auto system color scheme detection in JavaScript. Features Auto detect Dark / Light mode by

Nov 29, 2022

A discord bot to track "owo", usually used to help with OwO bot. Made with Discord.js v13 includes Slash commands, Leaderboards, Auto Resets etc.

Discord-OwO-tracker A discord bot to track "owo", usually used to help with OwO bot Requirements Discord.js v13 (npm install discord.js@latest) applic

Nov 24, 2022

Responsive, auto-saving To-Do List made from scratch using JavaScript only, but refactoring the code into ES6 standard

Project Name ES6 AWESOME BOOKS Website Name AWSM BOOKS Project Website (GitHub Pages) https://github.com/Zeraltz/es6-awsm-books Clone the Project git

Jun 25, 2022
Comments
  • Im getting this error > Unable to rebake. Error: Error: call revert exception; V

    Im getting this error > Unable to rebake. Error: Error: call revert exception; V

    Hello and thanks for the code, im getting this error.. I don't know what is missing.

    `Current time: 2022-04-20T18:29:26.052Z

    Rebake count: 0 Rebakes away from eat: 24 BB Contract Balance: 34897.768 BNB Your Beans (Pre bake): 0 BEANS

    Unable to rebake. Error: Error: call revert exception; VM Exception while processing transaction: reverted with panic code 18 [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] } `

    opened by lucholabs 15
  • Log shows 0.000 BNB for rebaked amount then crashes

    Log shows 0.000 BNB for rebaked amount then crashes

    Running on Heroku.

    Censored the BEANS count though it was correct.,You will see below that the rewards amount reported (and rebaked) as 0.000 BNB. Confirmed by watching the Dapp that this was not the case at the time.

    2022-04-11T18:25:43.849713+00:00 app[worker.1]: BB Contract Balance: 22826.770 BNB 2022-04-11T18:25:43.893500+00:00 app[worker.1]: Your Beans: xxxxxxxx BEANS 2022-04-11T18:25:43.932727+00:00 app[worker.1]: BB Rewards: 0.000 BNB 2022-04-11T18:25:46.168378+00:00 app[worker.1]: Successfully rebaked: 0.000 BNB 2022-04-11T18:25:46.168394+00:00 app[worker.1]: 2022-04-11T18:25:46.168519+00:00 app[worker.1]: Waiting till next rebake in: 6 hour(s) 2022-04-11T18:26:24.194351+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch 2022-04-11T18:26:24.262612+00:00 heroku[web.1]: Stopping process with SIGKILL 2022-04-11T18:26:24.407245+00:00 heroku[web.1]: Process exited with status 137 2022-04-11T18:26:24.461922+00:00 heroku[web.1]: State changed from starting to crashed

    opened by stevenols 3
Owner
Usman Khan
Usman Khan
Automatic Daily Login Rewards (Multiple Accounts); Export wish history

Genshin Automation This tool will automatically collect Hoyolab daily login rewards. Using this tool you can: Automate your rewards on the Hoyolab web

salem 27 Dec 21, 2022
Sample of CI/CD auto deploy to own server via Github Actions

Psst — looking for a more complete solution? Check out SvelteKit, the official framework for building web applications of all sizes, with a beautiful

MauCoding 2 Mar 19, 2022
Quickly create an interactive HTML mock-up by auto sourcing lorem ipsum/images generators, with minimal html markup, and no server side code

RoughDraft.js v0.1.5 Quickly mockup / prototype HTML pages with auto-generated content, without additional JavaScript or server side code. <section>

Nick Dreckshage 464 Dec 21, 2022
Smart Auto Move learns the size and position of your application windows and restores them to the correct place on subsequent launches. Supports GNOME Wayland.

smart-auto-move smart-auto-move is a Gnome Shell extension which keeps track of all application windows and restores them to the previous position, si

khimaros 40 Dec 23, 2022
Example auto-generated OpenAPI client library and an accompanying example Angular app.

To utilize this demo Head into petstore_frontend\petes_pets Run npm install Go to frontend_client_lib\out Run npm install Head back into petstore_fron

Alan Gross 1 Jan 21, 2022
auto-vote-topgg automates voting for bots on top.gg using google chrome!

auto-vote-topgg auto-vote-topgg automates voting for bots on top.gg using google chrome! uses your account thats already logged into top.gg you must b

Anonymous 2 Jan 29, 2022
Auto-Fix Hundreds of Grammarly Errors With This Script

This script automatically applies your Grammarly suggestions. Use case: Large document with 100+ errors How to use: Go to Grammarly Web app Go to Edit

null 48 Jan 3, 2023
Obsidian plugin that adds autocomplete and auto-formatting to frontmatter tags.

Obsidian Front Matter Tag Wizard Tired of having to type # to get tag autocompletion in your Obsidian note front matter? I feel your pain. This plugin

Eric 10 Nov 5, 2022
A plugin for Strapi that provides the ability to auto slugify a field for any content type

strapi-plugin-slugify A plugin for Strapi that provides the ability to auto slugify a field for any content type. It also provides a findOne by slug e

daedalus 25 Nov 28, 2022
A browser extension to simplify web pages and hide distracting things like hide cookie banners, auto-playing videos, sidebars, etc

Unclutter Browser Extension A browser extension to simplify web pages and hide distracting things like hide cookie banners, auto-playing videos, sideb

null 849 Jan 9, 2023