Use base58check to encode Zcash payment addresses, such that the first two bytes are "zc".

This commit is contained in:
Sean Bowe
2016-06-15 14:59:05 -06:00
parent 62b7cd6173
commit e104fcddf8
5 changed files with 59 additions and 9 deletions

View File

@@ -20,6 +20,7 @@
#include "script/script.h"
#include "script/standard.h"
#include "support/allocators/zeroafterfree.h"
#include "zcash/Address.hpp"
#include <string>
#include <vector>
@@ -95,6 +96,17 @@ public:
bool operator> (const CBase58Data& b58) const { return CompareTo(b58) > 0; }
};
class CZCPaymentAddress : public CBase58Data {
public:
bool Set(const libzcash::PaymentAddress& addr);
CZCPaymentAddress() {}
CZCPaymentAddress(const std::string& strAddress) { SetString(strAddress.c_str(), 2); }
CZCPaymentAddress(const libzcash::PaymentAddress& addr) { Set(addr); }
libzcash::PaymentAddress Get() const;
};
/** 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.