forked from flashbots/web3-flashbots
-
Notifications
You must be signed in to change notification settings - Fork 1
/
PKG-INFO
76 lines (55 loc) · 2.06 KB
/
PKG-INFO
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Metadata-Version: 2.1
Name: flashbots
Version: 1.1.1
Summary: flashbots client
Author: Georgios Konstantopoulos
Author-email: [email protected]
Requires-Python: >=3.9,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Requires-Dist: web3 (>=5.22.0,<6)
Description-Content-Type: text/markdown
This library works by injecting a new module in the Web3.py instance, which allows
submitting "bundles" of transactions directly to miners. This is done by also creating
a middleware which captures calls to `eth_sendBundle` and `eth_callBundle`, and sends
them to an RPC endpoint which you have specified, which corresponds to `mev-geth`.
To apply correct headers we use the `flashbot` function which injects the correct header on POST.
## Quickstart
```python
from eth_account.signers.local import LocalAccount
from web3 import Web3, HTTPProvider
from flashbots import flashbot
from eth_account.account import Account
import os
ETH_ACCOUNT_SIGNATURE: LocalAccount = Account.from_key(os.environ.get("ETH_SIGNATURE_KEY"))
w3 = Web3(HTTPProvider("http://localhost:8545"))
flashbot(w3, ETH_ACCOUNT_SIGNATURE)
```
Now the `w3.flashbots.sendBundle` method should be available to you. Look in `examples/simple.py` for usage examples.
### Goerli
To use goerli, add the goerli relay RPC to the `flashbot` function arguments.
```python
flashbot(w3, ETH_ACCOUNT_SIGNATURE, "https://relay-goerli.flashbots.net")
```
## Development and testing
Install [poetry](https://python-poetry.org/)
Poetry will automatically fix your venv and all packages needed.
```sh
poetry install
```
Tips: PyCharm has a poetry plugin
## Simple Goerli Example
See `examples/simple.py` for environment variable definitions.
```sh
poetry shell
ETH_SENDER_KEY=<sender_private_key> \
PROVIDER_URL=https://eth-goerli.alchemyapi.io/v2/<alchemy_key> \
ETH_SIGNER_KEY=<signer_private_key> \
python examples/simple.py
```
## Linting
It's advisable to run black with default rules for linting
```sh
sudo pip install black # Black should be installed with a global entrypoint
black .
```