NEW

Chainlink Data Streams have officially launched on mainnet. Sign up for early access.

Back

Experiment with Data Feeds using Starknet Foundry and Starknet Devnet RS

This guide employs Starknet Devnet RS, a local Docker-based testnet environment for Starknet. It provides code examples and scripts that enable you to compile, declare, and deploy your own aggregator and consumer contracts. You can use a set of pre-funded accounts to interact with Chainlink Data Feeds on Starknet without deploying to a live network.

Requirements

Set up your environment

This guide uses the Starknet Foundry toolkit and the Scarb project management tool so you can compile, deploy, and interact with your Starknet smart contracts.

  • Starknet Foundry: Make sure you have Starknet Foundry v0.20.1 installed. You can check your current version by running snforge --version or sncast --version in your terminal and install the required version if necessary.

  • Scarb: Make sure you have Scarb v2.5.4 installed. You can check your current version by running scarb --version in your terminal and install the required version if necessary.

Alternatively, you can use the asdf tool version manager to install both Starknet Foundry and Scarb. Read the setup instructions for Starknet Foundry and Scarb for more information.

  • Docker: Make sure you have Docker Desktop installed. You will run Starknet Devnet RS in a Docker container.

Clone and configure the code examples repository

  1. Clone the chainlink-starknet repository, which includes the example contracts for this guide:

    git clone https://github.com/smartcontractkit/chainlink-starknet.git
    
  2. Navigate to the aggregator_consumer [LINK_TO_UPDATE] directory:

    cd chainlink-starknet/examples/contracts/aggregator_consumer/
    
  3. In the ~/chainlink-starknet/examples/contracts/aggregator_consumer/ directory, make sure the url property in your snfoundry.toml file points to the Docker container. For example:

    [sncast.default]
    url = "http://127.0.0.1:5050/rpc"
    

After you prepare the requirements, check to make sure the required tools are configured correctly by running the tests:

snforge test

The contracts should compile successfully and the tests should pass.

Tutorial

[TBC]

What's next

Stay updated on the latest Chainlink news