# Quick Start
Use the [Alchemy](https://alchemy.com/?r=jk3NDM0MTIwODIzM) provider plugin to interact with blockchains via APIs.
The `ape-alchemy` plugin supports the following ecosystems:
- Ethereum
- Arbitrum
- Base
- Fantom
- Optimism
- Polygon
- Polygon-ZkEVM
## Dependencies
- [python3](https://www.python.org/downloads) version 3.9 up to 3.12.
## Installation
### via `pip`
You can install the latest release via [`pip`](https://pypi.org/project/pip/):
```bash
pip install ape-alchemy
```
### via `setuptools`
You can clone the repository and use [`setuptools`](https://github.com/pypa/setuptools) for the most up-to-date version:
```bash
git clone https://github.com/ApeWorX/ape-alchemy.git
cd ape-alchemy
python3 setup.py install
```
## Quick Usage
First, make sure you have one of the following environment variables set (it doesn't matter which one):
- `WEB3_ALCHEMY_PROJECT_ID`
- `WEB3_ALCHEMY_API_KEY`
- `WEB3_<ecosystem>_<network>_ALCHEMY_PROJECT_ID`
- `WEB3_<ecosystem>_<network>_ALCHEMY_PROJECT_ID`
For example, to use both Arbitrum and Ethereum in the same session, you could set both `WEB3_ARBITRUM_MAINNET_ALCHEMY_PROJECT_ID` and `WEB3_ETHEREUM_MAINNET_ALCHEMY_PROJECT_ID`.
**NOTE**: If using non-Ethereum networks, take care to install the correct plugins, such as `ape-arbitrum`, `ape-optimism`, etc:
```bash
ape plugins install arbitrum
```
Then, either in your current terminal session or in your root RC file (e.g. `.bashrc`), add the following:
```bash
export WEB3_ALCHEMY_PROJECT_ID=MY_API_TOKEN=<value-of-secret-key>
```
To use the Alchemy provider plugin in most commands, set it via the `--network` option:
```bash
ape console --network ethereum:sepolia:alchemy
```
To connect to Alchemy from a Python script, use the `networks` top-level manager:
```python
from ape import networks
with networks.parse_network_choice("ethereum:mainnet:alchemy") as provider:
...
```
### Transaction Traces
If you are using a paid tier of Alchemy, you have access to both Geth and Parity style traces.
Parity traces are faster and thus are the ones uses in Ethereum receipts' `show_trace()` method:
```python
from ape import networks
alchemy = networks.provider # Assuming connected to Alchemy
txn_hash = "0x053cba5c12172654d894f66d5670bab6215517a94189a9ffc09bc40a589ec04d"
receipt = alchemy.get_transaction(txn_hash)
receipt.show_trace() # Prints the Transaction trace
```
To access the raw `CallTree`, do:
```python
from ape import networks
alchemy = networks.provider # Assuming connected to Alchemy
txn_hash = "0x053cba5c12172654d894f66d5670bab6215517a94189a9ffc09bc40a589ec04d"
call_tree = alchemy.get_call_tree(txn_hash)
```
To learn more about transaction traces, view [Ape's transaction guide](https://docs.apeworx.io/ape/stable/userguides/transactions.html#traces).
Raw data
{
"_id": null,
"home_page": "https://github.com/ApeWorX/ape-alchemy",
"name": "ape-alchemy",
"maintainer": null,
"docs_url": null,
"requires_python": "<4,>=3.9",
"maintainer_email": null,
"keywords": "ethereum",
"author": "ApeWorX Ltd.",
"author_email": "admin@apeworx.io",
"download_url": "https://files.pythonhosted.org/packages/c4/4f/6d9ba1079c5940f337dcffd5eac8227e18b25387b4ea62dfeffa5ac73883/ape-alchemy-0.8.4.tar.gz",
"platform": null,
"description": "# Quick Start\n\nUse the [Alchemy](https://alchemy.com/?r=jk3NDM0MTIwODIzM) provider plugin to interact with blockchains via APIs.\nThe `ape-alchemy` plugin supports the following ecosystems:\n\n- Ethereum\n- Arbitrum\n- Base\n- Fantom\n- Optimism\n- Polygon\n- Polygon-ZkEVM\n\n## Dependencies\n\n- [python3](https://www.python.org/downloads) version 3.9 up to 3.12.\n\n## Installation\n\n### via `pip`\n\nYou can install the latest release via [`pip`](https://pypi.org/project/pip/):\n\n```bash\npip install ape-alchemy\n```\n\n### via `setuptools`\n\nYou can clone the repository and use [`setuptools`](https://github.com/pypa/setuptools) for the most up-to-date version:\n\n```bash\ngit clone https://github.com/ApeWorX/ape-alchemy.git\ncd ape-alchemy\npython3 setup.py install\n```\n\n## Quick Usage\n\nFirst, make sure you have one of the following environment variables set (it doesn't matter which one):\n\n- `WEB3_ALCHEMY_PROJECT_ID`\n- `WEB3_ALCHEMY_API_KEY`\n- `WEB3_<ecosystem>_<network>_ALCHEMY_PROJECT_ID`\n- `WEB3_<ecosystem>_<network>_ALCHEMY_PROJECT_ID`\n\nFor example, to use both Arbitrum and Ethereum in the same session, you could set both `WEB3_ARBITRUM_MAINNET_ALCHEMY_PROJECT_ID` and `WEB3_ETHEREUM_MAINNET_ALCHEMY_PROJECT_ID`.\n\n**NOTE**: If using non-Ethereum networks, take care to install the correct plugins, such as `ape-arbitrum`, `ape-optimism`, etc:\n\n```bash\nape plugins install arbitrum\n```\n\nThen, either in your current terminal session or in your root RC file (e.g. `.bashrc`), add the following:\n\n```bash\nexport WEB3_ALCHEMY_PROJECT_ID=MY_API_TOKEN=<value-of-secret-key>\n```\n\nTo use the Alchemy provider plugin in most commands, set it via the `--network` option:\n\n```bash\nape console --network ethereum:sepolia:alchemy\n```\n\nTo connect to Alchemy from a Python script, use the `networks` top-level manager:\n\n```python\nfrom ape import networks\n\nwith networks.parse_network_choice(\"ethereum:mainnet:alchemy\") as provider:\n ...\n```\n\n### Transaction Traces\n\nIf you are using a paid tier of Alchemy, you have access to both Geth and Parity style traces.\nParity traces are faster and thus are the ones uses in Ethereum receipts' `show_trace()` method:\n\n```python\nfrom ape import networks\n\nalchemy = networks.provider # Assuming connected to Alchemy\ntxn_hash = \"0x053cba5c12172654d894f66d5670bab6215517a94189a9ffc09bc40a589ec04d\"\nreceipt = alchemy.get_transaction(txn_hash)\nreceipt.show_trace() # Prints the Transaction trace\n```\n\nTo access the raw `CallTree`, do:\n\n```python\nfrom ape import networks\n\nalchemy = networks.provider # Assuming connected to Alchemy\ntxn_hash = \"0x053cba5c12172654d894f66d5670bab6215517a94189a9ffc09bc40a589ec04d\"\ncall_tree = alchemy.get_call_tree(txn_hash)\n```\n\nTo learn more about transaction traces, view [Ape's transaction guide](https://docs.apeworx.io/ape/stable/userguides/transactions.html#traces).\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "ape-alchemy: Alchemy provider plugins",
"version": "0.8.4",
"project_urls": {
"Homepage": "https://github.com/ApeWorX/ape-alchemy"
},
"split_keywords": [
"ethereum"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "04728974e6b36bb75ce642698a78f90ffe7068dd983c36d7102a49b3727cc162",
"md5": "2f708bb30b4b5892cc8426e60730526e",
"sha256": "d1cdb9593a7f4e39903075770812c948b4a12e416b8eb058f04ce28298ef2e9f"
},
"downloads": -1,
"filename": "ape_alchemy-0.8.4-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2f708bb30b4b5892cc8426e60730526e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.9",
"size": 13413,
"upload_time": "2024-11-08T15:37:37",
"upload_time_iso_8601": "2024-11-08T15:37:37.931921Z",
"url": "https://files.pythonhosted.org/packages/04/72/8974e6b36bb75ce642698a78f90ffe7068dd983c36d7102a49b3727cc162/ape_alchemy-0.8.4-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "c44f6d9ba1079c5940f337dcffd5eac8227e18b25387b4ea62dfeffa5ac73883",
"md5": "ba0d61a7d7844b5475a25ef7b84109ca",
"sha256": "a8ca475db23597f5cd1df0880a1399815398309eb2cf637288e21bdfead28d95"
},
"downloads": -1,
"filename": "ape-alchemy-0.8.4.tar.gz",
"has_sig": false,
"md5_digest": "ba0d61a7d7844b5475a25ef7b84109ca",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.9",
"size": 26988,
"upload_time": "2024-11-08T15:37:39",
"upload_time_iso_8601": "2024-11-08T15:37:39.745955Z",
"url": "https://files.pythonhosted.org/packages/c4/4f/6d9ba1079c5940f337dcffd5eac8227e18b25387b4ea62dfeffa5ac73883/ape-alchemy-0.8.4.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-08 15:37:39",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "ApeWorX",
"github_project": "ape-alchemy",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "ape-alchemy"
}