smartcontractkit/chainlink-mix hiện có 516 sao trên GitHub, viết chủ yếu bằng Solidity. Working with smart contracts with eth-brownie, python, and Chainlink.
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
⚠️⚠️⚠️
This repo uses the eth-brownie development toolkit which is no longer maintained by its creators.
Therefore this repo is not maintained actively either.
we recommend you check out the Chainlink starter kits to find other repos that you can use to
get started quickly. We recommend the use of the Hardhat or Foundry starter kits for most use cases.
chainlink-mix
NOTE: The new default is Sepolia.
NOTE: This has been recently updated for better compatibility with local blockchains. Check out the scripts to learn more.
This is a repo to work with and use Chainlink smart contracts in a python environment. If you're brand new to Chainlink, check out the beginner walk-through in remix to learn the basics.
You can also check out the more advanced Chainlink tutorials there as well.
chainlink-mix
Prerequisites
Installation
Testnet Development
Local Development
Running Scripts and Deployment
Chainlink Price Feeds
Chainlink VRF
Chainlink API Call
Chainlink Automation Deployment
Local Development
Testing
To test development / local
To test mainnet-fork
To test a testnet
Adding additional Chains
Linting
Resources
License
Prerequisites
Please install or have installed the following:
nodejs and npm
python
Installation
Install Brownie, if you haven't already. Here is a simple way to install brownie.
brownie bake chainlink-mix
cd chainlink-mix
pip install -r requirements.txt
This will open up a new Chainlink project. Or, you can clone from source:
git clone https://github.com/PatrickAlphaC/chainlink-mix
cd chainlink-mix
Testnet Development
If you want to be able to deploy to testnets, do the following.
Set your WEB3_INFURA_PROJECT_ID, and PRIVATE_KEY environment variables.
You can get a WEB3_INFURA_PROJECT_ID by getting a free trial of Infura. At the moment, it does need to be infura with brownie. If you get lost, you can follow this guide to getting a project key. You can find your PRIVATE_KEY from your ethereum wallet like metamask.
You'll also need testnet ETH and LINK. You can get LINK and ETH into your wallet by using the faucets located here. If you're new to this, watch this video.. Look at the sepolia section for those specific testnet faucets.
You can add your environment variables to a .env file. You can use the .env.example as a template, just fill in the values and rename it to '.env'. Then, uncomment the line # dotenv: .env in brownie-config.yaml
And update the brownie config accordingly. There is a deploy_mocks script that will launch and deploy mock Oracles, VRFCoordinators, Link Tokens, and Price Feeds on a Local Blockchain.
Running Scripts and Deployment
This mix provides a simple template for working with Chainlink Smart Contracts. The easiest way to start is to fork the mainnet chain to a local ganache chain. This will allow you to deploy local smart contracts to interact with the Chainlink Price Feeds.
NOTE: It's highly encouraged that you work with a local chain before testing on a testnet. You'll be a much faster developer!
If Sepolia network is not added to brownie by default, run:
This will deploy a smart contract to Sepolia and then read you the latest price via Chainlink Price Feeds.
brownie run scripts/price_feed_scripts/01_deploy_price_consumer_v3.py --network sepolia
brownie run scripts/price_feed_scripts/02_read_price_feed.py --network sepolia
Or, you can use ENS
brownie run scripts/price_feed_scripts/02_read_price_feed_with_ens.py --network sepolia
Otherwise, you can fork mainnet and use that in a local ganache development environment.
You can also use ENS to get prices. See the ens price feed script for more information.
Chainlink VRF
This will deploy a smart contract to Sepolia and get a Random number via Chainlink VRF.
If you haven't created and funded a subscription on vrf.chain.link you can do so on the UI, or by running:
brownie run scripts/vrf_scripts/create_subscription.py --network sepolia
Before running the next scripts. Running 01_deploy_vrf will also add your consumer contract to the registry.
brownie run scripts/vrf_scripts/01_deploy_vrf_consumer.py --network sepolia
brownie run scripts/vrf_scripts/02_request_randomness.py --network sepolia
brownie run scripts/vrf_scripts/03_read_random_number.py --network sepolia
Chainlink API Call
This will deploy a smart contract to Sepolia and then make an API call via Chainlink API Call.
brownie run scripts/chainlink_api_scripts/01_deploy_api_consumer.py --network sepolia
brownie run scripts/chainlink_api_scripts/02_request_api.py --network sepolia
brownie run scripts/chainlink_api_scripts/03_read_data.py --network sepolia
Chainlink Automation Deployment
This is just to show you how to deploy the Automation Compatible contracts, you can learn more about registering & using them in the Automate Contracts section of the Chainlink documentation.
brownie run scripts/automation_scripts/01_deploy_automation_counter.py --network sepolia
brownie run scripts/automation_scripts/02_check_upkeep.py --network sepolia
Local Development
For local development, you might want to deploy mocks. You can run the script to deploy mocks. Depending on your setup, it might make sense to not deploy mocks if you're looking to fork a mainnet. It all depends on what you're looking to do though. Right now, the scripts automatically deploy a mock so they can run.
Testing
brownie test
For more information on effective testing with Chainlink, check out Testing Smart Contracts
Tests are really robust here! They work for local development and testnets. There are a few key differences between the testnets and the local networks. We utilize mocks so we can work with fake oracles on our testnets.
There is a test_unnecessary folder, which is a good exercise for learning some of the nitty-gritty of smart contract development. It's overkill, so pytest will skip them intentionally. It also has a test_samples folder, which shows an example Chainlink API call transaction receipt.
To test development / local
brownie test
To test mainnet-fork
This will test the same way as local testing, but you will need a connection to a mainnet blockchain (like with the infura environment variable.)
brownie test --network mainnet-fork
To test a testnet
Sepolia is currently supported. Please check the Chainlink docs for which products are supported on which chains.
brownie test --network sepolia
Adding additional Chains
If the blockchain is EVM Compatible, adding new chains can be accomplished by something like:
pip install black
pip install autoflake
autoflake --in-place --remove-unused-variables --remove-all-unused-imports -r .
black .
If you're using vscode and the solidity extension, you can create a folder called .vscode at the root folder of this project, and create a file called settings.json, and add the following content:
Check out the Chainlink documentation to get started from any level of smart contract engineering.
Check out the other Brownie mixes that can be used as a starting point for your own contracts. They also provide example code to help you get started.
"Getting Started with Brownie" is a good tutorial to help you familiarize yourself with Brownie.
For more in-depth information, read the Brownie documentation.
Any questions? Join our Discord
License
This project is licensed under the MIT license.
Disclaimer: Please note, this repo contains community examples only — these are not Chainlink products or services and are not supported or maintained by Chainlink. This code represents an example of using a Chainlink product or service, and is intended for demonstration and educational purposes only. It is provided “AS IS” and “AS AVAILABLE” without warranties of any kind, may not have been audited, and may omit checks or error handling. Each party intending to use this example code does so entirely at their own risk and must perform its own audits, security and code review, key management, and testing before any production deployment and ensure the operation and performance of such code matches expectations. Neither Chainlink Labs nor the Chainlink Foundation deploys, operates, monitors, maintains or endorses any deployment of this code. Note that this is not a Chainlink product, feature or service, and there are no commitments made with respect to the code, including compatibility with future Chainlink releases. You should not rely on this code without first conducting your own technical, engineering, and security review. This code is also outside the scope of any Chainlink bug bounty programs. Neither Chainlink Labs, the Chainlink Foundation, nor Chainlink node operators are responsible for outcomes due to errors in this example or how it is deployed or operated, or liable for any resulting claims or damages. Use of the Chainlink Network is subject to the Chainlink Foundation Terms of Service, which provides important information and disclosures. By using this code, you acknowledge and agree to these terms.
smartcontractkit/chainlink-mix thuộc nhóm Backend trên TopGit, cùng 7 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về smartcontractkit/chainlink-mix ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/smartcontractkit/chainlink-mix là nguồn chính thức.
smartcontractkit/chainlink-mix có phải mã nguồn mở không?
TopGit chưa ghi nhận license cho smartcontractkit/chainlink-mix. Phần lớn repo public trên GitHub là mã nguồn mở, nhưng điều khoản khác nhau từng repo — mở file LICENSE để xác nhận.
smartcontractkit/chainlink-mix có trang demo không?
Dự án có trang chủ ở https://chain.link/. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
smartcontractkit/chainlink-mix là gì?
smartcontractkit/chainlink-mix (smartcontractkit/chainlink-mix) là dự án Solidity trên GitHub. Theo mô tả gốc: Working with smart contracts with eth-brownie, python, and Chainlink.
Vì sao smartcontractkit/chainlink-mix được xếp vào nhóm Backend?
TopGit xếp smartcontractkit/chainlink-mix vào nhóm Backend dựa trên GitHub topics và mô tả của repo (gắn thẻ: "brownie", "chainlink", "eth-brownie"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
chainlink-mix có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về chainlink-mix.