# 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
- Optimism
- Polygon
## 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/93/cc/601b0e966c1211b79742a1d79e9dc8c193faa84b2aa489a5bdb737e9fa48/ape-alchemy-0.8.0.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- Optimism\n- Polygon\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.0",
"project_urls": {
"Homepage": "https://github.com/ApeWorX/ape-alchemy"
},
"split_keywords": [
"ethereum"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "a36bb9c99aaf29b2e1515d4d5c43f502de926e51671c9979148b48432a23355d",
"md5": "109faf4de4918deb7fde41eb96e715b6",
"sha256": "27ec7d62f74ada56c7bf5b5ad608076253ac7a9cbcaaf786f1e1d07ef24f2823"
},
"downloads": -1,
"filename": "ape_alchemy-0.8.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "109faf4de4918deb7fde41eb96e715b6",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4,>=3.9",
"size": 11811,
"upload_time": "2024-05-31T22:32:53",
"upload_time_iso_8601": "2024-05-31T22:32:53.240821Z",
"url": "https://files.pythonhosted.org/packages/a3/6b/b9c99aaf29b2e1515d4d5c43f502de926e51671c9979148b48432a23355d/ape_alchemy-0.8.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "93cc601b0e966c1211b79742a1d79e9dc8c193faa84b2aa489a5bdb737e9fa48",
"md5": "0343969bcf8b3770b5540aa5b1249abd",
"sha256": "478602518a876af4b820e8eda444159bcdd48a65dc31058215edb5118ae35868"
},
"downloads": -1,
"filename": "ape-alchemy-0.8.0.tar.gz",
"has_sig": false,
"md5_digest": "0343969bcf8b3770b5540aa5b1249abd",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4,>=3.9",
"size": 62810,
"upload_time": "2024-05-31T22:32:54",
"upload_time_iso_8601": "2024-05-31T22:32:54.538814Z",
"url": "https://files.pythonhosted.org/packages/93/cc/601b0e966c1211b79742a1d79e9dc8c193faa84b2aa489a5bdb737e9fa48/ape-alchemy-0.8.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-05-31 22:32:54",
"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"
}