This project demonstrates how to perform a safe token transfer between two Ethereum addresses while optimizing transaction fees using the Flashbots Bundle Provider.
- Transfers tokens between two Ethereum addresses securely.
- Calculates and optimizes gas fees to save on transaction costs.
- Utilizes Flashbots Bundle Provider to include transactions in upcoming blocks.
You'll need to have Node.js installed on your machine. You can download it from here.
This project uses the following NPM packages:
ethers
: A complete Ethereum wallet implementation and utilities in JavaScript and TypeScript. GitHub Repository@flashbots/ethers-provider-bundle
: Flashbots library for Ethers.js. GitHub Repository
- Clone this repository:
git clone https://github.com/codeesura/ethereum-safe-token-transfer-flashbots.git
- Change to the project directory:
cd ethereum-safe-token-transfer-flashbots
- Install the required dependencies:
npm install
- Replace
YOUR_API_KEY
with your Alchemy API key in theprovider
constant. - Replace
PRIVATE_KEY
andHACK_PRIVATE_KEY
with the private keys of the Ethereum addresses you want to transfer tokens between.
- To start the token transfer, run the following command:
node app.js
- The script will listen for new blocks and attempt to include the token transfer in the upcoming block. Once the transaction is included, you'll see a confirmation message in the console.
Contributions, issues, and feature requests are welcome! Feel free to check the Issues page.
This project is licensed under the MIT License. See the LICENSE file for more details.