This project facilitates the sending of private transactions via the Flashbots API on the Ethereum network. The private transaction sender enables secure, private transaction submission, with support for major DeFi protocols. It is configured for flexibility and ease of use with environment-based settings.
https://docs.flashbots.net/flashbots-auction/advanced/rpc-endpoint#eth_sendprivatetransaction
The project is organized as follows:
private_transaction_sender/
├── src/
│ ├── config/
│ │ ├── __init__.py # Config package initializer
│ │ └── settings.py # Configuration settings for different environments
│ ├── helpers/
│ │ └── private_transaction_sender.py # Main script for sending private transactions
│ ├── models/ # (Optional) Place to store any data models if needed
│ └── utils/ # (Optional) Utilities for additional helper functions
├── .env.example # Example environment variable file
├── requirements.txt # List of dependencies
└── README.md # Project documentation
src/config/settings.py
: Contains the configuration settings, including environment variables and options fordevelopment
andproduction
.src/helpers/private_transaction_sender.py
: Core module for sending private transactions. It leverages the Web3 and Flashbots libraries to securely submit transactions..env.example
: Template file for setting environment variables. Copy this file to.env
and configure with your private key and environment settings.requirements.txt
: Lists the required dependencies to run the project.
git clone https://github.com/sergeychernyakov/private_transaction_sender.git
python3 -m venv venv
- On Linux/MacOS:
source venv/bin/activate
- On Windows:
venv\Scripts\activate
Install packages listed in requirements.txt
, including essential libraries for Web3 interaction, Flashbots API, and environment variable management.
pip install -r requirements.txt
Copy the example .env
file and configure it with your private Ethereum key and environment settings.
cp .env.example .env
Update .env
with the following variables:
PRIVATE_KEY
: Your private key for signing transactions.APP_ENV
: Set todevelopment
orproduction
depending on the environment.
If you add new dependencies, update requirements.txt
by running:
pip freeze > requirements.txt
To send a private transaction, execute the private_transaction_sender
script as follows:
python3 -m src.helpers.private_transaction_sender
# .env.example
# Keys
PRIVATE_KEY='your_private_key_here'
APP_ENV='development'
Ensure that your PRIVATE_KEY
is kept secure and not exposed publicly.
The project requires various dependencies, which are listed in the requirements.txt
. Key libraries include:
web3
: For interacting with the Ethereum network.eth-account
: Handles account and transaction signing.flashbots
: API for private transaction submission.python-dotenv
: For managing environment variables from.env
.
For the full list of dependencies, refer to the requirements.txt
file.
Sergey Chernyakov
Telegram: @AIBotsTech