Auto merge of #1026 - ebfull:address-serialization, r=ebfull
Zcash address encoding
We need to encode Zcash addresses so they aren't as large and unweildy. We're using Base58Check just like upstream does, and to ensure the first character is "z" in our addresses we must use two bytes for the version string. Two bytes gives us an extra character for free, so this PR targets the beginning of addresses to have "zc".
```
$ ./src/zcash-cli zcrawkeygen
{
"zcaddress" : "tnvaj4ZbZG83tj4RwZcFeLgJoSt8nw1ZvSCG8EMyowAsXTQgJPat77Y43BVdVCrwrbLy7GG9msJDYdn5hmreHmkXAkX17hb",
"zcsecretkey" : "SKzkxCRWvscKnroSFyhCqhY332KcDMH4LLNdK2TsSvbmr3CGAB8B",
"zcviewingkey" : "10aa74046f31cbe5eaa8965d1e104853234c3d6c6e45f9c497ca3a025d159755"
}
```
This PR also encodes the spending keys with a prefix that targets "SK". The spec needs to be updated with these changes.
Testnet addresses will start with "tn".
Closes #572
This commit is contained in:
@@ -19,13 +19,6 @@ public:
|
||||
|
||||
template <typename Stream, typename Operation>
|
||||
inline void SerializationOp(Stream& s, Operation ser_action, int nType, int nVersion) {
|
||||
unsigned char leadingByte = 0x92;
|
||||
READWRITE(leadingByte);
|
||||
|
||||
if (leadingByte != 0x92) {
|
||||
throw std::ios_base::failure("unrecognized payment address lead byte");
|
||||
}
|
||||
|
||||
READWRITE(a_pk);
|
||||
READWRITE(pk_enc);
|
||||
}
|
||||
@@ -51,4 +44,4 @@ public:
|
||||
|
||||
}
|
||||
|
||||
#endif // _ZCADDRESS_H_
|
||||
#endif // _ZCADDRESS_H_
|
||||
|
||||
Reference in New Issue
Block a user