-
+ 6D3CD409EEE6A9F7689A3CBBC8AF5207E314B39F4B16F8C82F350FFB1AFD42B8025EFFA2C1D2E6F5F511B2C0FDD87BF008206AE6809490E0DD8D06E9B3430EA4bitcoin/src/script.h(0 . 0)(1 . 703)
18898 // Copyright (c) 2009-2010 Satoshi Nakamoto
18899 // Copyright (c) 2011 The Bitcoin developers
18900 // Distributed under the MIT/X11 software license, see the accompanying
18901 // file license.txt or http://www.opensource.org/licenses/mit-license.php.
18902 #ifndef H_BITCOIN_SCRIPT
18903 #define H_BITCOIN_SCRIPT
18904
18905 #include "base58.h"
18906 #include "keystore.h"
18907
18908 #include <string>
18909 #include <vector>
18910
18911 #include <boost/foreach.hpp>
18912
18913 class CTransaction;
18914
18915 enum
18916 {
18917 SIGHASH_ALL = 1,
18918 SIGHASH_NONE = 2,
18919 SIGHASH_SINGLE = 3,
18920 SIGHASH_ANYONECANPAY = 0x80,
18921 };
18922
18923
18924
18925 enum opcodetype
18926 {
18927 // push value
18928 OP_0=0,
18929 OP_FALSE=OP_0,
18930 OP_PUSHDATA1=76,
18931 OP_PUSHDATA2,
18932 OP_PUSHDATA4,
18933 OP_1NEGATE,
18934 OP_RESERVED,
18935 OP_1,
18936 OP_TRUE=OP_1,
18937 OP_2,
18938 OP_3,
18939 OP_4,
18940 OP_5,
18941 OP_6,
18942 OP_7,
18943 OP_8,
18944 OP_9,
18945 OP_10,
18946 OP_11,
18947 OP_12,
18948 OP_13,
18949 OP_14,
18950 OP_15,
18951 OP_16,
18952
18953 // control
18954 OP_NOP,
18955 OP_VER,
18956 OP_IF,
18957 OP_NOTIF,
18958 OP_VERIF,
18959 OP_VERNOTIF,
18960 OP_ELSE,
18961 OP_ENDIF,
18962 OP_VERIFY,
18963 OP_RETURN,
18964
18965 // stack ops
18966 OP_TOALTSTACK,
18967 OP_FROMALTSTACK,
18968 OP_2DROP,
18969 OP_2DUP,
18970 OP_3DUP,
18971 OP_2OVER,
18972 OP_2ROT,
18973 OP_2SWAP,
18974 OP_IFDUP,
18975 OP_DEPTH,
18976 OP_DROP,
18977 OP_DUP,
18978 OP_NIP,
18979 OP_OVER,
18980 OP_PICK,
18981 OP_ROLL,
18982 OP_ROT,
18983 OP_SWAP,
18984 OP_TUCK,
18985
18986 // splice ops
18987 OP_CAT,
18988 OP_SUBSTR,
18989 OP_LEFT,
18990 OP_RIGHT,
18991 OP_SIZE,
18992
18993 // bit logic
18994 OP_INVERT,
18995 OP_AND,
18996 OP_OR,
18997 OP_XOR,
18998 OP_EQUAL,
18999 OP_EQUALVERIFY,
19000 OP_RESERVED1,
19001 OP_RESERVED2,
19002
19003 // numeric
19004 OP_1ADD,
19005 OP_1SUB,
19006 OP_2MUL,
19007 OP_2DIV,
19008 OP_NEGATE,
19009 OP_ABS,
19010 OP_NOT,
19011 OP_0NOTEQUAL,
19012
19013 OP_ADD,
19014 OP_SUB,
19015 OP_MUL,
19016 OP_DIV,
19017 OP_MOD,
19018 OP_LSHIFT,
19019 OP_RSHIFT,
19020
19021 OP_BOOLAND,
19022 OP_BOOLOR,
19023 OP_NUMEQUAL,
19024 OP_NUMEQUALVERIFY,
19025 OP_NUMNOTEQUAL,
19026 OP_LESSTHAN,
19027 OP_GREATERTHAN,
19028 OP_LESSTHANOREQUAL,
19029 OP_GREATERTHANOREQUAL,
19030 OP_MIN,
19031 OP_MAX,
19032
19033 OP_WITHIN,
19034
19035 // crypto
19036 OP_RIPEMD160,
19037 OP_SHA1,
19038 OP_SHA256,
19039 OP_HASH160,
19040 OP_HASH256,
19041 OP_CODESEPARATOR,
19042 OP_CHECKSIG,
19043 OP_CHECKSIGVERIFY,
19044 OP_CHECKMULTISIG,
19045 OP_CHECKMULTISIGVERIFY,
19046
19047 // expansion
19048 OP_NOP1,
19049 OP_NOP2,
19050 OP_NOP3,
19051 OP_NOP4,
19052 OP_NOP5,
19053 OP_NOP6,
19054 OP_NOP7,
19055 OP_NOP8,
19056 OP_NOP9,
19057 OP_NOP10,
19058
19059
19060
19061 // template matching params
19062 OP_PUBKEYHASH = 0xfd,
19063 OP_PUBKEY = 0xfe,
19064
19065 OP_INVALIDOPCODE = 0xff,
19066 };
19067
19068
19069
19070
19071
19072
19073
19074
19075 inline const char* GetOpName(opcodetype opcode)
19076 {
19077 switch (opcode)
19078 {
19079 // push value
19080 case OP_0 : return "0";
19081 case OP_PUSHDATA1 : return "OP_PUSHDATA1";
19082 case OP_PUSHDATA2 : return "OP_PUSHDATA2";
19083 case OP_PUSHDATA4 : return "OP_PUSHDATA4";
19084 case OP_1NEGATE : return "-1";
19085 case OP_RESERVED : return "OP_RESERVED";
19086 case OP_1 : return "1";
19087 case OP_2 : return "2";
19088 case OP_3 : return "3";
19089 case OP_4 : return "4";
19090 case OP_5 : return "5";
19091 case OP_6 : return "6";
19092 case OP_7 : return "7";
19093 case OP_8 : return "8";
19094 case OP_9 : return "9";
19095 case OP_10 : return "10";
19096 case OP_11 : return "11";
19097 case OP_12 : return "12";
19098 case OP_13 : return "13";
19099 case OP_14 : return "14";
19100 case OP_15 : return "15";
19101 case OP_16 : return "16";
19102
19103 // control
19104 case OP_NOP : return "OP_NOP";
19105 case OP_VER : return "OP_VER";
19106 case OP_IF : return "OP_IF";
19107 case OP_NOTIF : return "OP_NOTIF";
19108 case OP_VERIF : return "OP_VERIF";
19109 case OP_VERNOTIF : return "OP_VERNOTIF";
19110 case OP_ELSE : return "OP_ELSE";
19111 case OP_ENDIF : return "OP_ENDIF";
19112 case OP_VERIFY : return "OP_VERIFY";
19113 case OP_RETURN : return "OP_RETURN";
19114
19115 // stack ops
19116 case OP_TOALTSTACK : return "OP_TOALTSTACK";
19117 case OP_FROMALTSTACK : return "OP_FROMALTSTACK";
19118 case OP_2DROP : return "OP_2DROP";
19119 case OP_2DUP : return "OP_2DUP";
19120 case OP_3DUP : return "OP_3DUP";
19121 case OP_2OVER : return "OP_2OVER";
19122 case OP_2ROT : return "OP_2ROT";
19123 case OP_2SWAP : return "OP_2SWAP";
19124 case OP_IFDUP : return "OP_IFDUP";
19125 case OP_DEPTH : return "OP_DEPTH";
19126 case OP_DROP : return "OP_DROP";
19127 case OP_DUP : return "OP_DUP";
19128 case OP_NIP : return "OP_NIP";
19129 case OP_OVER : return "OP_OVER";
19130 case OP_PICK : return "OP_PICK";
19131 case OP_ROLL : return "OP_ROLL";
19132 case OP_ROT : return "OP_ROT";
19133 case OP_SWAP : return "OP_SWAP";
19134 case OP_TUCK : return "OP_TUCK";
19135
19136 // splice ops
19137 case OP_CAT : return "OP_CAT";
19138 case OP_SUBSTR : return "OP_SUBSTR";
19139 case OP_LEFT : return "OP_LEFT";
19140 case OP_RIGHT : return "OP_RIGHT";
19141 case OP_SIZE : return "OP_SIZE";
19142
19143 // bit logic
19144 case OP_INVERT : return "OP_INVERT";
19145 case OP_AND : return "OP_AND";
19146 case OP_OR : return "OP_OR";
19147 case OP_XOR : return "OP_XOR";
19148 case OP_EQUAL : return "OP_EQUAL";
19149 case OP_EQUALVERIFY : return "OP_EQUALVERIFY";
19150 case OP_RESERVED1 : return "OP_RESERVED1";
19151 case OP_RESERVED2 : return "OP_RESERVED2";
19152
19153 // numeric
19154 case OP_1ADD : return "OP_1ADD";
19155 case OP_1SUB : return "OP_1SUB";
19156 case OP_2MUL : return "OP_2MUL";
19157 case OP_2DIV : return "OP_2DIV";
19158 case OP_NEGATE : return "OP_NEGATE";
19159 case OP_ABS : return "OP_ABS";
19160 case OP_NOT : return "OP_NOT";
19161 case OP_0NOTEQUAL : return "OP_0NOTEQUAL";
19162 case OP_ADD : return "OP_ADD";
19163 case OP_SUB : return "OP_SUB";
19164 case OP_MUL : return "OP_MUL";
19165 case OP_DIV : return "OP_DIV";
19166 case OP_MOD : return "OP_MOD";
19167 case OP_LSHIFT : return "OP_LSHIFT";
19168 case OP_RSHIFT : return "OP_RSHIFT";
19169 case OP_BOOLAND : return "OP_BOOLAND";
19170 case OP_BOOLOR : return "OP_BOOLOR";
19171 case OP_NUMEQUAL : return "OP_NUMEQUAL";
19172 case OP_NUMEQUALVERIFY : return "OP_NUMEQUALVERIFY";
19173 case OP_NUMNOTEQUAL : return "OP_NUMNOTEQUAL";
19174 case OP_LESSTHAN : return "OP_LESSTHAN";
19175 case OP_GREATERTHAN : return "OP_GREATERTHAN";
19176 case OP_LESSTHANOREQUAL : return "OP_LESSTHANOREQUAL";
19177 case OP_GREATERTHANOREQUAL : return "OP_GREATERTHANOREQUAL";
19178 case OP_MIN : return "OP_MIN";
19179 case OP_MAX : return "OP_MAX";
19180 case OP_WITHIN : return "OP_WITHIN";
19181
19182 // crypto
19183 case OP_RIPEMD160 : return "OP_RIPEMD160";
19184 case OP_SHA1 : return "OP_SHA1";
19185 case OP_SHA256 : return "OP_SHA256";
19186 case OP_HASH160 : return "OP_HASH160";
19187 case OP_HASH256 : return "OP_HASH256";
19188 case OP_CODESEPARATOR : return "OP_CODESEPARATOR";
19189 case OP_CHECKSIG : return "OP_CHECKSIG";
19190 case OP_CHECKSIGVERIFY : return "OP_CHECKSIGVERIFY";
19191 case OP_CHECKMULTISIG : return "OP_CHECKMULTISIG";
19192 case OP_CHECKMULTISIGVERIFY : return "OP_CHECKMULTISIGVERIFY";
19193
19194 // expanson
19195 case OP_NOP1 : return "OP_NOP1";
19196 case OP_NOP2 : return "OP_NOP2";
19197 case OP_NOP3 : return "OP_NOP3";
19198 case OP_NOP4 : return "OP_NOP4";
19199 case OP_NOP5 : return "OP_NOP5";
19200 case OP_NOP6 : return "OP_NOP6";
19201 case OP_NOP7 : return "OP_NOP7";
19202 case OP_NOP8 : return "OP_NOP8";
19203 case OP_NOP9 : return "OP_NOP9";
19204 case OP_NOP10 : return "OP_NOP10";
19205
19206
19207
19208 // template matching params
19209 case OP_PUBKEYHASH : return "OP_PUBKEYHASH";
19210 case OP_PUBKEY : return "OP_PUBKEY";
19211
19212 case OP_INVALIDOPCODE : return "OP_INVALIDOPCODE";
19213 default:
19214 return "OP_UNKNOWN";
19215 }
19216 };
19217
19218
19219
19220
19221 inline std::string ValueString(const std::vector<unsigned char>& vch)
19222 {
19223 if (vch.size() <= 4)
19224 return strprintf("%d", CBigNum(vch).getint());
19225 else
19226 return HexStr(vch);
19227 }
19228
19229 inline std::string StackString(const std::vector<std::vector<unsigned char> >& vStack)
19230 {
19231 std::string str;
19232 BOOST_FOREACH(const std::vector<unsigned char>& vch, vStack)
19233 {
19234 if (!str.empty())
19235 str += " ";
19236 str += ValueString(vch);
19237 }
19238 return str;
19239 }
19240
19241
19242
19243
19244
19245
19246
19247
19248
19249 class CScript : public std::vector<unsigned char>
19250 {
19251 protected:
19252 CScript& push_int64(int64 n)
19253 {
19254 if (n == -1 || (n >= 1 && n <= 16))
19255 {
19256 push_back(n + (OP_1 - 1));
19257 }
19258 else
19259 {
19260 CBigNum bn(n);
19261 *this << bn.getvch();
19262 }
19263 return *this;
19264 }
19265
19266 CScript& push_uint64(uint64 n)
19267 {
19268 if (n >= 1 && n <= 16)
19269 {
19270 push_back(n + (OP_1 - 1));
19271 }
19272 else
19273 {
19274 CBigNum bn(n);
19275 *this << bn.getvch();
19276 }
19277 return *this;
19278 }
19279
19280 public:
19281 CScript() { }
19282 CScript(const CScript& b) : std::vector<unsigned char>(b.begin(), b.end()) { }
19283 CScript(const_iterator pbegin, const_iterator pend) : std::vector<unsigned char>(pbegin, pend) { }
19284 #ifndef _MSC_VER
19285 CScript(const unsigned char* pbegin, const unsigned char* pend) : std::vector<unsigned char>(pbegin, pend) { }
19286 #endif
19287
19288 CScript& operator+=(const CScript& b)
19289 {
19290 insert(end(), b.begin(), b.end());
19291 return *this;
19292 }
19293
19294 friend CScript operator+(const CScript& a, const CScript& b)
19295 {
19296 CScript ret = a;
19297 ret += b;
19298 return ret;
19299 }
19300
19301
19302 explicit CScript(char b) { operator<<(b); }
19303 explicit CScript(short b) { operator<<(b); }
19304 explicit CScript(int b) { operator<<(b); }
19305 explicit CScript(long b) { operator<<(b); }
19306 explicit CScript(int64 b) { operator<<(b); }
19307 explicit CScript(unsigned char b) { operator<<(b); }
19308 explicit CScript(unsigned int b) { operator<<(b); }
19309 explicit CScript(unsigned short b) { operator<<(b); }
19310 explicit CScript(unsigned long b) { operator<<(b); }
19311 explicit CScript(uint64 b) { operator<<(b); }
19312
19313 explicit CScript(opcodetype b) { operator<<(b); }
19314 explicit CScript(const uint256& b) { operator<<(b); }
19315 explicit CScript(const CBigNum& b) { operator<<(b); }
19316 explicit CScript(const std::vector<unsigned char>& b) { operator<<(b); }
19317
19318
19319 CScript& operator<<(char b) { return push_int64(b); }
19320 CScript& operator<<(short b) { return push_int64(b); }
19321 CScript& operator<<(int b) { return push_int64(b); }
19322 CScript& operator<<(long b) { return push_int64(b); }
19323 CScript& operator<<(int64 b) { return push_int64(b); }
19324 CScript& operator<<(unsigned char b) { return push_uint64(b); }
19325 CScript& operator<<(unsigned int b) { return push_uint64(b); }
19326 CScript& operator<<(unsigned short b) { return push_uint64(b); }
19327 CScript& operator<<(unsigned long b) { return push_uint64(b); }
19328 CScript& operator<<(uint64 b) { return push_uint64(b); }
19329
19330 CScript& operator<<(opcodetype opcode)
19331 {
19332 if (opcode < 0 || opcode > 0xff)
19333 throw std::runtime_error("CScript::operator<<() : invalid opcode");
19334 insert(end(), (unsigned char)opcode);
19335 return *this;
19336 }
19337
19338 CScript& operator<<(const uint160& b)
19339 {
19340 insert(end(), sizeof(b));
19341 insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
19342 return *this;
19343 }
19344
19345 CScript& operator<<(const uint256& b)
19346 {
19347 insert(end(), sizeof(b));
19348 insert(end(), (unsigned char*)&b, (unsigned char*)&b + sizeof(b));
19349 return *this;
19350 }
19351
19352 CScript& operator<<(const CBigNum& b)
19353 {
19354 *this << b.getvch();
19355 return *this;
19356 }
19357
19358 CScript& operator<<(const std::vector<unsigned char>& b)
19359 {
19360 if (b.size() < OP_PUSHDATA1)
19361 {
19362 insert(end(), (unsigned char)b.size());
19363 }
19364 else if (b.size() <= 0xff)
19365 {
19366 insert(end(), OP_PUSHDATA1);
19367 insert(end(), (unsigned char)b.size());
19368 }
19369 else if (b.size() <= 0xffff)
19370 {
19371 insert(end(), OP_PUSHDATA2);
19372 unsigned short nSize = b.size();
19373 insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
19374 }
19375 else
19376 {
19377 insert(end(), OP_PUSHDATA4);
19378 unsigned int nSize = b.size();
19379 insert(end(), (unsigned char*)&nSize, (unsigned char*)&nSize + sizeof(nSize));
19380 }
19381 insert(end(), b.begin(), b.end());
19382 return *this;
19383 }
19384
19385 CScript& operator<<(const CScript& b)
19386 {
19387 // I'm not sure if this should push the script or concatenate scripts.
19388 // If there's ever a use for pushing a script onto a script, delete this member fn
19389 assert(!"warning: pushing a CScript onto a CScript with << is probably not intended, use + to concatenate");
19390 return *this;
19391 }
19392
19393
19394 bool GetOp(iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>& vchRet)
19395 {
19396 // Wrapper so it can be called with either iterator or const_iterator
19397 const_iterator pc2 = pc;
19398 bool fRet = GetOp2(pc2, opcodeRet, &vchRet);
19399 pc = begin() + (pc2 - begin());
19400 return fRet;
19401 }
19402
19403 bool GetOp(iterator& pc, opcodetype& opcodeRet)
19404 {
19405 const_iterator pc2 = pc;
19406 bool fRet = GetOp2(pc2, opcodeRet, NULL);
19407 pc = begin() + (pc2 - begin());
19408 return fRet;
19409 }
19410
19411 bool GetOp(const_iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>& vchRet) const
19412 {
19413 return GetOp2(pc, opcodeRet, &vchRet);
19414 }
19415
19416 bool GetOp(const_iterator& pc, opcodetype& opcodeRet) const
19417 {
19418 return GetOp2(pc, opcodeRet, NULL);
19419 }
19420
19421 bool GetOp2(const_iterator& pc, opcodetype& opcodeRet, std::vector<unsigned char>* pvchRet) const
19422 {
19423 opcodeRet = OP_INVALIDOPCODE;
19424 if (pvchRet)
19425 pvchRet->clear();
19426 if (pc >= end())
19427 return false;
19428
19429 // Read instruction
19430 if (end() - pc < 1)
19431 return false;
19432 unsigned int opcode = *pc++;
19433
19434 // Immediate operand
19435 if (opcode <= OP_PUSHDATA4)
19436 {
19437 unsigned int nSize;
19438 if (opcode < OP_PUSHDATA1)
19439 {
19440 nSize = opcode;
19441 }
19442 else if (opcode == OP_PUSHDATA1)
19443 {
19444 if (end() - pc < 1)
19445 return false;
19446 nSize = *pc++;
19447 }
19448 else if (opcode == OP_PUSHDATA2)
19449 {
19450 if (end() - pc < 2)
19451 return false;
19452 nSize = 0;
19453 memcpy(&nSize, &pc[0], 2);
19454 pc += 2;
19455 }
19456 else if (opcode == OP_PUSHDATA4)
19457 {
19458 if (end() - pc < 4)
19459 return false;
19460 memcpy(&nSize, &pc[0], 4);
19461 pc += 4;
19462 }
19463 if (end() - pc < nSize)
19464 return false;
19465 if (pvchRet)
19466 pvchRet->assign(pc, pc + nSize);
19467 pc += nSize;
19468 }
19469
19470 opcodeRet = (opcodetype)opcode;
19471 return true;
19472 }
19473
19474
19475 void FindAndDelete(const CScript& b)
19476 {
19477 if (b.empty())
19478 return;
19479 iterator pc = begin();
19480 opcodetype opcode;
19481 do
19482 {
19483 while (end() - pc >= b.size() && memcmp(&pc[0], &b[0], b.size()) == 0)
19484 erase(pc, pc + b.size());
19485 }
19486 while (GetOp(pc, opcode));
19487 }
19488
19489
19490 int GetSigOpCount() const
19491 {
19492 int n = 0;
19493 const_iterator pc = begin();
19494 while (pc < end())
19495 {
19496 opcodetype opcode;
19497 if (!GetOp(pc, opcode))
19498 break;
19499 if (opcode == OP_CHECKSIG || opcode == OP_CHECKSIGVERIFY)
19500 n++;
19501 else if (opcode == OP_CHECKMULTISIG || opcode == OP_CHECKMULTISIGVERIFY)
19502 n += 20;
19503 }
19504 return n;
19505 }
19506
19507
19508 bool IsPushOnly() const
19509 {
19510 if (size() > 200)
19511 return false;
19512 const_iterator pc = begin();
19513 while (pc < end())
19514 {
19515 opcodetype opcode;
19516 if (!GetOp(pc, opcode))
19517 return false;
19518 if (opcode > OP_16)
19519 return false;
19520 }
19521 return true;
19522 }
19523
19524
19525 CBitcoinAddress GetBitcoinAddress() const
19526 {
19527 opcodetype opcode;
19528 std::vector<unsigned char> vch;
19529 CScript::const_iterator pc = begin();
19530 if (!GetOp(pc, opcode, vch) || opcode != OP_DUP) return 0;
19531 if (!GetOp(pc, opcode, vch) || opcode != OP_HASH160) return 0;
19532 if (!GetOp(pc, opcode, vch) || vch.size() != sizeof(uint160)) return 0;
19533 uint160 hash160 = uint160(vch);
19534 if (!GetOp(pc, opcode, vch) || opcode != OP_EQUALVERIFY) return 0;
19535 if (!GetOp(pc, opcode, vch) || opcode != OP_CHECKSIG) return 0;
19536 if (pc != end()) return 0;
19537 return CBitcoinAddress(hash160);
19538 }
19539
19540 void SetBitcoinAddress(const CBitcoinAddress& address)
19541 {
19542 this->clear();
19543 *this << OP_DUP << OP_HASH160 << address.GetHash160() << OP_EQUALVERIFY << OP_CHECKSIG;
19544 }
19545
19546 void SetBitcoinAddress(const std::vector<unsigned char>& vchPubKey)
19547 {
19548 SetBitcoinAddress(CBitcoinAddress(vchPubKey));
19549 }
19550
19551
19552 void PrintHex() const
19553 {
19554 printf("CScript(%s)\n", HexStr(begin(), end(), true).c_str());
19555 }
19556
19557 std::string ToString() const
19558 {
19559 std::string str;
19560 opcodetype opcode;
19561 std::vector<unsigned char> vch;
19562 const_iterator pc = begin();
19563 while (pc < end())
19564 {
19565 if (!str.empty())
19566 str += " ";
19567 if (!GetOp(pc, opcode, vch))
19568 {
19569 str += "[error]";
19570 return str;
19571 }
19572 if (0 <= opcode && opcode <= OP_PUSHDATA4)
19573 str += ValueString(vch);
19574 else
19575 str += GetOpName(opcode);
19576 }
19577 return str;
19578 }
19579
19580 void print() const
19581 {
19582 printf("%s\n", ToString().c_str());
19583 }
19584 };
19585
19586
19587
19588
19589
19590
19591
19592 bool EvalScript(std::vector<std::vector<unsigned char> >& stack, const CScript& script, const CTransaction& txTo, unsigned int nIn, int nHashType);
19593
19594 bool IsStandard(const CScript& scriptPubKey);
19595 bool IsMine(const CKeyStore& keystore, const CScript& scriptPubKey);
19596 bool ExtractAddress(const CScript& scriptPubKey, const CKeyStore* pkeystore, CBitcoinAddress& addressRet);
19597 bool SignSignature(const CKeyStore& keystore, const CTransaction& txFrom, CTransaction& txTo, unsigned int nIn, int nHashType=SIGHASH_ALL, CScript scriptPrereq=CScript());
19598 bool VerifySignature(const CTransaction& txFrom, const CTransaction& txTo, unsigned int nIn, int nHashType=0);
19599
19600 #endif