Using encrypted payloads for VRF
Install and import dependencies
npm install @solar-republic/cosmos-grpc @solar-republic/neutrino ethers secure-randomimport { ethers } from "ethers";
import { arrayify, hexlify, SigningKey, keccak256, recoverPublicKey, computeAddress } from "ethers/lib/utils";
import {ecdh, chacha20_poly1305_seal} from "@solar-republic/neutrino";
import {bytes, bytes_to_base64, json_to_bytes, sha256, concat, text_to_bytes, base64_to_bytes} from '@blake.regalia/belt';optimizeDeps: {
esbuildOptions: {
target: "esnext",
supported: {
bigint: true
},
}
}Defining variables
Initializing the Ethereum client
Generating the encryption key using ECDH
Define the Calldata for the secret contract & Callback information
Encrypting the Payload
Signing the Payload with Metamask
Estimate the Callback Gas
Packing the Transaction & Send
PreviousPerformance figures of SecretVRF vs competitorsNextConverting from Chainlink VRF to Secret VRF in four steps
Last updated
Was this helpful?