This project contains an example program for Solana Transfer Hook Token Extension that makes a CPI into Feed Protocol RNG.
The Feed Protocol Program is a random number generating on-chain program. The program uses on-chain derived data to generate a random number and provide it to the client. Tranfer Hook Token Extension allows to apply a custom program at every token transaction. Making a CPI into Feed Protocol Program in a Transfer Hook Program provides user a random number that can be used in the same transaction. This way user can create a random number generator embedded token. In this program how to get random number is shown. However, the uses cases are left to developers who would like to create an rng embedded token.
-
Install Rust: https://rustup.rs/
-
Install Solana CLI: https://docs.solanalabs.com/cli/install
-
Clone This Repository
git clone https://github.com/MintLabsDev/rng-hook-example.git
-
Install Dependencies
cd rng-hook-example cargo add npm install -
Build And Deploy The Program: Ensure you have enough Sol and configured clusters
cargo build-bpf solana program deploy target/deploy/rng-hook-example.so
-
Look at https://solana.com/developers to see how to create token and use transfer hook extension