hdac SDK
SDK for hdac blockchain development
bitcoinaddress.h
1 #ifndef BITCOINADDRESS_H
2 #define BITCOINADDRESS_H
3 
4 #include <structs/base58.h>
5 #include "pubkey.h"
6 #include <script/standard.h>
7 #include <utils/utility.h>
8 #include "keyshelper.h"
9 
16 class CBitcoinAddress : public CBase58Data {
17 public:
18  //bool Set(const CKeyID &id, const std::vector<unsigned char> &pubkeyPrefix);
19  bool Set(const CKeyID &id);
20  bool Set(const CKeyID &id,const std::vector<unsigned char>& vchVersion);
21  bool Set(const CScriptID &id);
22  bool Set(const CTxDestination &dest);
23  bool IsValid() const;
24  //bool IsValid(const CChainParams &params) const;
25  bool IsValid(const std::vector<unsigned char>& pubkeyPrefix,
26  const std::vector<unsigned char>& scriptPrefix) const;
27 
28  CBitcoinAddress(const IWalletAddrHelper &helper) :
29  CBase58Data(helper.addrChecksumValue()),
30  _pubkeyPrefix(helper.pubkeyAddrPrefix()),
31  _scriptPrefix(helper.scriptAddrPrefix()) {}
32 
33  CBitcoinAddress(const CTxDestination &dest,
34  const IWalletAddrHelper &helper) :
35  CBitcoinAddress(helper) {
36  Set(dest);
37  }
38 
39  CBitcoinAddress(const std::string& strAddress,
40  const IWalletAddrHelper &helper) :
41  CBitcoinAddress(helper) {
42  SetString(strAddress, helper.pubkeyAddrPrefix().size());
43  }
44 
45  CBitcoinAddress(const char* pszAddress,
46  const IWalletAddrHelper &helper) :
47  CBitcoinAddress(helper) {
48  SetString(pszAddress);
49  }
50 
51  CTxDestination Get() const;
52  bool GetKeyID(CKeyID &keyID) const;
53  bool GetScriptID(CScriptID &scriptID) const;
54  bool IsScript() const;
55 
56  const std::vector<unsigned char> _pubkeyPrefix;
57  const std::vector<unsigned char> _scriptPrefix;
58 };
59 
60 #endif // BITCOINADDRESS_H
Definition: keyshelper.h:26
Definition: bitcoinaddress.h:16
Definition: base58.h:52
Definition: standard.h:8
Definition: standard.h:17
std::vector< unsigned char > vchVersion
the version byte(s)
Definition: base58.h:56