Use the QuickNode provider plugin to interact with blockchains via QuickNode's APIs.
If you don't have a QuickNode account already, you can create one here.
The ape-quicknode plugin supports the following ecosystems:
- Ethereum
- Arbitrum
- Base
- Optimism
- Polygon
- Polygon-ZkEVM
- python3 version 3.9 up to 3.12.
You can install the latest release via pip:
pip install ape-quicknodeYou can clone the repository and use setuptools for the most up-to-date version:
git clone https://github.com/your-username/ape-quicknode.git
cd ape-quicknode
python3 setup.py installTo use the QuickNode provider, you need to set up your QuickNode credentials. You can do this by setting environment variables.
Set the following environment variables:
export QUICKNODE_SUBDOMAIN=your-quicknode-subdomain
export QUICKNODE_AUTH_TOKEN=your-quicknode-auth-tokenTo use the QuickNode provider plugin in most commands, set it via the --network option:
ape console --network ethereum:mainnet:quicknodeTo connect to QuickNode from a Python script, use the networks top-level manager:
from ape import networks
with networks.ethereum.mainnet.use_provider("quicknode") as provider:
# Your code here
...You can access transaction traces using the QuickNode provider:
from ape import networks
quicknode = networks.provider # Assuming connected to QuickNode
txn_hash = "0x45a8ab098ef27f028afe532f3ca241a3425725093f1302c9bf14a03993891b70" # Replace the hash with another hash if needed or using another network
trace = quicknode.get_transaction_trace(txn_hash)
print(f"Raw call tree: {trace.get_raw_calltree()}")You can test the QuickNode provider functionality directly from the Ape console. Here's a step-by-step guide:
- Initialize the Ape console with QuickNode provider:
ape console --network ethereum:mainnet:quicknode- Once in the console, you can make various calls to test the functionality:
# Get the latest block number
networks.provider.get_block('latest').number
# Get the current network gas price
networks.provider.gas_price
# Get a transaction by its hash
tx_hash = "0x45a8ab098ef27f028afe532f3ca241a3425725093f1302c9bf14a03993891b70" # Replace the hash with another hash if needed or using another network
networks.provider.get_transaction(tx_hash)
# Get a transaction receipt
networks.provider.get_receipt(tx_hash)
# Get a transaction trace
networks.provider.get_transaction_trace(tx_hash).get_raw_calltree()To run the unit tests for the QuickNode plugin:
pytest tests/To set up the development environment:
- Clone the repository
- Install the development dependencies:
pip install -e ".[dev]"- Install the pre-commit hooks:
pre-commit installContributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache 2.0 License.