DocsOn-chain contract
Encodings and message format
Nebula VRF is strict about encodings.
- Commitment: 32 bytes (
sha256(seed || salt)) - Pubkey: BLS12-381 G1, 96 bytes, uncompressed
- Signature: BLS12-381 G2, 192 bytes, uncompressed
- DST:
NEBULA-VRF-V01-BLS12381G2
Commitment code
Rust:
use sha2::{Digest, Sha256};
fn commitment(seed: &[u8], salt: &[u8]) -> [u8; 32] {
let mut hasher = Sha256::new();
hasher.update(seed);
hasher.update(salt);
hasher.finalize().into()
}Python:
import hashlib
def commitment(seed: bytes, salt: bytes) -> bytes:
return hashlib.sha256(seed + salt).digest()