{"id":19107558,"url":"https://github.com/smartcontractkit/apeworx-starter-kit","last_synced_at":"2025-08-20T19:12:05.680Z","repository":{"id":51817861,"uuid":"520635860","full_name":"smartcontractkit/apeworx-starter-kit","owner":"smartcontractkit","description":"A repo dedicated to showing how to make smart contracts in a purely pythonic environment ","archived":false,"fork":false,"pushed_at":"2023-02-12T07:25:21.000Z","size":124,"stargazers_count":76,"open_issues_count":3,"forks_count":12,"subscribers_count":9,"default_branch":"main","last_synced_at":"2023-08-04T16:38:19.015Z","etag":null,"topics":["chainlink","ethereum","python","smartcontracts","vyper"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smartcontractkit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-02T20:09:38.000Z","updated_at":"2023-07-07T15:40:09.000Z","dependencies_parsed_at":"2023-01-24T20:16:13.497Z","dependency_job_id":null,"html_url":"https://github.com/smartcontractkit/apeworx-starter-kit","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fapeworx-starter-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fapeworx-starter-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fapeworx-starter-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smartcontractkit%2Fapeworx-starter-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smartcontractkit","download_url":"https://codeload.github.com/smartcontractkit/apeworx-starter-kit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223783059,"owners_count":17201915,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chainlink","ethereum","python","smartcontracts","vyper"],"created_at":"2024-11-09T04:13:01.780Z","updated_at":"2024-11-09T04:13:02.256Z","avatar_url":"https://github.com/smartcontractkit.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"_Note: This repo has been recently updated to use Sepolia._\n\n# Apeworx (Vyper) Starter Kit\n\n\u003cbr/\u003e\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://chain.link\" target=\"_blank\"\u003e\n\u003cimg src=\"./img/apeworx-chainlink.png\" width=\"225\" alt=\"Chainlink Apeworx logo\"\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\u003cbr/\u003e\n\nThis is a repo to work with and use Chainlink smart contracts in a python, [apeworx](https://www.apeworx.io/) \u0026 [vyper](https://vyper.readthedocs.io/en/stable/index.html) environment. If you're brand new to Chainlink, check out the beginner walk-through in remix to [learn the basics.](https://docs.chain.link/docs/beginners-tutorial)\n\nIt shows how to use these frameworks and languages as well as the following Chainlink features:\n\n- [Chainlink Price Feeds](https://docs.chain.link/docs/using-chainlink-reference-contracts)\n- [Chainlink VRF](https://docs.chain.link/docs/chainlink-vrf)\n- [Chainlink Keepers](https://docs.chain.link/docs/chainlink-keepers/introduction/)\n\n# Table of Contents\n\n- [Apeworx (Vyper) Starter Kit](#apeworx-vyper-starter-kit)\n- [Table of Contents](#table-of-contents)\n- [Getting Started](#getting-started)\n  - [Requirements](#requirements)\n  - [Quickstart](#quickstart)\n- [Usage](#usage)\n  - [Deploying Contracts](#deploying-contracts)\n    - [Price Feed Consumer](#price-feed-consumer)\n    - [Keepers Consumer](#keepers-consumer)\n    - [VRFv2 Consumer](#vrfv2-consumer)\n  - [Deploying to Local, Adhoc, Mainnet, and Testnets](#deploying-to-local-adhoc-mainnet-and-testnets)\n    - [Importing an account](#importing-an-account)\n    - [Deploy to a local or adhoc network](#deploy-to-a-local-or-adhoc-network)\n    - [Deploy to a mainnet or test network](#deploy-to-a-mainnet-or-test-network)\n    - [Interacting with Contracts](#interacting-with-contracts)\n      - [Price Feed Consumer](#price-feed-consumer-1)\n      - [VRF Consumer](#vrf-consumer)\n      - [Keeper Consumer](#keeper-consumer)\n- [Miscellaneous](#miscellaneous)\n  - [Contributing](#contributing)\n  - [Resources](#resources)\n\n# Getting Started\n\nIt's recommended that you've gone through the [apeworx getting started documentation](https://docs.apeworx.io/ape/stable/userguides/quickstart.html) before proceeding here.\n\n## Requirements\n\n- [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n  - You'll know you did it right if you can run `git --version` and you see a response like `git version x.x.x`\n- [Python](https://www.python.org/downloads/)\n  - You'll know you've installed python right if you can run:\n    - `python --version` or `python3 --version` and get an output like: `Python x.x.x`\n- [pipx](https://pypa.github.io/pipx/installation/)\n  - `pipx` is different from [pip](https://pypi.org/project/pip/)\n  - You may have to close and re-open your terminal\n  - You'll know you've installed it right if you can run:\n    - `pipx --version` and see something like `x.x.x.x`\n- [eth-ape (ape)](https://docs.apeworx.io/ape/stable/userguides/quickstart.html#installation)\n  - We recommend using `pipx` but you can [follow the ape documentation](https://docs.apeworx.io/ape/stable/userguides/quickstart.html#installation) for other installation methods.\n  - You'll know you've done it right if you run `ape --version` and see an output like `x.x.x`\n\n## Quickstart\n\n1. Clone repo and install dependencies\n\n```bash\ngit clone https://github.com/smartcontractkit/apeworx-starter-kit\ncd apeworx-starter-kit\nape plugins install alchemy vyper\n```\n\n2. You're ready to go!\n\nRun tests:\n\n```\nape test\n```\n\n# Usage\n\nIf you run `ape --help` you'll get an output of all the tasks you can run.\n\n## Deploying Contracts\n\nThe following will deploy your contracts to a temporary ape test network. Additionally, if on a local network, it will deploy mock Chainlink contracts for you to interact with. If you'd like to interact with your deployed contracts, skip down to [Interacting with Deployed Contracts](#interacting-with-deployed-contracts).\n\nAfter your script completes, the network deletes itself.\n\n### Price Feed Consumer\n\n```\nape run scripts/deploy_price_feed_consumer.py\n```\n\n### Keepers Consumer\n\n```\nape run scripts/deploy_keepers_consumer.py\n```\n\n### VRFv2 Consumer\n\n```\nape run scripts/deploy_vrf_consumer.py\n```\n\n## Deploying to Local, Adhoc, Mainnet, and Testnets\n\nIn order to deploy to a local, adhoc, mainnet, or testnet, you'll need to first create accounts. For the scripts we currently have, it'll default to the \"default\" account. If you'd like to have the scripts point to a different account, go to `helper_functions.py` and change the `get_account` function to look for your account instead of `default.\n\nApe doesn't support `.env` files or keeping your private keys in plaintext, which means it's harder for you to release your private key to the world!\n\n### Importing an account\n\nTo import an account into ape, run the following:\n\n```\nape accounts import default\n```\n\nWhere `default` will be the name of your account. Ape will then prompt you for your private key and password, and encrypt it on your computer. The only way to use this key moving forward will be to decrypt the key with your password.\n\n### Deploy to a local or adhoc network\n\nApe doesn't come with a built-in local network like hardhat or ganache, so we will have to use our own. Ape also prefers users to build plugins for working additional networks, [you can find a list of the plugins on their github.](https://github.com/ApeWorX?q=ape-\u0026type=all\u0026language=\u0026sort=)\n\nWe recommend using [Foundry's Anvil](https://book.getfoundry.sh/anvil/) as your local network.\n\n1. Install Foundry / Anvil\n\nYou'll know you did it right if you can run `anvil --version` and get an output like `anvil 0.1.0 (f016135 2022-07-04T00:15:02.655418Z)`\n\n2. Start up anvil\n\nRun:\n\n```\nanvil\n```\n\nYou'll see an output with many private keys.\n\nIf you'd like to use this as your main \"default\" account, run the following:\n\n```\nape accounts delete default\n```\n\nAnd then, re-import your private key from anvil by following [the importing an account guide](#importing-an-account)\n\n3. Run your script\n\n\u003e Note: This will only work since the chain Id is `31337` for anvil! For working with non-local networks, please see [Deploy to a mainnet or testnet](#deploy-to-a-main-or-test-network)\n\n```\nape run scripts/deploy_price_feed_consumer.py --network http://127.0.0.1:8545\n```\n\nYou'll be prompted for your password.\n\n### Deploy to a mainnet or test network\n\n1. Import an account\n\nPlease see [import an account](#importing-an-account). And be sure your account has plenty of testnet or mainnet tokens if working on live network. See [this faucet](https://faucets.chain.link/) for testnet tokens.\n\n2.  Set your RPC_URL\n\nSince we are working with Alchemy, create an [environment variable](https://www.twilio.com/blog/2017/01/how-to-set-environment-variables.html) called `WEB3_ALCHEMY_PROJECT_ID` or `WEB3_ALCHEMY_API_KEY`. If using a linux or mac environment, you can set it by running:\n\n```\nexport WEB3_ALCHEMY_PROJECT_ID=MY_API_TOKEN\n```\n\n\u003e Note: At this time, it's really tricky to change networks with Ape. If you want to use another network ape doesn't have a plugin for, you can use an adhoc network as shown above.\n\n3. Update your `helper_config.py`\n\nIf you're using a network not covered in `helper_config.py` be sure to add it.\n\n4. Run your script!\n\n```\nape run scripts/deploy_price_feed_consumer.py --network ethereum:sepolia:alchemy\n```\n\n### Interacting with Contracts\n\nTo interact with contracts, we recommend using the console.\n\n```\nape console --network ethereum:sepolia:alchemy\n```\n\nOr, you can follow along and run the scripts to see the end-to-end functionality.\n\n#### Price Feed Consumer\n\n1. Deploy the contract\n\n```\nape run scripts/deploy_price_feed_consumer.py --network ethereum:sepolia:alchemy\n```\n\n2. Read it\n\n```\nape run scripts/read_price_feed.py --network ethereum:sepolia:alchemy\n```\n\n#### VRF Consumer\n\n1. Create a subscription and fund it with LINK.\n\nYou can do that with the script, or by going to the UI at [vrf.chain.link](https://vrf.chain.link)\n\n```\nape run scripts/create_subscription.py --network ethereum:sepolia:alchemy\n```\n\n2. Update your `helper_config.py` with your subscription Id.\n\n3. Deploy vrf consumer\n\n```\nape run scripts/deploy_vrf_consumer.py --network ethereum:sepolia:alchemy\n```\n\n4. [Add your contract/consumer to the VRF UI](https://docs.chain.link/docs/get-a-random-number/#create-and-fund-a-subscription)\n\n5. Request a random number and wait for a response\n\n```\nape run scripts/request_and_read_randomness.py --network ethereum:sepolia:alchemy\n```\n\n#### Keeper Consumer\n\n1. Deploy the contract\n\n```\nape run scripts/deploy_keepers_consumer.py --network ethereum:sepolia:alchemy\n```\n\n2. Register your upkeep on the Keepers UI\n\nYou can go to [keepers.chain.link](https://keepers.chain.link/new-custom-logic)\n\n3. Watch for your counter to automatically start going up!\n\nAfter a delay, run:\n\n```\nape run scripts/read_counter.py --network ethereum:sepolia:alchemy\n```\n\nAnd it should be updated!\n\n# Miscellaneous\n\n1. Testing and forking are a bit tricky at the moment.\n\n## Contributing\n\nContributions are always welcome! Open a PR or an issue!\n\nThank You!\n\n## Resources\n\n- [Chainlink Documentation](https://docs.chain.link/)\n- [Ape Documentation](https://docs.apeworx.io/ape/stable/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Fapeworx-starter-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmartcontractkit%2Fapeworx-starter-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmartcontractkit%2Fapeworx-starter-kit/lists"}