• Stars
    star
    855
  • Rank 53,320 (Top 2 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

The smart contract development tool for Pythonistas, Data Scientists, and Security Professionals

Overview

Ape Framework is an easy-to-use Web3 development tool. Users can compile, test, and interact with smart contracts all in one command line session. With our modular plugin system, Ape supports multiple contract languages and chains.

Ape is built by ApeWorX LTD.

Join our ApeWorX Discord server to stay up to date on new releases, plugins and tutorials.

If you want to just get started, jump down to the Playing with Ape.

Documentation

Read our technical documentation to get a deeper understanding of our open source Framework.

Read our academic platform will help you master Ape Framework with tutorials and challenges.

Prerequisite

In the latest release, Ape requires:

  • Linux or macOS
  • Python 3.8 up to 3.11
  • Windows: Install Windows Subsystem Linux (WSL)

Check your python version in a terminal with python3 --version.

Installation

There are three ways to install ape: pipx, pip, or Docker.

Considerations for Installing:

  • If using pip, we advise using the most up-to-date version of pip to increase the chance of a successful installation.

    • See issue #1558.
    • To upgrade pip from the command line, run: pip install --upgrade pip.
  • We advise installing in a virtualenv or venv to avoid interfering with OS-level site packages.

  • We advise installing ape with recommended plugins pip install eth-ape'[recommended-plugins]'.

  • We advise for macOS users to install virtual env via homebrew.

via pipx or pip

  1. Install pipx via their installation instructions or pip via their installation instructions.

  2. Install ape via pipx install eth-ape or pip install eth-ape.

via docker

Ape can also run in a docker container.

Please visit our Dockerhub for more details on using Ape with Docker.

docker run \
--volume $HOME/.ape:/home/harambe/.ape \
--volume $HOME/.vvm:/home/harambe/.vvm \
--volume $HOME/.solcx:/home/harambe/.solcx \
--volume $PWD:/home/harambe/project \
apeworx/ape compile

Playing with Ape

After you installed Ape, you can run ape --version to make sure it works and is the latest version.

There are two ways to interact with Ape:

Ape is both a CLI tool and a Python SDK.

The CLI tool contains all the Ape commands and the Python SDK contains the classes and types needed to compose scripts, console actions, and tests.

Ape Modular Plugin System:

Our list of plugins is the best way to have the most interoperable experience with Web3.

NOTE: If a plugin does not originate from the ApeWorX GitHub Organization, you will get a warning about installing 3rd-party plugins.

Install 3rd party plugins at your own risk.

Additionally, plugins that come bundled with ape in the core installation cannot be removed and are part of the ape core software.

Accounts

In Ape, you will need accounts to make transactions. You can import or generate accounts using the core accounts plugin:

ape accounts import acc0   # Will prompt for a private key
ape accounts generate acc1

List all your accounts with the list command.

ape accounts list

Learn more about accounts in Ape by following the accounts guide.

Plugins

Add any plugins you may need, such as vyper.

ape plugins list -a
ape plugins install vyper
ape plugins list -a

Projects

When using Ape, you generally will work with a project.

Learn more about smart-contract projects from this projects guide.

Compiling

You can compile contracts within the contracts/ directory of your project. The --size option will display you the size of the contract.

ape compile --size

Learn more about compiling in Ape by following the compile guide.

Testing

Use Ape to test your smart-contract projects. Provide the same arguments to pytest as you would to the ape test command.

For example:

ape test -k test_only_one_thing

Visit the testing guide to learn more about testing using Ape.

Console

Ape provides an IPython interactive console with useful pre-defined locals to interact with your project. To interact with a deployed contract in a local environment, start by opening the console:

ape console --network ethereum:mainnet:infura

Visit Ape Console to learn how to use Ape Console.

Scripts

If you want to run specific files in a scripts/ directory, you can do it using the ape run command.

# This command will run a file named deploy in the scripts/ directory
$ ape run deploy

Learn more about scripting using Ape by following the scripting guide.

Logging

To enable debug logging, run your command with the --verbosity flag using DEBUG as the value:

ape --verbosity DEBUG run

Networks

You can work with registered networks, providers, and blockchain ecosystems (like Ethereum):

from ape import networks
with networks.ethereum.mainnet.use_provider("infura"):
    ...  # Work with the infura provider here

To learn more about networks in Ape, see this guide.

More Repositories

1

evm-trace

Ethereum Virtual Machine transaction tracing tool
Python
298
star
2

py-solc-x

Python wrapper and version management tool for the solc Solidity compiler.
Python
138
star
3

silverback

Blockchain automation library, and SDK for the (upcoming) Silverback Platform
Python
79
star
4

eip712

Message classes for typed structured data hashing and signing in Ethereum
Python
41
star
5

ape-foundry

Foundry network provider for the Ape Framework
Python
32
star
6

py-tokenlists

Uniswap Token Lists implementation in Python.
Python
32
star
7

ape-vyper

Vyper compiler plugin for the Ape Framework, using VVM
Python
26
star
8

ape-etherscan

Etherscan explorer plugin using EVM-based networks for the Ape Framework
Python
23
star
9

evm-asm

EVM Opcodes, Assembler, and Disassembler
Python
23
star
10

project-template

Plugin project template for the Ape Framework
Python
23
star
11

ape-alchemy

Alchemy network provider plugin for the Ape Framework
Python
19
star
12

ape-hardhat

Hardhat network provider for the Ape Framework
Python
18
star
13

ApePay

A smart contract payment system built for automated service management
TypeScript
18
star
14

archive-ape-starknet

StarkNet ecosystem plugin for the Ape Framework
Python
18
star
15

ape-notebook

Launch a Jupyter Notebook using the Ape Framework
Python
17
star
16

ape-solidity

Solidity compiler plugin for the Ape Framework
Python
15
star
17

ethpm-types

Implementation of EIP-2678
Python
14
star
18

ape-safe

Safe (Wallet) account plugin for the Ape Framework
Python
13
star
19

ape-template

Plugin for working with Cookiecutter-based project templates
Python
11
star
20

ape-arbitrum

Arbitrum ecosystem plugin for the Ape Framework
Python
9
star
21

ape-optimism

Optimism network provider plugin for the Ape Framework
Python
9
star
22

ape-tokens

Tokens converter plugin for the Ape Framework
Python
9
star
23

ape-infura

Infura network provider plugin for the Ape Framework
Python
8
star
24

archive-ape-cairo

Cairo programming language compiler plugin for the Ape Framework
Python
8
star
25

uniswap-sdk

Ape SDK for Uniswap v2 & v3
Python
7
star
26

ape-addressbook

Address converter plugin: tracking addresses and contracts in projects globally
Python
7
star
27

ape-ledger

Ledger Nano S and X account plugin for the Ape Framework
Python
6
star
28

github-action

GitHub Actions CI File for Ape Projects
6
star
29

walletconnect-py

WalletConnect implementation in Python
Python
5
star
30

ape-polygon

Polygon ecosystem plugin for the Ape Framework
Python
5
star
31

ape-ganache

Ganache network provider plugin for the Ape Framework
Python
4
star
32

ape-frame

Frame (https://frame.sh) account plugin for the Ape Framework
Python
4
star
33

ape-trezor

Trezor Hardware Wallet account plugin for the Ape Framework
Python
4
star
34

ape-fantom

Fantom ecosystem plugin for the Ape Framework
Python
4
star
35

hosted-compiler

Compiler tool supporting Remix Online IDE
Python
4
star
36

ape-flashbots

Web3 Flashbots network provider plugin for the Ape Framework
Python
3
star
37

ape-chainstack

Chainstack network provider plugin for the Ape Framework
Python
3
star
38

faucet

Self-hosted faucet web app for public and private testnets
Python
3
star
39

ape-titanoboa

Titanoboa integration and pytest runner (experimental)
Python
3
star
40

ape-tenderly

Tenderly network provider plugin for the Ape Framework
Python
3
star
41

taskiq-sqs

SQS Broker for TaskIQ
Python
3
star
42

apegenius

Telegram bot that answers questions by sourcing answers from docs and codebases
JavaScript
3
star
43

eth-pydantic-types

ETH Pydantic types
Python
3
star
44

apeworx.github.io

Docs Homepage
JavaScript
2
star
45

bridge_prototype

Example project for using a network bridge in Ape
Python
2
star
46

ape-ens

Ethereum Name Service (ENS) converter plugin for the Ape Framework
Python
2
star
47

ape-cairo

Rust
2
star
48

simple-nft

Vyper
2
star
49

ape-polygon-zkevm

Polygon-ZkEVM ecosystem plugin for the Ape Framework
Python
2
star
50

ape-aws

Plugin to interact with AWS for transactions on the Ethereum Blockchain
Python
2
star
51

node-utils

Python
1
star
52

Flask-WalletConnect

Flask plugin that allows integrating with a user's wallet over WalletConnect
Python
1
star
53

ape-base

Base ecosystem plugin for the Ape Framework
Python
1
star
54

evmchains

Provides general metadata on EVM-compatible chains organized by Ape-style ecosystem and network.
Python
1
star
55

ape-bsc

Binance Smart Chain (BSC) Ecosystem Plugin
Python
1
star
56

SafeDrop

A convenient way to disburse whitehat funds
1
star