Changeset View
Changeset View
Standalone View
Standalone View
src/base58.h
Show First 20 Lines • Show All 100 Lines • ▼ Show 20 Lines | public: | ||||
} | } | ||||
bool operator>=(const CBase58Data &b58) const { | bool operator>=(const CBase58Data &b58) const { | ||||
return CompareTo(b58) >= 0; | return CompareTo(b58) >= 0; | ||||
} | } | ||||
bool operator<(const CBase58Data &b58) const { return CompareTo(b58) < 0; } | bool operator<(const CBase58Data &b58) const { return CompareTo(b58) < 0; } | ||||
bool operator>(const CBase58Data &b58) const { return CompareTo(b58) > 0; } | bool operator>(const CBase58Data &b58) const { return CompareTo(b58) > 0; } | ||||
}; | }; | ||||
/** base58-encoded Bitcoin addresses. | |||||
* Public-key-hash-addresses have version 0 (or 111 testnet). | |||||
* The data vector contains RIPEMD160(SHA256(pubkey)), where pubkey is the | |||||
* serialized public key. | |||||
* Script-hash-addresses have version 5 (or 196 testnet). | |||||
* The data vector contains RIPEMD160(SHA256(cscript)), where cscript is the | |||||
* serialized redemption script. | |||||
*/ | |||||
class CBitcoinAddress : public CBase58Data { | |||||
public: | |||||
bool Set(const CKeyID &id); | |||||
bool Set(const CScriptID &id); | |||||
bool Set(const CTxDestination &dest); | |||||
bool IsValid() const; | |||||
bool IsValid(const CChainParams ¶ms) const; | |||||
CBitcoinAddress() {} | |||||
CBitcoinAddress(const CTxDestination &dest) { Set(dest); } | |||||
CBitcoinAddress(const std::string &strAddress) { SetString(strAddress); } | |||||
CBitcoinAddress(const char *pszAddress) { SetString(pszAddress); } | |||||
CTxDestination Get() const; | |||||
bool GetKeyID(CKeyID &keyID) const; | |||||
bool IsScript() const; | |||||
}; | |||||
/** | /** | ||||
* A base58-encoded secret key | * A base58-encoded secret key | ||||
*/ | */ | ||||
class CBitcoinSecret : public CBase58Data { | class CBitcoinSecret : public CBase58Data { | ||||
public: | public: | ||||
void SetKey(const CKey &vchSecret); | void SetKey(const CKey &vchSecret); | ||||
CKey GetKey(); | CKey GetKey(); | ||||
bool IsValid() const; | bool IsValid() const; | ||||
Show All 34 Lines | |||||
typedef CBitcoinExtKeyBase<CExtKey, BIP32_EXTKEY_SIZE, | typedef CBitcoinExtKeyBase<CExtKey, BIP32_EXTKEY_SIZE, | ||||
CChainParams::EXT_SECRET_KEY> | CChainParams::EXT_SECRET_KEY> | ||||
CBitcoinExtKey; | CBitcoinExtKey; | ||||
typedef CBitcoinExtKeyBase<CExtPubKey, BIP32_EXTKEY_SIZE, | typedef CBitcoinExtKeyBase<CExtPubKey, BIP32_EXTKEY_SIZE, | ||||
CChainParams::EXT_PUBLIC_KEY> | CChainParams::EXT_PUBLIC_KEY> | ||||
CBitcoinExtPubKey; | CBitcoinExtPubKey; | ||||
std::string EncodeDestination(const CTxDestination &dest); | |||||
CTxDestination DecodeDestination(const std::string &str); | |||||
bool IsValidDestinationString(const std::string &str); | |||||
bool IsValidDestinationString(const std::string &str, | |||||
const CChainParams ¶ms); | |||||
#endif // BITCOIN_BASE58_H | #endif // BITCOIN_BASE58_H |