36 "Returns the key used to sign avalanche messages.\n",
64 auto localProof =
avalanche.getLocalProof();
65 if (localProof && localProof->getId() == proof->getId()) {
70 return pm.getProof(proof->getId()) ||
pm.registerProof(proof, state);
88 if (!
dg.verify(state,
auth)) {
90 "The delegation is invalid: " + state.
ToString());
102 if (
node.avalanche) {
105 stakeUtxoDustThreshold =
pm.getStakeUtxoDustThreshold();
115 "The proof is invalid: " + state.
ToString());
123 "Add a node in the set of peers to poll for avalanche.\n",
126 "Node to be added to avalanche."},
128 "The public key of the node."},
130 "Proof that the node is not a sybil."},
132 "The proof delegation the the node public key"},
135 "Whether the addition succeeded or not."},
137 HelpExampleRpc(
"addavalanchenode",
"5, \"<pubkey>\", \"<proof>\"")},
150 if (key != proof->getMaster()) {
151 if (request.params.size() < 4 || request.params[3].isNull()) {
154 "The public key does not match the proof");
161 if (
dg.getProofId() != proofid) {
164 "The delegation does not match the proof");
170 "The public key does not match the delegation");
176 "The proof has conflicting utxos");
180 LOCK(pnode->cs_avalanche_pubkey);
181 bool expected = false;
182 if (pnode->m_avalanche_enabled.compare_exchange_strong(
184 pnode->m_avalanche_pubkey = std::move(key);
190 strprintf(
"The node does not exist: %d", nodeid));
194 if (!
pm.addNode(nodeid, proofid)) {
198 pm.addUnbroadcastProof(proofid);
207 "buildavalancheproof",
208 "Build a proof for avalanche's sybil resistance.\n",
211 "The proof's sequence"},
213 "A timestamp indicating when the proof expire"},
215 "The master private key in base58-encoding"},
220 "The stakes to be signed and associated private keys",
226 "A stake to be attached to this proof",
231 "The output number"},
235 "The height at which this UTXO was mined"},
238 "Indicate wether the UTXO is a coinbase"},
241 "private key in base58-encoding"},
250 "A string that is a serialized, hex-encoded proof data."},
252 "0 1234567800 \"<master>\" []")},
259 if (!masterKey.IsValid()) {
264 request.params[4].get_str(), config.GetChainParams());
268 "Invalid payout address");
275 for (
size_t i = 0; i < stakes.
size(); i++) {
292 "vout cannot be negative");
298 "height must be positive");
304 if (!stake.
exists(
"amount")) {
319 "Invalid private key");
331 return proof->ToHex();
338 "decodeavalancheproof",
339 "Convert a serialized, hex-encoded proof, into JSON object. "
340 "The validity of the proof is not verified.\n",
343 "The proof hex string"},
351 "The proof's sequential number"},
353 "A timestamp indicating when the proof expires"},
356 "The proof signature (base64 encoded)"},
359 "The proof payout script",
363 "Raw payout script in hex format"},
367 "The required signatures"},
376 "A hash of the proof data excluding the master key."},
378 "A hash of the limitedid and master key."},
380 "The total staked amount of this proof in " +
392 "The transaction id"},
395 "The amount in this UTXO"},
397 "The height at which this UTXO was mined"},
399 "Indicate whether the UTXO is a coinbase"},
401 "This UTXO's public key"},
403 "Signature of the proofid with this UTXO's private "
404 "key (base64 encoded)"},
439 const COutPoint &utxo = s.getStake().getUTXO();
443 stake.
pushKV(
"amount", s.getStake().getAmount());
445 stake.
pushKV(
"iscoinbase", s.getStake().isCoinbase());
446 stake.
pushKV(
"pubkey",
HexStr(s.getStake().getPubkey()));
454 result.
pushKV(
"stakes", stakes);
463 "delegateavalancheproof",
464 "Delegate the avalanche proof to another public key.\n",
467 "The limited id of the proof to be delegated."},
469 "The private key in base58-encoding. Must match the proof master "
470 "public key or the upper level parent delegation public key if "
473 "The public key to delegate the proof to."},
475 "A string that is the serialized, hex-encoded delegation for the "
476 "proof and which is a parent for the delegation to build."},
479 "A string that is a serialized, hex-encoded delegation."},
482 "\"<limitedproofid>\" \"<privkey>\" \"<pubkey>\"")},
486 ParseHashV(request.params[0],
"limitedproofid")};
491 "The private key is invalid");
496 std::unique_ptr<avalanche::DelegationBuilder>
dgb;
497 if (request.params.size() >= 4 && !request.params[3].isNull()) {
502 if (
dg.getProofId() !=
503 limitedProofId.computeProofId(
dg.getProofMaster())) {
506 "The delegation does not match the proof");
512 "The private key does not match the delegation");
515 dgb = std::make_unique<avalanche::DelegationBuilder>(
dg);
517 dgb = std::make_unique<avalanche::DelegationBuilder>(
518 limitedProofId,
privkey.GetPubKey());
523 "Unable to build the delegation");
535 "decodeavalanchedelegation",
536 "Convert a serialized, hex-encoded avalanche proof delegation, into "
538 "The validity of the delegation is not verified.\n",
541 "The delegation hex string"},
549 "The public key the proof is delegated to."},
551 "The delegated proof master public key."},
553 "The identifier of this delegation."},
555 "A delegated proof data hash excluding the master key."},
557 "A hash of the delegated proof limitedid and master key."},
559 "The number of delegation levels."},
569 "The index of this delegation level."},
571 "This delegated public key for this level"},
573 "Signature of this delegation level (base64 "
579 "\"<hex delegation>\"") +
581 "\"<hex delegation>\"")},
587 delegation, request.params[0].get_str(),
error)) {
595 result.
pushKV(
"limitedid",
603 for (
auto &
level : levels) {
619 "Returns an object containing various state info regarding avalanche "
628 "Whether the node is ready to start polling and voting."},
631 "Only available if -avaproof has been supplied to the node",
634 "Whether the node local proof has been locally verified "
637 "The proof verification status. Only available if the "
638 "\"verified\" flag is false."},
640 "The node local proof id."},
642 "The node local limited proof id."},
644 "The node local proof master public key."},
646 "The node local proof payout address. This might be "
647 "omitted if the payout script is not one of P2PK, P2PKH "
648 "or P2SH, in which case decodeavalancheproof can be used "
649 "to get more details."},
651 "The node local proof staked amount."},
658 "The number of valid avalanche proofs we know exist "
659 "(including this node's local proof if applicable)."},
661 "The number of avalanche proofs with at least one node "
662 "we are connected to (including this node's local proof "
665 "The number of avalanche proofs with no node attached."},
667 "The number of known avalanche proofs that have been "
668 "finalized by avalanche."},
670 "The number of known avalanche proofs that conflict with "
673 "The number of known avalanche proofs that have immature "
676 "The total staked amount over all the valid proofs in " +
678 " (including this node's local proof if "
681 "The total staked amount over all the connected proofs "
684 " (including this node's local proof if "
687 "The total staked amount over all the dangling proofs "
690 " (including this node's local proof if "
693 "The total staked amount over all the immature proofs "
696 " (including this node's local proof if "
699 "The number of avalanche nodes we are connected to "
700 "(including this node if a local proof is set)."},
702 "The number of avalanche nodes associated with an "
703 "avalanche proof (including this node if a local proof "
706 "The number of avalanche nodes pending for a proof."},
718 ret.pushKV(
"ready_to_poll",
avalanche.isQuorumEstablished());
720 auto localProof =
avalanche.getLocalProof();
721 if (localProof !=
nullptr) {
726 return pm.isBoundToPeer(proofid);
732 avalanche.getLocalProofRegistrationState();
735 local.pushKV(
"verification_status",
737 ? (
sharing ?
"pending verification"
738 :
"pending inbound connections")
741 local.pushKV(
"proofid", localProof->getId().ToString());
742 local.pushKV(
"limited_proofid",
743 localProof->getLimitedId().ToString());
744 local.pushKV(
"master",
HexStr(localProof->getMaster()));
748 local.pushKV(
"payout_address",
751 local.pushKV(
"stake_amount", localProof->getStakedAmount());
770 peer.
proof->getId() == localProof->getId();
790 pm.getImmatureProofPool().forEachProof(
797 network.
pushKV(
"dangling_proof_count",
802 "conflicting_proof_count",
803 uint64_t(
pm.getConflictingProofPool().countProofs()));
805 "immature_proof_count",
806 uint64_t(
pm.getImmatureProofPool().countProofs()));
810 network.
pushKV(
"dangling_stake_amount",
814 const uint64_t pendingNodes =
pm.getPendingNodeCount();
817 network.
pushKV(
"pending_node_count", pendingNodes);
819 ret.pushKV(
"network", network);
829 "getavalanchepeerinfo",
830 "Returns data about an avalanche peer as a json array of objects. If "
831 "no proofid is provided, returns data about all the peers.\n",
834 "The hex encoded avalanche proof identifier."},
846 "The avalanche internal peer identifier"},
848 "The agreggated availability score of this peer's nodes"},
850 "The avalanche proof id used by this peer"},
852 "The avalanche proof used by this peer"},
854 "The number of nodes for this peer"},
860 "Node id, as returned by getpeerinfo"},
878 obj.pushKV(
"avalanche_peerid",
uint64_t(peer.peerid));
879 obj.pushKV(
"availability_score", peer.availabilityScore);
880 obj.pushKV(
"proofid", peer.getProofId().ToString());
881 obj.pushKV(
"proof", peer.proof->ToHex());
888 obj.pushKV(
"nodecount",
uint64_t(peer.node_count));
889 obj.pushKV(
"node_list", nodes);
898 if (!request.params[0].isNull()) {
899 const avalanche::ProofId proofid =
900 avalanche::ProofId::fromHex(
901 request.params[0].get_str());
902 if (!pm.isBoundToPeer(proofid)) {
903 throw JSONRPCError(RPC_INVALID_PARAMETER,
904 "Proofid not found");
908 ret.push_back(peerToUniv(pm, peer));
928 "getavalancheproofs",
929 "Returns an object containing all tracked proofids.\n",
941 "Avalanche proof id"},
948 "Avalanche proof id"},
955 "Avalanche proof id"},
969 const std::string &key) {
973 arrOut.push_back(proofid.ToString());
991 "Return a list of possible staking reward winners based on the "
996 "The previous block hash, hex encoded."},
998 "Whether to recompute the staking reward winner if there is a "
1008 "The winning proof",
1011 "The winning proofid"},
1014 "Raw payout script in hex format"},
1018 "The required signatures"},
1050 config.GetChainParams().GetConsensus(), pprev)) {
1054 "Staking rewards are not activated for block %s\n",
1058 if (!request.params[1].isNull() && request.params[1].get_bool()) {
1061 avalanche.eraseStakingRewardWinner(blockhash);
1064 if (!
avalanche.computeStakingReward(pprev)) {
1067 strprintf(
"Unable to determine a staking reward winner "
1072 std::vector<std::pair<avalanche::ProofId, CScript>> winners;
1073 if (!
avalanche.getStakingRewardWinners(blockhash, winners)) {
1076 strprintf(
"Unable to retrieve the staking reward winner "
1082 for (
auto &
winner : winners) {
1098 "Set the staking reward winner for the given previous block hash.\n",
1101 "The previous block hash, hex encoded."},
1103 "The payout script for the staking reward, hex encoded."},
1105 "Append to the list of possible winners instead of replacing."},
1108 "Whether the payout script was set or not"},
1110 HelpExampleRpc(
"setstakingreward",
"<blockhash> <payout script>")},
1133 config.GetChainParams().GetConsensus(), pprev)) {
1137 "Staking rewards are not activated for block %s\n",
1141 const std::vector<uint8_t> data =
1142 ParseHex(request.params[1].get_str());
1145 std::vector<CScript> payoutScripts;
1147 if (!request.params[2].isNull() && request.params[2].get_bool()) {
1151 avalanche.getStakingRewardWinners(blockhash, payoutScripts);
1154 if (std::find(payoutScripts.begin(), payoutScripts.end(),
1159 "Staking rewards winner is already set for block %s\n",
1168 avalanche.setStakingRewardWinners(pprev, payoutScripts);
1177 "Get the list of remote proofs for the given node id.\n",
1180 "The node identifier."},
1192 "The hex encoded proof identifier."},
1194 "Whether the node has the proof."},
1196 "The last time this proof status was updated."},
1207 auto remoteProofs =
avalanche.withPeerManager(
1209 return pm.getRemoteProofs(nodeid);
1230 "getrawavalancheproof",
1231 "Lookup for a known avalanche proof by id.\n",
1234 "The hex encoded avalanche proof identifier."},
1242 "The hex encoded proof matching the identifier."},
1244 "Whether the proof has immature utxos."},
1246 "Whether the proof is bound to an avalanche peer."},
1248 "Whether the proof has a conflicting UTXO with an avalanche "
1251 "Whether the proof is finalized by vote."},
1263 bool isImmature =
false;
1264 bool isBoundToPeer =
false;
1269 isImmature =
pm.isImmature(proofid);
1270 isBoundToPeer =
pm.isBoundToPeer(proofid);
1274 return p.hasFinalized;
1276 return pm.getProof(proofid);
1288 ret.pushKV(
"immature", isImmature);
1289 ret.pushKV(
"boundToPeer", isBoundToPeer);
1300 "invalidateavalancheproof",
1301 "Reject a known avalanche proof by id.\n",
1304 "The hex encoded avalanche proof identifier."},
1321 if (!
pm.exists(proofid) && !
pm.isDangling(proofid)) {
1322 throw JSONRPCError(RPC_INVALID_PARAMETER,
1326 if (!
pm.rejectProof(
1329 throw JSONRPCError(RPC_INTERNAL_ERROR,
1330 "Failed to reject the proof");
1333 pm.setInvalid(proofid);
1336 if (
avalanche.isRecentlyFinalized(proofid)) {
1352 "Check if a block has been finalized by avalanche votes.\n",
1355 "The hash of the block."},
1358 "Whether the block has been finalized by avalanche votes."},
1368 "Avalanche is not ready to poll yet.");
1394 "isfinaltransaction",
1395 "Check if a transaction has been finalized by avalanche votes.\n",
1398 "The id of the transaction."},
1400 "The block in which to look for the transaction"},
1404 "Whether the transaction has been finalized by avalanche votes."},
1417 if (!request.params[1].isNull()) {
1440 "Avalanche is not ready to poll yet.");
1447 return !pindex->nStatus.hasData())) {
1449 "Block data not downloaded yet.");
1451 errmsg =
"No such transaction found in the provided block.";
1453 errmsg =
"No such transaction. Use -txindex or provide a "
1454 "block hash to enable blockchain transaction "
1457 errmsg =
"No such transaction. Blockchain transactions are "
1458 "still in the process of being indexed.";
1460 errmsg =
"No such mempool or blockchain transaction.";
1481 return !
node.mempool->exists(txid) &&
1490 "reconsideravalancheproof",
1491 "Reconsider a known avalanche proof.\n",
1494 "The hex encoded avalanche proof."},
1499 "Whether the proof has been successfully registered.",
1518 if (
pm.isInvalid(proof->getId())) {
1519 pm.clearAllInvalid();
1536 return pm.isBoundToPeer(proof->getId());
1544 "sendavalancheproof",
1545 "Broadcast an avalanche proof.\n",
1548 "The avalanche proof to broadcast."},
1551 "Whether the proof was sent successfully or not."},
1578 pm.addUnbroadcastProof(proofid);
1582 node.peerman->RelayProof(proofid);
1592 "verifyavalancheproof",
1593 "Verify an avalanche proof is valid and return the error otherwise.\n",
1596 "Proof to verify."},
1599 "Whether the proof is valid or not."},
1605 request.params[0].get_str());
1614 "verifyavalanchedelegation",
1615 "Verify an avalanche delegation is valid and return the error "
1619 "The avalanche proof delegation to verify."},
1622 "Whether the delegation is valid or not."},
1639 "Add or remove a proofid from the flaky list. This means that an "
1640 "additional staking reward winner will be accepted if this proof is "
1641 "the selected one.\n",
1644 "The avalanche proof id."},
1646 "Whether to add (true) or remove (false) the proof from the flaky "
1650 "Whether the addition/removal is successful."},
1658 const auto proofid =
1660 const bool addNotRemove = request.params[1].get_bool();
1665 return pm.setFlaky(proofid);
1667 return pm.unsetFlaky(proofid);
1674 return avalanche.computeStakingReward(pprev);
1684 "List the flaky proofs (set via setflakyproof).\n",
1696 "The hex encoded proof identifier."},
1698 "The proof stake amount, only present if the proof is "
1702 "The proof payout script, only present if the proof is "
1707 "Raw payout script in hex format"},
1711 "The required signatures"},
1736 const auto proof =
pm.getProof(proofid);
1739 proof->getStakedAmount());
1784 for (
const auto &
c : commands) {
1785 t.appendCommand(
c.name, &
c);
static RPCHelpMan buildavalancheproof()
static RPCHelpMan invalidateavalancheproof()
static RPCHelpMan delegateavalancheproof()
static RPCHelpMan getremoteproofs()
static RPCHelpMan decodeavalanchedelegation()
static RPCHelpMan sendavalancheproof()
static RPCHelpMan getavalancheproofs()
static void verifyDelegationOrThrow(avalanche::Delegation &dg, const std::string &dgHex, CPubKey &auth)
static RPCHelpMan getrawavalancheproof()
static void verifyProofOrThrow(const NodeContext &node, avalanche::Proof &proof, const std::string &proofHex)
void RegisterAvalancheRPCCommands(CRPCTable &t)
static RPCHelpMan getavalanchekey()
static RPCHelpMan addavalanchenode()
static CPubKey ParsePubKey(const UniValue ¶m)
static RPCHelpMan verifyavalanchedelegation()
static RPCHelpMan setflakyproof()
static RPCHelpMan setstakingreward()
static RPCHelpMan getflakyproofs()
static RPCHelpMan isfinalblock()
static RPCHelpMan reconsideravalancheproof()
static RPCHelpMan isfinaltransaction()
static RPCHelpMan getstakingreward()
static bool registerProofIfNeeded(const avalanche::Processor &avalanche, avalanche::ProofRef proof, avalanche::ProofRegistrationState &state)
static RPCHelpMan getavalanchepeerinfo()
static RPCHelpMan verifyavalancheproof()
static RPCHelpMan getavalancheinfo()
static RPCHelpMan decodeavalancheproof()
#define CHECK_NONFATAL(condition)
Identity function.
#define Assert(val)
Identity function.
The block chain is a tree shaped structure starting with the genesis block at the root,...
BlockHash GetBlockHash() const
Double ended buffer combining vector and stream-like interfaces.
An encapsulated secp256k1 private key.
bool IsValid() const
Check whether this private key is valid.
Information about a peer.
An outpoint - a combination of a transaction hash and an index n into its vout.
const TxId & GetTxId() const
An encapsulated public key.
static constexpr unsigned int COMPRESSED_SIZE
static constexpr unsigned int SIZE
secp256k1:
Serialized script, used inside transaction inputs and outputs.
CTxMemPool stores valid-according-to-the-current-best-chain transactions that may be included in the ...
bool isAvalancheFinalized(const TxId &txid) const
Provides an interface for creating and interacting with one or two chainstates: an IBD chainstate gen...
SnapshotCompletionResult MaybeCompleteSnapshotValidation(std::function< void(bilingual_str)> shutdown_fnc=[](bilingual_str msg) { AbortNode(msg.original, msg);}) EXCLUSIVE_LOCKS_REQUIRED(Chainstate & ActiveChainstate() const
Once the background validation chainstate has reached the height which is the base of the UTXO snapsh...
node::BlockManager m_blockman
A single BlockManager instance is shared across each constructed chainstate to avoid duplicating bloc...
static RCUPtr make(Args &&...args)
Construct a new object that is owned by the pointer.
void push_back(UniValue val)
const std::string & get_str() const
const UniValue & find_value(std::string_view key) const
const UniValue & get_array() const
bool exists(const std::string &key) const
void pushKV(std::string key, UniValue val)
std::string GetRejectReason() const
std::string GetDebugMessage() const
std::string ToString() const
ProofId getProofId() const
const std::vector< Level > & getLevels() const
static bool FromHex(Delegation &dg, const std::string &dgHex, bilingual_str &errorOut)
const CPubKey & getProofMaster() const
const DelegationId & getId() const
const CPubKey & getDelegatedPubkey() const
const LimitedProofId & getLimitedProofId() const
int64_t getExpirationTime() const
static bool FromHex(Proof &proof, const std::string &hexProof, bilingual_str &errorOut)
bool verify(const Amount &stakeUtxoDustThreshold, ProofValidationState &state) const
Amount getStakedAmount() const
const CPubKey & getMaster() const
uint64_t getSequence() const
const LimitedProofId & getLimitedId() const
const SchnorrSig & getSignature() const
const CScript & getPayoutScript() const
uint32_t getScore() const
const ProofId & getId() const
const std::vector< SignedStake > & getStakes() const
Map a proof to each utxo.
ProofIdSet getProofIds() const
std::string ToString() const
std::string GetHex() const
CBlockIndex * LookupBlockIndex(const BlockHash &hash) EXCLUSIVE_LOCKS_REQUIRED(cs_main)
void ScriptPubKeyToUniv(const CScript &scriptPubKey, UniValue &out, bool fIncludeHex)
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
std::string EncodeDestination(const CTxDestination &dest, const Config &config)
CTxDestination DecodeDestination(const std::string &addr, const CChainParams ¶ms)
CKey DecodeSecret(const std::string &str)
bool error(const char *fmt, const Args &...args)
static constexpr Amount PROOF_DUST_THRESHOLD
Minimum amount per utxo.
CTransactionRef GetTransaction(const CBlockIndex *const block_index, const CTxMemPool *const mempool, const TxId &txid, BlockHash &hashBlock, const BlockManager &blockman)
Return transaction with a given txid.
std::shared_ptr< const CTransaction > CTransactionRef
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
UniValue JSONRPCError(int code, const std::string &message)
@ RPC_MISC_ERROR
General application defined errors std::exception thrown in command handling.
@ RPC_INVALID_PARAMETER
Invalid, missing or duplicate parameter.
@ RPC_DESERIALIZATION_ERROR
Error parsing or validating structure in raw format.
@ RPC_INVALID_ADDRESS_OR_KEY
Invalid address or key.
std::string HelpExampleCli(const std::string &methodname, const std::string &args)
Amount AmountFromValue(const UniValue &value)
std::string HelpExampleRpc(const std::string &methodname, const std::string &args)
std::string GetAllOutputTypes()
CPubKey HexToPubKey(const std::string &hex_in)
uint256 ParseHashO(const UniValue &o, std::string strKey)
uint256 ParseHashV(const UniValue &v, std::string strName)
Utilities: convert hex-encoded values (throws error if not hex).
void RPCTypeCheckObj(const UniValue &o, const std::map< std::string, UniValueType > &typesExpected, bool fAllowNull, bool fStrict)
Check for expected keys/value types in an Object.
ChainstateManager & EnsureAnyChainman(const std::any &context)
NodeContext & EnsureAnyNodeContext(const std::any &context)
CTxMemPool & EnsureMemPool(const NodeContext &node)
ChainstateManager & EnsureChainman(const NodeContext &node)
avalanche::Processor & EnsureAvalanche(const NodeContext &node)
bool IsStakingRewardsActivated(const Consensus::Params ¶ms, const CBlockIndex *pprev)
bool ExtractDestination(const CScript &scriptPubKey, CTxDestination &addressRet)
Parse a standard scriptPubKey for the destination address.
bool IsValidDestination(const CTxDestination &dest)
Check whether a CTxDestination is a CNoDestination.
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
std::variant< CNoDestination, PKHash, ScriptHash > CTxDestination
A txout script template with a specific destination.
static constexpr Amount zero() noexcept
A BlockHash is a unqiue identifier for a block.
static const Currency & get()
@ STR_HEX
Special type that is a STR with only hex chars.
@ AMOUNT
Special type representing a floating point amount (can be either NUM or STR)
@ OMITTED
The arg is optional for one of two reasons:
@ STR_HEX
Special string with only hex chars.
@ STR_AMOUNT
Special string to represent a floating point amount.
A TxId is the identifier of a transaction.
static ProofId fromHex(const std::string &str)
NodeContext struct containing references to chain state and connection state.
#define WITH_LOCK(cs, code)
Run code while locking a mutex.
std::unique_ptr< TxIndex > g_txindex
The global transaction index, used in GetTransaction. May be null.
std::string HexStr(const Span< const uint8_t > s)
Convert a span of bytes to a lower-case hexadecimal string.
std::string EncodeBase64(Span< const uint8_t > input)
template std::vector< std::byte > ParseHex(std::string_view)
bool IsHex(std::string_view str)
Returns true if each character in str is a hex character, and has an even number of hex digits.
static const int PROTOCOL_VERSION
network protocol versioning