Native On-chain randomness
A step-by-step tutorial of how to use Secret Network's randomness API to generate a coin flip
Import Secret VRF
[dependencies]
cosmwasm-std = { package = "secret-cosmwasm-std", version = "1.1.10" }
cosmwasm-storage = { package = "secret-cosmwasm-storage", version = "1.1.10" }
secret-toolkit-storage = "0.10.1"Tutorial - Coin Flip
Contract.rs
use cosmwasm_std::{Binary, Env, MessageInfo, Response, Result};#[entry_point]
pub fn execute(
deps: DepsMut,
env: Env,
_info: MessageInfo,
msg: ExecuteMsg,
) -> Result<Response, ContractError> {
match msg {
ExecuteMsg::Flip {} => try_flip(deps, env),
}
}Accessing the Env struct
Interacting with the Coin Flip Contract
Compile
Upload and Instantiate randomness contract
Execute
Summary
Last updated
Was this helpful?