Skip to content

SDK for verifiable randomness function (VRF / RNG) on Solana

License

Notifications You must be signed in to change notification settings

4x13/solana-vrf

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

How to setup (Ubuntu 20x)

We should have the following stuff:

  • solana-cli 1.16.0 (src:e0fcdbb0; feat:2891131721, client:SolanaLabs)
  • rustc 1.70.0 (90c541806 2023-05-31)
  • anchor-cli 0.28.0

We should install:

  • Solana's Install Tool
    sh -c "$(curl -sSfL https://release.solana.com/v1.16.0/install)"

  • anchor install
    cargo install --git https://github.com/coral-xyz/anchor --tag v0.28.0 anchor-cli --locked

  • rustc 1.70.0 (90c541806 2023-05-31)
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh

Deploy

git clone https://github.com/CryptoElitesClub/solana-vrf && cd solana-vrf/rust/examples/cpi/
anchor build or cargo-build-sbf
anchor keys list - that will show us an address, that we need to change in the code for

We should change the result address in some files, such as:

programs/russian-roulette/src/lib.rs:declare_id!("2tqa84LLK7E3hUWbQ9AoAUJMjmHEb26je4xjzEeRuBF8");
Anchor.toml:russian_roulette = "2tqa84LLK7E3hUWbQ9AoAUJMjmHEb26je4xjzEeRuBF8"

when is done, we deploy by anchor deploy

Deploying cluster: https://api.devnet.solana.com
Upgrade authority: /root/.config/solana/id.json
Deploying program "russian_roulette"...
Program path: /root/lottery/lottery_contract/rust/examples/cpi/target/deploy/russian_roulette.so...
Program Id: 2tqa84LLK7E3hUWbQ9AoAUJMjmHEb26je4xjzEeRuBF8

caveat we need change Program Id in the backend!

Cost in devnet

I spent near to 2-4 SOL to be able to deploy the contract.

About

SDK for verifiable randomness function (VRF / RNG) on Solana

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 55.1%
  • Rust 44.9%