PyChain 2022 Conference : Speaker Notes

written by
Chris Cao
Date Last Updated
November 14, 2022
Download Project Files

Introduction to ApeWorX smart contract development framework

PyChain

This article provides a more comprehensive, in-depth overview of the PyChain talk. I will go over the topics in a more extended discussion so you can understand the depth of what

Ape Framework is all about.

Overview

  • Lil bit about me
  • Mission Statement
  • Features of Ape
  • Ape Academy

Lil about me

Hi, my name is Chris Cao, and I am one of the developers at ApeWorX. I grew up in Los Angeles and am classically trained in Computer Science. I joined the Web3 space this year, and I have been documenting my learning process. I have enjoyed asking questions and translating my process and feedback into learning material for everyone. 

@Ninjgod1251

P.S. As I travel, I always find chaos whenever I fly. Find me and ask me to regale some unbelievable stories.

Mission Statement

Ape Framework is an easy-to-use, beginner-friendly Web3 development tool. Users can compile, test, and interact with smart contracts all in one command line session. Ape supports multiple contract languages and chains, including non-EVM chains such as StarkNet. 

Link to Documentation

It’s not a bug. It’s a feature.

One of the best parts about Ape Framework is that we have a modular plugin system to say yes to almost every feature request. 

Link to Github

Plugins

Take a look at all of these plugins. Each of these plugins has README’s, so you can understand how they are used and look into the code directly to see how it is made. We have provider, compiler, and utility plugins. If a plugin has not been created, talk to us, and we can help you out 

Link to Ape-Plugins Github

We have a plugin template that will help you make your own.“If it doesn’t exist, you can simply build it.”

Link to Plugin Template

MultiChain Integration

The modular system cultivates an ecosystem with multi-chain integration within one project to rule them all. You can hot-swap and connect to multiple chains to test your contract or dApps.

In this code snippet, you can see that we start in a fixture that connects starknet:local and then we swap to ethereum:local 

The setup of the fixture begins the test in the starknet local 

And then, at the beginning of the definition test_multichain_in_the_same_test we change the context to a new resource using the with keyword

The new provider resource allows us to use a different chain

With our pythonic suite of tools, we have a way to analyze on-chain data. A use case might be to query the on-chain data with the contract and then, with matplotlib, convert the data to a graph to provide meaningful value. In one terminal, one project, and one session. You have one framework to rule them all.

Use Case: Query

A use case might be that you can consume data to visualize it in a graph. We have an interactive console to query a node on a blockchain, so consuming on-chain data is easy.

Use Case: Smart Contract

We make it easy to have the same workflow. The same workflow for us means having all your relevant work in the same place. Our project hierarchy shows you where to place your files and builds them accordingly. 

For example, we have Contracts, Scripts, and Test as separate folders and then our ape-config.yaml outside. Your Vyper and solidity contracts should be placed in the same folder, and these should be together and placed in the same contract folder, making it easier to follow. You don’t have to worry about making different calls to compile them; the correct compiler will match the proper contracts.

Script

The script folder allows you to interact with your project as you see fit. Management actions are made readable and doable here. You create deployment scripts, oracle scripts, keeper, and continuous action scripts. If you do not know what I mean by these names, you can come and say hello in our community, and we would be happy to help.

Ape Academy

All of our examples and tutorials are on our education platform. We have guides for any level of user. For all users, you can install and set up your environment properly with Ape, and then the world is yours.

We have a roadmap from 0 to Hero for people who know nothing about Web3 and something about Python. 

We have templates for users who are comfortable with Ape and want to build on us. 

The entire framework and documentation are yours to play with for advanced users. If something is missing or needs improvement, let us know, and we will work with you to find the best solution.

Thank you for listening

Stream Chris' workshop here