Skip to content

Commit

Permalink
docs: Chainstack implementation update (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
soos3d authored Aug 4, 2022
1 parent 8a33aff commit 615860b
Show file tree
Hide file tree
Showing 3 changed files with 121 additions and 9 deletions.
127 changes: 120 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,81 @@
# Ape Chainstack Plugin

Chainstack Provider plugins for networks
Chainstack network provider plugins.

## Dependencies
This plugin allows using the Ape framework with Chainstack as a node provider in an easy and integrated way.

* [python3](https://www.python.org/downloads) version 3.7.2 or greater, python3-dev
Ape is an innovative smart contract development and testing framework.
It is inspired by Brownie, and it has essentially the same syntax.
Still, Ape focuses on a more modular approach, allowing us to build and use external plugins to add functionality.

## Table of contents

- [Ape Chainstack Plugin](#ape-chainstack-plugin)
- [Requirements](#requirements)
- [Dependencies](#dependencies)
- [Installation](#installation)
- [Virtual environment](#virtual-environment)
- [Install ape-chainstack via `pip`](#install-ape-chainstack-via-pip)
- [Install ape-chainstack via `setuptools`](#install-ape-chainstack-via-setuptools)
- [Quick Usage](#quick-usage)
- [Development](#development)
- [License](#license)

## Requirements

- Linux or macOS
- Windows Subsystem Linux ([WSL](https://docs.microsoft.com/en-us/windows/wsl/install)) if operating on windows.

### Dependencies

- [python3](https://www.python.org/downloads) version 3.7.2 or greater
- python3-dev

- MacOS. Should already have the [correct headers if Python is installed with `brew`](https://stackoverflow.com/questions/32578106/how-to-install-python-devel-in-mac-os)

- Linux. Install python3-dev with:

```sh
sudo apt-get install python3-dev
```

> **Note:** Always check the [Ape docs to find the updated requirements](https://docs.apeworx.io/ape/stable/userguides/quickstart.html#prerequisite).
## Installation

### via `pip`
Verify the Python version installed:

```sh
Python3 --version
```

### Virtual environment

It is recommended to operate in a virtual environment; you will need to [install Ape](https://github.com/ApeWorX/ape#installation) in the virtual environment if you decide to use one.

Create a virtual environment.

```sh
python3 -m venv /path/to/new/environment
```

> Keep in mind that you can place the virtual environment where you prefer.
Then activate it.

```sh
source /bin/activate
```

### Install ape-chainstack via `pip`

You can install the latest release via [`pip`](https://pypi.org/project/pip/):

```bash
pip install ape-chainstack
```

### via `setuptools`
### Install ape-chainstack via `setuptools`

You can clone the repository and use [`setuptools`](https://github.com/pypa/setuptools) for the most up-to-date version:

Expand All @@ -26,14 +85,68 @@ cd ape-chainstack
python3 setup.py install
```

Verify that the Chainstack plugin was installed correctly with this command:

```bash
ape plugins list
```

It will show a list of all the plugins installed, and Chainstack will be there.

```bash
Installed Plugins:
chainstack <current version number>
```

## Quick Usage

Use in most commands using the `--network` option:
Follow these steps to sign up on Chainstack, deploy a node, and find your endpoint credentials:

1. [Sign up with Chainstack](https://console.chainstack.com/user/account/create).
1. [Deploy a node](https://docs.chainstack.com/platform/join-a-public-network).
1. [View node access and credentials](https://docs.chainstack.com/platform/view-node-access-and-credentials).

> **Note:** At this moment only the Ethereum network is supported.
Create an environment variable with your Chainstack node URL in this format `CHAINSTACK_"NETWORK"_URL=ENDPOINT_URL`; for example:

```sh
export CHAINSTACK_GOERLI_URL=https://nd-11X-26X-16X.p2pify.com/YOUR_API_KEY
```

Use the command `ape networks list` to see the networks available:

```sh
ethereum (default)
├── mainnet
│ ├── geth (default)
│ └── chainstack
├── ropsten
│ ├── geth (default)
│ └── chainstack
├── kovan
│ └── geth (default)
├── rinkeby
│ ├── geth (default)
│ └── chainstack
├── goerli
│ ├── geth (default)
│ └── chainstack
└── local (default)
├── geth
└── test (default)
```

Use the `--network` command to access the console using your node; for example:

```bash
ape console --network ethereum:ropsten:chainstack
ape console --network ethereum:goerli:chainstack
```

Check the Ape docs to see [how to select a network](https://docs.apeworx.io/ape/stable/userguides/networks.html).

Now you are ready to use Ape to develop and test your smart contract, checkout the [Ape Academy](https://academy.apeworx.io/) for tutorials.

## Development

This project is in development and should be considered a beta.
Expand Down
1 change: 0 additions & 1 deletion ape_chainstack/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"mainnet",
"ropsten",
"rinkeby",
"kovan",
"goerli",
]

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
long_description_content_type="text/markdown",
author="ApeWorX Ltd.",
author_email="admin@apeworx.io",
url="https://github.com/ApeWorX/<REPO_NAME>",
url="https://github.com/ApeWorX/ape-chainstack",
include_package_data=True,
install_requires=[
"eth-ape>=0.4.0,<0.5.0",
Expand Down

0 comments on commit 615860b

Please sign in to comment.