Supported protocols • Chainstack blog • Chainstack docs • Blockchain API reference • Start for free
This project uses the web3.py library to guide you through pending transactions, nonce gaps, transaction replacements, and gas fee estimation.
Read the full tutorial on the Chainstack blog:
This repository contains the scripts used in the Blockchain transactions in Ethereum mempool – Coding edition tutorial. The blog discusses some reasons for transaction confirmation delays in EVM-based networks. The scripts use Python and the web3.py
library to:
- Conduct gas fee estimation
- Send transaction
- "Cancel" or "Speed Up" a transaction
- handle nonce gap
Before running the code, it is highly recommended that you go through the blog as it describes the whole logic of the code.
Clone this repository.
Install the Python dependencies:
cd web3.py
Then
pip install -r requirements.txt
Set up your credentials in each .py
file:
# Setting node endpoint value
CHAINSTACK_NODE_ENDPOINT = '<NODE_ENDPOINT>'
# Setting account addressess
# you can copy the account addresses from metamask]
FROM_ACCOUNT = "<FROM_ACCOUNT_ADDRESS>"
TO_ACCOUNT = "<TO_ACCOUNT_ADDRESS>"
# Setting the user private key
SENDER_PRIVATEKEY = "<SENDER_PRIVATE_KEY>"
Run the file that you want to use:
python gas_estimate.py
- Python ^3.6
- A node RPC endpoint.
Deploy a node with Chainstack:
- web3.py ^5.29.2
Install Python on your system:
Clone this repository.
Install the Python dependencies:
pip install -r requirements.txt