cardano::stake_pool::RegistrationCertificateManager class

Manage creation and serialization of node registration certificates.

Constructors, destructors, conversion operators

RegistrationCertificateManager(cardano::shelley::PoolRegistration cert) explicit
Construct a manager object from a registration certificate.
RegistrationCertificateManager(const ColdVerificationKey& vkey, const VrfVerificationKey& vrf_vkey, uint64_t pledge_lovelace, uint64_t cost_lovelace, double margin, const RewardsAddress& reward_account)
Construct a new registration certificate.

Public functions

void addOwner(const RewardsAddress& stake_addr)
Add a stake pool owner to the certificate.
void addRelay(std::string_view dns_name)
Add a multi-host-name relay to the certificate.
void addRelay(std::string_view dns_name, uint16_t port)
Add a single-host-name relay to the certificate.
void addRelay(std::array<uint8_t, 4> ip, uint16_t port)
Add a single-host-address relay to the certificate.
void addRelay(std::array<uint8_t, 16> ip, uint16_t port)
Add a single-host-address relay to the certificate.
auto certificate() const →  const cardano::shelley::PoolRegistration&
Provide a constant reference to the certificate struct.
void saveToFile(std::string_view fpath) const
Export the certifiate to a file in the text envelope format.
auto serialize() const →  std::vector<uint8_t>
Serialize the certificate to CBOR.
void setCost(uint64_t cost_lovelace)
Set the stake pool cost.
void setMargin(double margin)
Set the stake pool margin.
void setMetadata(std::string_view metadata_url, std::span<const uint8_t> hash)
Add a metadata URL to the certificate.
void setOperator(const ColdVerificationKey& vkey)
Set the stake pool operator ID.
void setOperator(const std::array<uint8_t, STAKE_POOL_ID_SIZE>& poolId)
Set the stake pool operator ID.
void setPledge(uint64_t pledge_lovelace)
Set the stake pool pledge.
void setRewardAccount(const RewardsAddress& reward_account)
Set the stake pool reward account.
void setVrfKey(const VrfVerificationKey& vrf_vkey)
Set the pool VRF key.

Function documentation

cardano::stake_pool::RegistrationCertificateManager::RegistrationCertificateManager(cardano::shelley::PoolRegistration cert) explicit

Construct a manager object from a registration certificate.

Parameters
cert The retirement certificate struct.

cardano::stake_pool::RegistrationCertificateManager::RegistrationCertificateManager(const ColdVerificationKey& vkey, const VrfVerificationKey& vrf_vkey, uint64_t pledge_lovelace, uint64_t cost_lovelace, double margin, const RewardsAddress& reward_account)

Construct a new registration certificate.

Parameters
vkey The verification key of the pool.
vrf_vkey The VRF verification key of the pool.
pledge_lovelace The pledge amount in Lovelace.
cost_lovelace The cost (fixed fee) per epoch in Lovelace.
margin The margin (decimal unit interval) cost per epoch.
reward_account The pool reward account address.

void cardano::stake_pool::RegistrationCertificateManager::addOwner(const RewardsAddress& stake_addr)

Add a stake pool owner to the certificate.

Parameters
stake_addr The stake pool owner stake address.

void cardano::stake_pool::RegistrationCertificateManager::addRelay(std::string_view dns_name)

Add a multi-host-name relay to the certificate.

Parameters
dns_name The DNS name of the relay.

void cardano::stake_pool::RegistrationCertificateManager::addRelay(std::string_view dns_name, uint16_t port)

Add a single-host-name relay to the certificate.

Parameters
dns_name The DNS name of the relay.
port The port of the relay.

void cardano::stake_pool::RegistrationCertificateManager::addRelay(std::array<uint8_t, 4> ip, uint16_t port)

Add a single-host-address relay to the certificate.

Parameters
ip The IPV4 address of the relay.
port The relay port.

void cardano::stake_pool::RegistrationCertificateManager::addRelay(std::array<uint8_t, 16> ip, uint16_t port)

Add a single-host-address relay to the certificate.

Parameters
ip The IPV6 address of the relay.
port The relay port.

const cardano::shelley::PoolRegistration& cardano::stake_pool::RegistrationCertificateManager::certificate() const

Provide a constant reference to the certificate struct.

Returns A constant reference to the internal certificate struct.

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

Export the certifiate to a file in the text envelope format.

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

std::vector<uint8_t> cardano::stake_pool::RegistrationCertificateManager::serialize() const

Serialize the certificate to CBOR.

Returns The CBOR byte string as a byte vector.

void cardano::stake_pool::RegistrationCertificateManager::setCost(uint64_t cost_lovelace)

Set the stake pool cost.

Parameters
cost_lovelace The cost (fixed fee) per epoch in Lovelace.

void cardano::stake_pool::RegistrationCertificateManager::setMargin(double margin)

Set the stake pool margin.

Parameters
margin The margin (decimal unit interval) cost per epoch.

void cardano::stake_pool::RegistrationCertificateManager::setMetadata(std::string_view metadata_url, std::span<const uint8_t> hash)

Add a metadata URL to the certificate.

Parameters
metadata_url The metadata file URL.
hash The metadata file hash.

void cardano::stake_pool::RegistrationCertificateManager::setOperator(const ColdVerificationKey& vkey)

Set the stake pool operator ID.

Parameters
vkey The verification key of the pool.

void cardano::stake_pool::RegistrationCertificateManager::setOperator(const std::array<uint8_t, STAKE_POOL_ID_SIZE>& poolId)

Set the stake pool operator ID.

Parameters
poolId The stake pool ID calculated from the Vkey hash.

void cardano::stake_pool::RegistrationCertificateManager::setPledge(uint64_t pledge_lovelace)

Set the stake pool pledge.

Parameters
pledge_lovelace The pledge amount in Lovelace.

void cardano::stake_pool::RegistrationCertificateManager::setRewardAccount(const RewardsAddress& reward_account)

Set the stake pool reward account.

Parameters
reward_account The pool reward account address.

void cardano::stake_pool::RegistrationCertificateManager::setVrfKey(const VrfVerificationKey& vrf_vkey)

Set the pool VRF key.

Parameters
vrf_vkey The stake pool VRF verification key.