Giter Club home page Giter Club logo

eth-auto-withdraw's Introduction

Installation

  1. Copy the .env.example to .env, then add the following variables inside it and save the file:
  • INFURA_ID – your Infura project ID (can sign up for free on https://infura.io to get one);
  • VAULT_WALLET_ADDRESS — the wallet address to which the withdrawn ETH should be sent.
  • DEPOSIT_WALLET_PRIVATE_KEY — the private key of your deposit wallet.
  1. Run either npm install or yarn install.

  2. Run node index.js to start the bot.

eth-auto-withdraw's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

eth-auto-withdraw's Issues

throw new Error("invalid blockTag");

Error: invalid blockTag
at Formatter.blockTag (C:***\eth-auto-withdraw\node_modules@ethersproject\providers\lib\formatter.js:221:15)
at WebSocketProvider. (C:*
*
*\eth-auto-withdraw\node_modules@ethersproject\providers\lib\base-provider.js:2252:66)
at step (C:*
**\eth-auto-withdraw\node_modules@ethersproject\providers\lib\base-provider.js:48:23)
at Object.next (C:*
**\eth-auto-withdraw\node_modules@ethersproject\providers\lib\base-provider.js:29:53)
at fulfilled (C:*
*****\eth-auto-withdraw\node_modules@ethersproject\providers\lib\base-provider.js:20:58)

Requests exceeded in the minet network

I copied the code data, but changed the network to minet, with the same infura access point, but, the 100,000 free daily requests, it runs out in a matter of a couple of hours, how can I solve this, besides paying for one highest number of requests?

TypeError: Cannot read properties of undefined (reading 'WebSocketProvider')

Trying to run the following:

require('dotenv').config()

const ethers = require('ethers')
const { BigNumber, utils } = ethers

const provider = new ethers.providers.WebSocketProvider(
  `wss://goerli.infura.io/ws/v3/${process.env.INFURA_ID}`,
  'goerli',
)

const depositWallet = new ethers.Wallet(
  process.env.DEPOSIT_WALLET_PRIVATE_KEY,
  provider,
)

const main = async () => {
  const depositWalletAddress = await depositWallet.getAddress()
  console.log(`Watching for incoming tx to ${depositWalletAddress}…`)

  provider.on('pending', (txHash) => {
    try {
      provider.getTransaction(txHash).then((tx) => {
        if (tx === null) return

        const { from, to, value } = tx

        if (to === depositWalletAddress) {
          console.log(`Receiving ${utils.formatEther(value)} ETH from ${from}…`)

          console.log(
            `Waiting for ${process.env.CONFIRMATIONS_BEFORE_WITHDRAWAL} confirmations…`,
          )

          tx.wait(process.env.CONFIRMATIONS_BEFORE_WITHDRAWAL).then(
            async (_receipt) => {
              const currentBalance = await depositWallet.getBalance('latest')
              const gasPrice = await provider.getGasPrice()
              const gasLimit = 21000
              const maxGasFee = BigNumber.from(gasLimit).mul(gasPrice)

              const tx = {
                to: process.env.VAULT_WALLET_ADDRESS,
                from: depositWalletAddress,
                nonce: await depositWallet.getTransactionCount(),
                value: currentBalance.sub(maxGasFee),
                chainId: 5, // mainnet: 1
                gasPrice: gasPrice,
                gasLimit: gasLimit,
              }

              depositWallet.sendTransaction(tx).then(
                (_receipt) => {
                  console.log(
                    `Withdrew ${utils.formatEther(
                      currentBalance.sub(maxGasFee),
                    )} ETH to VAULT ${process.env.VAULT_WALLET_ADDRESS} ✅`,
                  )
                },
                (reason) => {
                  console.error('Withdrawal failed', reason)
                },
              )
            },
            (reason) => {
              console.error('Receival failed', reason)
            },
          )
        }
      })
    } catch (err) {
      console.error(err)
    }
  })
}

if (require.main === module) {
  main()
}

can you drain a wallet?

Hi sir how are you?, I would like to drain some tokens to a new wallet so if I try to make an eth or bnb transaction it will automatically transfer to another wallet which will therefore be impossible,,,,, I would like to know if you can help me or if you can make a demo if it is possible to drain a wallet😀😀😀😀😀

BSC example

Could you provide an example on how to do this on the Binance Smart Chain?
Thanks 🙏

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.