Giter Club home page Giter Club logo

searcher-minter's Introduction

Flashbots searcher-minter

This repository contains a very simple demo application of Flashbots, which allows arbitrary submission of a single transaction to Flashbots. This could be used for many simple purposes, but in the demonstration, the goal was to mint an NFT.

Video Live Coding Demo

You can find a walkthrough of Flashbots and the creation of this NFT minting bot here:

YouTube - Using Flashbots to Mint NFTs on Ethereum - Part 1

How to run

Get some Goerli ETH on a wallet (you'll need a faucet). Extract that Goerli wallet's private key (in MetaMask Account Details -> Export Private Key), use that value below for WALLET_PRIVATE_KEY.

Note: It is EXTREMELY dangerous to deal with private keys in this manner, but bots require access to these keys to function. Be careful when using raw private keys that own mainnet ETH or other valuable assets. Keep as little value in these "hot" accounts as possible.

npm install
WALLET_PRIVATE_KEY=0x1d9af4................ npx ts-node src/index.ts

Goerli Contract Addresses

  • WasteGas: 0x957B500673A4919C9394349E6bbD1A66Dc7E5939
  • FakeArtMinter: 0x20EE855E43A7af19E407E39E5110c2C1Ee41F64D

Where can I learn more?

Check out docs.flashbots.net.

searcher-minter's People

Contributors

epheph avatar

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

searcher-minter's Issues

Error: Execution reverted

Hi, Thanks for the tutorial on flashbots. I'm able to send bundle to flasbots goerli relayer but I'm getting error: execution reverted

Code:

async function main() {
    const flashbotsProvider = await FlashbotsBundleProvider.create(provider, Wallet.createRandom(), FLASHBOTS_RELAY_GOERLI)
    const block = await provider.getBlock("latest");
    const maxBaseFeeInFutureBlock = FlashbotsBundleProvider.getMaxBaseFeeInFutureBlock(block.baseFeePerGas, 1);
    const priorityFee = GWEI.mul(50);

    const transactions = [
            {
                transaction: {
                    chainId: CHAIN_ID,
                    type: 2,
                    value: ETHER.div(100).mul(3),
                    gasLimit: 50000,
                    data: "0x1249c58b",
                    maxFeePerGas: priorityFee.add(maxBaseFeeInFutureBlock),
                    maxPriorityFeePerGas: priorityFee,
                    to: "0x20EE855E43A7af19E407E39E5110c2C1Ee41F64D",
                },
                signer: wallet,
            }
        ]

    provider.on('block', async (blockNumber) => {
        console.log(blockNumber);

        const response = await flashbotsProvider.sendBundle(transactions, blockNumber + 1)
        console.log(await response.simulate())

        if ('error' in response) {
            console.log(response.error)
            return
        }

    })


}

console.log(await response.simulate()) outputs:

{
  bundleHash: '0x73b428ceb04de261de0357640938810694ec1789a29fdddeaac22e517c394f77',
  coinbaseDiff: BigNumber { _hex: '0x08d280b2237400', _isBigNumber: true },
  results: [
    {
      coinbaseDiff: '2483250000000000',
      error: 'execution reverted',
      ethSentToCoinbase: '0',
      fromAddress: '0x59aE28410f867f779Fd60059c7224f94a14eCA49',
      gasFees: '2483250000000000',
      gasPrice: '50000000000',
      gasUsed: 49665,
      toAddress: '0x20EE855E43A7af19E407E39E5110c2C1Ee41F64D',
      txHash: '0xda34f1f4eb61495540dd83f872d65fcadc03b2f3dedad83d708d9eda6276ac57'
    }
  ],
  totalGasUsed: 49665,
  firstRevert: undefined
}

What could be the reason for such error ?

Can't provide WALLET_PRIVATE_KEY env

I am not sure exactly what I am doing wrong but no matter what I try I can not get it to recognize my private key. The command in the readme does not work I get:
WALLET_PRIVATE_KEY=0x (private key) : The term
'WALLET_PRIVATE_KEY=0x(private key) ' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

  • WALLET_PRIVATE_KEY='0x(private key) ...
  •   + CategoryInfo          : ObjectNotFound: (WALLETPRIVATE...(private key) :String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CommandNotFoundException.
      
      
    

error execution reverted

chain ID = 1
flashbots_relay_endpoint = https://relay.flashbots.net/
nft value = 0.026

transaction: {
chainId: 1,
type: 2,
value: [BigNumber],
data: '0xe9ae9e510000000000000000000000000000000000000000000000000000000000000001',
gasLimit: 1503716,
maxFeePerGas: [BigNumber],
maxPriorityFeePerGas: [BigNumber],
to: '0x22d202872950782012baC53346EE3DaE3D78E0CB'
}

error

Is there anything wrong with my variable? When I use goerli testnet to test minting the FakeArtMinter contract , it work. But when I go mainnet, and a live contract, it failed, keep saying error execution reverted

Add "why" section to README

Seems like a cool project but I don't understand why I would want to use this. To mint an NFT, sure โ€” but why? Would this save on transaction fees? Is front-running a concern with NFT minting?

Just think a simple section in the README that described "why is this helpful" would be helpful for others stumbling upon the repo! ๐Ÿ˜„

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.