PIVX Core  5.6.99
P2P Digital Currency
key_io.h
Go to the documentation of this file.
1 // Copyright (c) 2009-2010 Satoshi Nakamoto
2 // Copyright (c) 2009-2018 The Bitcoin Core developers
3 // Distributed under the MIT software license, see the accompanying
4 // file COPYING or http://www.opensource.org/licenses/mit-license.php.
5 
6 #ifndef PIVX_KEY_IO_H
7 #define PIVX_KEY_IO_H
8 
9 #include "chainparams.h"
10 #include "key.h"
11 #include "pubkey.h"
12 #include "script/standard.h"
13 
14 #include <string>
15 
16 std::string EncodeDestination(const CTxDestination& dest, bool isStaking, bool isExchange);
18 // DecodeDestination isStaking flag is set to true when the string arg is from an staking address
19 CTxDestination DecodeDestination(const std::string& str, bool& isStaking, bool& isExchange);
20 CTxDestination DecodeDestination(const std::string& str);
21 
22 // Return true if the address is valid and is following the fStaking flag type (true means that the destination must be a staking address, false the opposite).
23 bool IsValidDestinationString(const std::string& str, bool fStaking);
24 bool IsValidDestinationString(const std::string& str, bool fStaking, const CChainParams& params);
25 
26 namespace KeyIO {
27 
28  CKey DecodeSecret(const std::string &str);
29 
30  std::string EncodeSecret(const CKey &key);
31 
32  CExtKey DecodeExtKey(const std::string &str);
33 
34  std::string EncodeExtKey(const CExtKey &extkey);
35 
36  CExtPubKey DecodeExtPubKey(const std::string& str);
37  std::string EncodeExtPubKey(const CExtPubKey& extpubkey);
38 
39 }
40 
41 #endif // PIVX_KEY_IO_H
CChainParams defines various tweakable parameters of a given instance of the PIVX system.
Definition: chainparams.h:43
An encapsulated private key.
Definition: key.h:30
CTxDestination DecodeDestination(const std::string &str, bool &isStaking, bool &isExchange)
Definition: key_io.cpp:108
bool IsValidDestinationString(const std::string &str, bool fStaking)
Definition: key_io.cpp:120
std::string EncodeDestination(const CTxDestination &dest, bool isStaking, bool isExchange)
Definition: key_io.cpp:91
std::string EncodeSecret(const CKey &key)
Definition: key_io.cpp:145
CKey DecodeSecret(const std::string &str)
Definition: key_io.cpp:127
std::string EncodeExtPubKey(const CExtPubKey &key)
Definition: key_io.cpp:193
std::string EncodeExtKey(const CExtKey &key)
Definition: key_io.cpp:170
CExtPubKey DecodeExtPubKey(const std::string &str)
Definition: key_io.cpp:180
CExtKey DecodeExtKey(const std::string &str)
Definition: key_io.cpp:157
boost::variant< CNoDestination, CKeyID, CScriptID, CExchangeKeyID > CTxDestination
A txout script template with a specific destination.
Definition: standard.h:72
Definition: key.h:148