# Oracle (Native) This program will store the price of some asset in an account owned by this program. Only an authorized account will be able to update the price. Complete all tasks below - Implement an oracle program - Test locally with LiteSVM - Deploy locally to `solana-test-validator` and test with Rust script # Task 1 - Implement [`instructions::init`](https://github.com/Cyfrin/solana-course/blob/main/apps/oracle/native/exercise/src/instructions/init.rs) - Check that `oracle_account` is not initialized - Store the `owner` and `price` into `oracle_account` - Call `instructions::init` inside `lib.rs` # Task 2 - Implement [`instructions::update`](https://github.com/Cyfrin/solana-course/blob/main/apps/oracle/native/exercise/src/instructions/update.rs) - Check that the `oracle.owner` signed this instruction to update the price - Update the price - Call `instructions::update` inside `lib.rs` # Build ```shell cargo build-sbf ``` # Test ```shell cargo test -- --nocapture ``` # Test with script Run local validator ```shell solana config set -ul solana-test-validator ``` Deploy program ```shell solana program deploy ./target/deploy/oracle.so ``` Execute demo script ```shell PROGRAM_ID=your program ID RPC=http://localhost:8899 KEYPAIR=path to key pair cargo run --example demo $KEYPAIR $RPC $PROGRAM_ID ```
This program will store the price of some asset in an account owned by this program.
Only an authorized account will be able to update the price.
Complete all tasks below
Implement an oracle program
Test locally with LiteSVM
Deploy locally to solana-test-validator and test with Rust script
instructions::initCheck that oracle_account is not initialized
Store the owner and price into oracle_account
Call instructions::init inside lib.rs
instructions::updateCheck that the oracle.owner signed this instruction to update the price
Update the price
Call instructions::update inside lib.rs
Run local validator
Deploy program
Execute demo script
A robust guide to Oracle (Native) - Build a decentralized price feed utilizing native Rust to enforce signer authorization for state updates. Master the end-to-end development process, from implementing instruction logic and testing with LiteSVM to deploying and interacting with your program on a local validator.
Previous lesson
Previous
Next lesson
Next
Course Overview
About the course
Native Rust & Anchor framework
PDAs, CPIs, and SPL Tokens
DeFi builds: oracles, auctions, AMMs
Last updated on January 12, 2026
Rust Developer
SolanaDuration: 8min
Duration: 23min
Duration: 4min
Duration: 2min
Duration: 4min
Duration: 11min
Duration: 4min
Duration: 0min
Duration: 0min
Course Overview
About the course
Native Rust & Anchor framework
PDAs, CPIs, and SPL Tokens
DeFi builds: oracles, auctions, AMMs
Last updated on January 12, 2026