cardano::stake_pool::VrfSigningKey class

A VRF signing key used by stake pools to verify leadership selection.

Base classes

class cardano::VRFSecretKey
Represents a VRF secret key.

Public static functions

static auto fromSeed(std::span<const uint8_t, VRF_SEED_SIZE> seed) →  VRFSecretKey
static auto generate() →  VrfSigningKey
static auto proofToHash(std::span<const uint8_t, VRF_PROOF_SIZE> proof) →  std::array< uint8_t, VRF_PROOF_HASH_SIZE > -> auto
Convert a VRF proof to a VRF hash.

Constructors, destructors, conversion operators

VrfSigningKey(std::span<const uint8_t, VRF_SECRET_KEY_SIZE> key_bytes) explicit
Construct a new VrfSigningKey object from a byte vector.

Public functions

auto bytes() const →  const VRFKeyByteArray& constexpr
Return a constant reference to the private key secure byte array.
auto constructProof(std::span<const uint8_t> msg) →  std::array< uint8_t, VRF_PROOF_SIZE > -> auto
Construct a VRF proof from an initial message.
auto hash(std::span<const uint8_t> msg) →  std::array< uint8_t, VRF_PROOF_HASH_SIZE > -> auto
Compute the VRF hash of a message.
auto isValid() const →  bool
Ensure the key is a valid ed25519 key.
auto publicKey() const →  VRFPublicKey
Derive the public key paired with this private key.
void saveToFile(std::string_view fpath) const
Export the key to a file in the cardano node JSON format.
auto sign(std::span<const uint8_t> msg) const →  std::array< uint8_t, ed25519::SIGNATURE_SIZE > -> auto
Generate a message signature from the private key.
auto verificationKey() const →  VrfVerificationKey
Derive the corresponding verification (public) key.
auto verifyProof(std::span<const uint8_t> msg, std::span<const uint8_t, VRF_PROOF_SIZE> proof) const →  bool
Verify a VRF proof from the associated secret key.

Function documentation

static VrfSigningKey cardano::stake_pool::VrfSigningKey::generate()

Factory method to create a new VRF signing key from a cryptographically secure random number generator.

cardano::stake_pool::VrfSigningKey::VrfSigningKey(std::span<const uint8_t, VRF_SECRET_KEY_SIZE> key_bytes) explicit

Construct a new VrfSigningKey object from a byte vector.

Parameters
key_bytes The byte vector containing the key.

void cardano::stake_pool::VrfSigningKey::saveToFile(std::string_view fpath) const

Export the key to a file in the cardano node JSON format.

Parameters
fpath Path to the file to be (over)written.

VrfVerificationKey cardano::stake_pool::VrfSigningKey::verificationKey() const

Derive the corresponding verification (public) key.

Returns The verification key object.