cardano::stake_pool::ColdSigningKey class

A stake pool signing key (Ed25519 signing key).

This class wraps a standard Ed25519 signing key. It is included for compatibility with legacy keys and is completely valid for use as a stake pool key. However, users are encouraged to use the extended key version for new keys, which implements CIP-1853 for pool key derivation.

Public static functions

static auto generate() →  ColdSigningKey

Public functions

auto asBech32() const →  std::string
Serialize the key bytes as a Bech32 string.
auto bytes() const →  const ed25519::KeyByteArray& constexpr
Return the key as a byte vector.
auto extend() const →  ExtendedColdSigningKey
Convert to an extended Ed25519 key version.
auto poolId() →  std::array< uint8_t, STAKE_POOL_ID_SIZE > -> auto
Generate the pool ID as an array of bytes.
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 signing key.
auto verificationKey() const →  ColdVerificationKey
Derive the corresponding verification (public) key.

Function documentation

static ColdSigningKey cardano::stake_pool::ColdSigningKey::generate()

Factory method to create a new Ed25519 private key from a cryptographically secure random number generator.

std::string cardano::stake_pool::ColdSigningKey::asBech32() const

Serialize the key bytes as a Bech32 string.

Returns String representing the formatted key.

ExtendedColdSigningKey cardano::stake_pool::ColdSigningKey::extend() const

Convert to an extended Ed25519 key version.

Returns An StakePoolExtendedSigningKey object.

auto cardano::stake_pool::ColdSigningKey::poolId() →  std::array< uint8_t, STAKE_POOL_ID_SIZE >

Generate the pool ID as an array of bytes.

Returns Pool ID as an array of bytes.

void cardano::stake_pool::ColdSigningKey::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.

auto cardano::stake_pool::ColdSigningKey::sign(std::span<const uint8_t> msg) const →  std::array< uint8_t, ed25519::SIGNATURE_SIZE >

Generate a message signature from the signing key.

Parameters
msg A span of bytes (uint8_t) representing the message to sign.

ColdVerificationKey cardano::stake_pool::ColdSigningKey::verificationKey() const

Derive the corresponding verification (public) key.

Returns The verification key object.