24 memcpy(&hash, &script[3], 20);
32 if (script.
size() == 23 && script[0] ==
OP_HASH160 && script[1] == 20
34 memcpy(&hash, &script[2], 20);
43 && (script[1] == 0x02 || script[1] == 0x03)) {
44 pubkey.
Set(&script[1], &script[34]);
48 && script[1] == 0x04) {
49 pubkey.
Set(&script[1], &script[66]);
61 memcpy(&
out[1], &keyID, 20);
68 memcpy(&
out[1], &scriptID, 20);
74 memcpy(&
out[1], &pubkey[1], 32);
75 if (pubkey[0] == 0x02 || pubkey[0] == 0x03) {
78 }
else if (pubkey[0] == 0x04) {
79 out[0] = 0x04 | (pubkey[64] & 0x01);
88 if (nSize == 0 || nSize == 1)
90 if (nSize == 2 || nSize == 3 || nSize == 4 || nSize == 5)
103 memcpy(&script[3], in.
data(), 20);
111 memcpy(&script[2], in.
data(), 20);
119 memcpy(&script[2], in.
data(), 32);
124 unsigned char vch[33] = {};
126 memcpy(&vch[1], in.
data(), 32);
128 if (!pubkey.Decompress())
130 assert(pubkey.size() == 65);
133 memcpy(&script[1], pubkey.
begin(), 65);
154 while (((n % 10) == 0) && e < 9) {
162 return 1 + (n*9 + d - 1)*10 + e;
164 return 1 + (n - 1)*10 + 9;
A reference to a CKey: the Hash160 of its serialized public key.
An encapsulated public key.
bool IsFullyValid() const
fully validate whether this is a valid public key (more expensive than IsValid())
void Set(const T pbegin, const T pend)
Initialize a public key using begin/end iterators to byte data.
Serialized script, used inside transaction inputs and outputs.
A reference to a CScript: the Hash160 of its serialization.
Implements a drop-in replacement for std::vector<T> which stores up to N elements directly (without h...
void resize(size_type new_size)
bool DecompressScript(CScript &script, unsigned int nSize, const CompressedScript &in)
bool CompressScript(const CScript &script, CompressedScript &out)
static bool IsToPubKey(const CScript &script, CPubKey &pubkey)
static bool IsToKeyID(const CScript &script, CKeyID &hash)
static bool IsToScriptID(const CScript &script, CScriptID &hash)
uint64_t DecompressAmount(uint64_t x)
uint64_t CompressAmount(uint64_t n)
Compress amount.
unsigned int GetSpecialScriptSize(unsigned int nSize)