37 "Returns the key used to sign avalanche messages.\n",
65 auto localProof =
avalanche.getLocalProof();
66 if (localProof && localProof->getId() == proof->getId()) {
71 return pm.getProof(proof->getId()) ||
pm.registerProof(proof, state);
89 if (!
dg.verify(state,
auth)) {
91 "The delegation is invalid: " + state.
ToString());
103 if (
node.avalanche) {
106 stakeUtxoDustThreshold =
pm.getStakeUtxoDustThreshold();
116 "The proof is invalid: " + state.
ToString());
124 "Add a node in the set of peers to poll for avalanche.\n",
127 "Node to be added to avalanche."},
129 "The public key of the node."},
131 "Proof that the node is not a sybil."},
133 "The proof delegation the the node public key"},
136 "Whether the addition succeeded or not."},
138 HelpExampleRpc(
"addavalanchenode",
"5, \"<pubkey>\", \"<proof>\"")},
151 if (key != proof->getMaster()) {
152 if (request.params.size() < 4 || request.params[3].isNull()) {
155 "The public key does not match the proof");
162 if (
dg.getProofId() != proofid) {
165 "The delegation does not match the proof");
171 "The public key does not match the delegation");
177 "The proof has conflicting utxos");
181 LOCK(pnode->cs_avalanche_pubkey);
182 bool expected = false;
183 if (pnode->m_avalanche_enabled.compare_exchange_strong(
185 pnode->m_avalanche_pubkey = std::move(key);
191 strprintf(
"The node does not exist: %d", nodeid));
195 if (!
pm.addNode(nodeid, proofid)) {
199 pm.addUnbroadcastProof(proofid);
208 "buildavalancheproof",
209 "Build a proof for avalanche's sybil resistance.\n",
212 "The proof's sequence"},
214 "A timestamp indicating when the proof expire"},
216 "The master private key in base58-encoding"},
221 "The stakes to be signed and associated private keys",
227 "A stake to be attached to this proof",
232 "The output number"},
236 "The height at which this UTXO was mined"},
239 "Indicate wether the UTXO is a coinbase"},
242 "private key in base58-encoding"},
251 "A string that is a serialized, hex-encoded proof data."},
253 "0 1234567800 \"<master>\" []")},
260 if (!masterKey.IsValid()) {
265 request.params[4].get_str(), config.GetChainParams());
269 "Invalid payout address");
276 for (
size_t i = 0; i < stakes.
size(); i++) {
293 "vout cannot be negative");
299 "height must be positive");
305 if (!stake.
exists(
"amount")) {
320 "Invalid private key");
332 return proof->ToHex();
339 "decodeavalancheproof",
340 "Convert a serialized, hex-encoded proof, into JSON object. "
341 "The validity of the proof is not verified.\n",
344 "The proof hex string"},
352 "The proof's sequential number"},
354 "A timestamp indicating when the proof expires"},
357 "The proof signature (base64 encoded)"},
360 "The proof payout script",
364 "Raw payout script in hex format"},
368 "The required signatures"},
377 "A hash of the proof data excluding the master key."},
379 "A hash of the limitedid and master key."},
381 "The total staked amount of this proof in " +
393 "The transaction id"},
396 "The amount in this UTXO"},
398 "The height at which this UTXO was mined"},
400 "Indicate whether the UTXO is a coinbase"},
402 "This UTXO's public key"},
404 "Signature of the proofid with this UTXO's private "
405 "key (base64 encoded)"},
440 const COutPoint &utxo = s.getStake().getUTXO();
444 stake.
pushKV(
"amount", s.getStake().getAmount());
446 stake.
pushKV(
"iscoinbase", s.getStake().isCoinbase());
447 stake.
pushKV(
"pubkey",
HexStr(s.getStake().getPubkey()));
455 result.
pushKV(
"stakes", stakes);
464 "delegateavalancheproof",
465 "Delegate the avalanche proof to another public key.\n",
468 "The limited id of the proof to be delegated."},
470 "The private key in base58-encoding. Must match the proof master "
471 "public key or the upper level parent delegation public key if "
474 "The public key to delegate the proof to."},
476 "A string that is the serialized, hex-encoded delegation for the "
477 "proof and which is a parent for the delegation to build."},
480 "A string that is a serialized, hex-encoded delegation."},
483 "\"<limitedproofid>\" \"<privkey>\" \"<pubkey>\"")},
487 ParseHashV(request.params[0],
"limitedproofid")};
492 "The private key is invalid");
497 std::unique_ptr<avalanche::DelegationBuilder>
dgb;
498 if (request.params.size() >= 4 && !request.params[3].isNull()) {
503 if (
dg.getProofId() !=
504 limitedProofId.computeProofId(
dg.getProofMaster())) {
507 "The delegation does not match the proof");
513 "The private key does not match the delegation");
516 dgb = std::make_unique<avalanche::DelegationBuilder>(
dg);
518 dgb = std::make_unique<avalanche::DelegationBuilder>(
519 limitedProofId,
privkey.GetPubKey());
524 "Unable to build the delegation");
536 "decodeavalanchedelegation",
537 "Convert a serialized, hex-encoded avalanche proof delegation, into "
539 "The validity of the delegation is not verified.\n",
542 "The delegation hex string"},
550 "The public key the proof is delegated to."},
552 "The delegated proof master public key."},
554 "The identifier of this delegation."},
556 "A delegated proof data hash excluding the master key."},
558 "A hash of the delegated proof limitedid and master key."},
560 "The number of delegation levels."},
570 "The index of this delegation level."},
572 "This delegated public key for this level"},
574 "Signature of this delegation level (base64 "
580 "\"<hex delegation>\"") +
582 "\"<hex delegation>\"")},
588 delegation, request.params[0].get_str(),
error)) {
596 result.
pushKV(
"limitedid",
604 for (
auto &
level : levels) {
620 "Returns an object containing various state info regarding avalanche "
629 "Whether the node is ready to start polling and voting."},
632 "Only available if -avaproof has been supplied to the node",
635 "Whether the node local proof has been locally verified "
638 "The proof verification status. Only available if the "
639 "\"verified\" flag is false."},
641 "The node local proof id."},
643 "The node local limited proof id."},
645 "The node local proof master public key."},
647 "The node local proof payout address. This might be "
648 "omitted if the payout script is not one of P2PK, P2PKH "
649 "or P2SH, in which case decodeavalancheproof can be used "
650 "to get more details."},
652 "The node local proof staked amount."},
659 "The number of valid avalanche proofs we know exist "
660 "(including this node's local proof if applicable)."},
662 "The number of avalanche proofs with at least one node "
663 "we are connected to (including this node's local proof "
666 "The number of avalanche proofs with no node attached."},
668 "The number of known avalanche proofs that have been "
669 "finalized by avalanche."},
671 "The number of known avalanche proofs that conflict with "
674 "The number of known avalanche proofs that have immature "
677 "The total staked amount over all the valid proofs in " +
679 " (including this node's local proof if "
682 "The total staked amount over all the connected proofs "
685 " (including this node's local proof if "
688 "The total staked amount over all the dangling proofs "
691 " (including this node's local proof if "
694 "The total staked amount over all the immature proofs "
697 " (including this node's local proof if "
700 "The number of avalanche nodes we are connected to "
701 "(including this node if a local proof is set)."},
703 "The number of avalanche nodes associated with an "
704 "avalanche proof (including this node if a local proof "
707 "The number of avalanche nodes pending for a proof."},
719 ret.pushKV(
"ready_to_poll",
avalanche.isQuorumEstablished());
721 auto localProof =
avalanche.getLocalProof();
722 if (localProof !=
nullptr) {
727 return pm.isBoundToPeer(proofid);
733 avalanche.getLocalProofRegistrationState();
736 local.pushKV(
"verification_status",
738 ? (
sharing ?
"pending verification"
739 :
"pending inbound connections")
742 local.pushKV(
"proofid", localProof->getId().ToString());
743 local.pushKV(
"limited_proofid",
744 localProof->getLimitedId().ToString());
745 local.pushKV(
"master",
HexStr(localProof->getMaster()));
749 local.pushKV(
"payout_address",
752 local.pushKV(
"stake_amount", localProof->getStakedAmount());
771 peer.
proof->getId() == localProof->getId();
791 pm.getImmatureProofPool().forEachProof(
798 network.
pushKV(
"dangling_proof_count",
803 "conflicting_proof_count",
804 uint64_t(
pm.getConflictingProofPool().countProofs()));
806 "immature_proof_count",
807 uint64_t(
pm.getImmatureProofPool().countProofs()));
811 network.
pushKV(
"dangling_stake_amount",
815 const uint64_t pendingNodes =
pm.getPendingNodeCount();
818 network.
pushKV(
"pending_node_count", pendingNodes);
820 ret.pushKV(
"network", network);
830 "getavalanchepeerinfo",
831 "Returns data about an avalanche peer as a json array of objects. If "
832 "no proofid is provided, returns data about all the peers.\n",
835 "The hex encoded avalanche proof identifier."},
847 "The avalanche internal peer identifier"},
849 "The agreggated availability score of this peer's nodes"},
851 "The avalanche proof id used by this peer"},
853 "The avalanche proof used by this peer"},
855 "The number of nodes for this peer"},
861 "Node id, as returned by getpeerinfo"},
879 obj.pushKV(
"avalanche_peerid",
uint64_t(peer.peerid));
880 obj.pushKV(
"availability_score", peer.availabilityScore);
881 obj.pushKV(
"proofid", peer.getProofId().ToString());
882 obj.pushKV(
"proof", peer.proof->ToHex());
889 obj.pushKV(
"nodecount",
uint64_t(peer.node_count));
890 obj.pushKV(
"node_list", nodes);
899 if (!request.params[0].isNull()) {
900 const avalanche::ProofId proofid =
901 avalanche::ProofId::fromHex(
902 request.params[0].get_str());
903 if (!pm.isBoundToPeer(proofid)) {
904 throw JSONRPCError(RPC_INVALID_PARAMETER,
905 "Proofid not found");
909 ret.push_back(peerToUniv(pm, peer));
929 "getavalancheproofs",
930 "Returns an object containing all tracked proofids.\n",
942 "Avalanche proof id"},
949 "Avalanche proof id"},
956 "Avalanche proof id"},
970 const std::string &key) {
974 arrOut.push_back(proofid.ToString());
992 "Return a list of possible staking reward winners based on the "
997 "The previous block hash, hex encoded."},
999 "Whether to recompute the staking reward winner if there is a "
1009 "The winning proof",
1012 "The winning proofid"},
1015 "Raw payout script in hex format"},
1019 "The required signatures"},
1051 config.GetChainParams().GetConsensus(), pprev)) {
1055 "Staking rewards are not activated for block %s\n",
1059 if (!request.params[1].isNull() && request.params[1].get_bool()) {
1062 avalanche.eraseStakingRewardWinner(blockhash);
1065 if (!
avalanche.computeStakingReward(pprev)) {
1068 strprintf(
"Unable to determine a staking reward winner "
1073 std::vector<std::pair<avalanche::ProofId, CScript>> winners;
1074 if (!
avalanche.getStakingRewardWinners(blockhash, winners)) {
1077 strprintf(
"Unable to retrieve the staking reward winner "
1083 for (
auto &
winner : winners) {
1099 "Return true if a staking reward winner exists based on the previous "
1103 "The previous block hash, hex encoded."},
1106 "Whether staking reward winner has been computed for "
1107 "previous block hash or not."},
1131 config.GetChainParams().GetConsensus(), pprev)) {
1135 "Staking rewards are not activated for block %s\n",
1139 std::vector<std::pair<avalanche::ProofId, CScript>> winners;
1140 if (!
avalanche.getStakingRewardWinners(blockhash, winners)) {
1143 return winners.size() > 0;
1151 "Set the staking reward winner for the given previous block hash.\n",
1154 "The previous block hash, hex encoded."},
1156 "The payout script for the staking reward, hex encoded."},
1158 "Append to the list of possible winners instead of replacing."},
1161 "Whether the payout script was set or not"},
1163 HelpExampleRpc(
"setstakingreward",
"<blockhash> <payout script>")},
1186 config.GetChainParams().GetConsensus(), pprev)) {
1190 "Staking rewards are not activated for block %s\n",
1194 const std::vector<uint8_t> data =
1195 ParseHex(request.params[1].get_str());
1198 std::vector<CScript> payoutScripts;
1200 if (!request.params[2].isNull() && request.params[2].get_bool()) {
1204 avalanche.getStakingRewardWinners(blockhash, payoutScripts);
1207 if (std::find(payoutScripts.begin(), payoutScripts.end(),
1212 "Staking rewards winner is already set for block %s\n",
1221 avalanche.setStakingRewardWinners(pprev, payoutScripts);
1230 "Get the list of remote proofs for the given node id.\n",
1233 "The node identifier."},
1245 "The hex encoded proof identifier."},
1247 "Whether the node has the proof."},
1249 "The last time this proof status was updated."},
1260 auto remoteProofs =
avalanche.withPeerManager(
1262 return pm.getRemoteProofs(nodeid);
1283 "getrawavalancheproof",
1284 "Lookup for a known avalanche proof by id.\n",
1287 "The hex encoded avalanche proof identifier."},
1295 "The hex encoded proof matching the identifier."},
1297 "Whether the proof has immature utxos."},
1299 "Whether the proof is bound to an avalanche peer."},
1301 "Whether the proof has a conflicting UTXO with an avalanche "
1304 "Whether the proof is finalized by vote."},
1316 bool isImmature =
false;
1317 bool isBoundToPeer =
false;
1322 isImmature =
pm.isImmature(proofid);
1323 isBoundToPeer =
pm.isBoundToPeer(proofid);
1327 return p.hasFinalized;
1329 return pm.getProof(proofid);
1341 ret.pushKV(
"immature", isImmature);
1342 ret.pushKV(
"boundToPeer", isBoundToPeer);
1353 "invalidateavalancheproof",
1354 "Reject a known avalanche proof by id.\n",
1357 "The hex encoded avalanche proof identifier."},
1374 if (!
pm.exists(proofid) && !
pm.isDangling(proofid)) {
1375 throw JSONRPCError(RPC_INVALID_PARAMETER,
1379 if (!
pm.rejectProof(
1382 throw JSONRPCError(RPC_INTERNAL_ERROR,
1383 "Failed to reject the proof");
1386 pm.setInvalid(proofid);
1389 if (
avalanche.isRecentlyFinalized(proofid)) {
1405 "Check if a block has been finalized by avalanche votes.\n",
1408 "The hash of the block."},
1411 "Whether the block has been finalized by avalanche votes."},
1421 "Avalanche is not ready to poll yet.");
1447 "isfinaltransaction",
1448 "Check if a transaction has been finalized by avalanche votes.\n",
1451 "The id of the transaction."},
1453 "The block in which to look for the transaction"},
1457 "Whether the transaction has been finalized by avalanche votes."},
1470 if (!request.params[1].isNull()) {
1493 "Avalanche is not ready to poll yet.");
1500 return !pindex->nStatus.hasData())) {
1502 "Block data not downloaded yet.");
1504 errmsg =
"No such transaction found in the provided block.";
1506 errmsg =
"No such transaction. Use -txindex or provide a "
1507 "block hash to enable blockchain transaction "
1510 errmsg =
"No such transaction. Blockchain transactions are "
1511 "still in the process of being indexed.";
1513 errmsg =
"No such mempool or blockchain transaction.";
1534 return !
node.mempool->exists(txid) &&
1543 "reconsideravalancheproof",
1544 "Reconsider a known avalanche proof.\n",
1547 "The hex encoded avalanche proof."},
1552 "Whether the proof has been successfully registered.",
1571 if (
pm.isInvalid(proof->getId())) {
1572 pm.clearAllInvalid();
1589 return pm.isBoundToPeer(proof->getId());
1597 "sendavalancheproof",
1598 "Broadcast an avalanche proof.\n",
1601 "The avalanche proof to broadcast."},
1604 "Whether the proof was sent successfully or not."},
1631 pm.addUnbroadcastProof(proofid);
1635 node.peerman->RelayProof(proofid);
1645 "verifyavalancheproof",
1646 "Verify an avalanche proof is valid and return the error otherwise.\n",
1649 "Proof to verify."},
1652 "Whether the proof is valid or not."},
1658 request.params[0].get_str());
1667 "verifyavalanchedelegation",
1668 "Verify an avalanche delegation is valid and return the error "
1672 "The avalanche proof delegation to verify."},
1675 "Whether the delegation is valid or not."},
1692 "Add or remove a proofid from the flaky list. This means that an "
1693 "additional staking reward winner will be accepted if this proof is "
1694 "the selected one.\n",
1697 "The avalanche proof id."},
1699 "Whether to add (true) or remove (false) the proof from the flaky "
1703 "Whether the addition/removal is successful."},
1711 const auto proofid =
1713 const bool addNotRemove = request.params[1].get_bool();
1718 return pm.setFlaky(proofid);
1720 return pm.unsetFlaky(proofid);
1727 return avalanche.computeStakingReward(pprev);
1737 "List the flaky proofs (set via setflakyproof).\n",
1749 "The hex encoded proof identifier."},
1751 "The proof stake amount, only present if the proof is "
1755 "The proof payout script, only present if the proof is "
1760 "Raw payout script in hex format"},
1764 "The required signatures"},
1789 const auto proof =
pm.getProof(proofid);
1792 proof->getStakedAmount());
1809 "getstakecontendervote",
1810 "Return the stake contender avalanche vote.\n",
1813 "The prevblockhash used to compute the stake contender ID, hex "
1816 "The proofid used to compute the stake contender ID, hex "
1820 "The vote that would be returned if polled."},
1822 "<prevblockhash> <proofid>")},
1829 ParseHashV(request.params[0],
"prevblockhash"));
1871 for (
const auto &
c : commands) {
1872 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 hasstakingreward()
static RPCHelpMan addavalanchenode()
static CPubKey ParsePubKey(const UniValue ¶m)
static RPCHelpMan getstakecontendervote()
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)
StakeContenderIds are unique for each block to ensure that the peer polling for their acceptance has ...
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