pax_global_header00006660000000000000000000000064143027060750014516gustar00rootroot0000000000000052 comment=7924f4d549e0d93991c663a343e0d835c6d9877a python-bitcoinlib-python-bitcoinlib-v0.11.2/000077500000000000000000000000001430270607500210555ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/.gitignore000066400000000000000000000001331430270607500230420ustar00rootroot00000000000000*.sw? *.pyc local*.cfg .coverage .tox/ build/ htmlcov/ python_bitcoinlib.egg-info/ dist/ python-bitcoinlib-python-bitcoinlib-v0.11.2/.travis.yml000066400000000000000000000002261430270607500231660ustar00rootroot00000000000000git: depth: 9999999 language: python python: - "3.4" - "3.5" - "3.6" - "3.7" # command to run tests script: python3 -m unittest discover -v python-bitcoinlib-python-bitcoinlib-v0.11.2/LICENSE000066400000000000000000000177371430270607500221010ustar00rootroot00000000000000python-bitcoinlib is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. python-bitcoinlib is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License below for more details. GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. python-bitcoinlib-python-bitcoinlib-v0.11.2/MANIFEST.in000066400000000000000000000000641430270607500226130ustar00rootroot00000000000000include LICENSE README.md graft bitcoin/tests/data/ python-bitcoinlib-python-bitcoinlib-v0.11.2/README.md000066400000000000000000000077071430270607500223470ustar00rootroot00000000000000# python-bitcoinlib This Python3 library provides an easy interface to the bitcoin data structures and protocol. The approach is low-level and "ground up", with a focus on providing tools to manipulate the internals of how Bitcoin works. "The Swiss Army Knife of the Bitcoin protocol." - Wladimir J. van der Laan ## Requirements sudo apt-get install libssl-dev The RPC interface, `bitcoin.rpc`, is designed to work with Bitcoin Core v0.16.0. Older versions may work but there do exist some incompatibilities. ## Structure Everything consensus critical is found in the modules under bitcoin.core. This rule is followed pretty strictly, for instance chain parameters are split into consensus critical and non-consensus-critical. bitcoin.core - Basic core definitions, datastructures, and (context-independent) validation bitcoin.core.key - ECC pubkeys bitcoin.core.script - Scripts and opcodes bitcoin.core.scripteval - Script evaluation/verification bitcoin.core.serialize - Serialization In the future the bitcoin.core may use the Satoshi sourcecode directly as a library. Non-consensus critical modules include the following: bitcoin - Chain selection bitcoin.base58 - Base58 encoding bitcoin.bloom - Bloom filters (incomplete) bitcoin.net - Network communication (in flux) bitcoin.messages - Network messages (in flux) bitcoin.rpc - Bitcoin Core RPC interface support bitcoin.wallet - Wallet-related code, currently Bitcoin address and private key support Effort has been made to follow the Satoshi source relatively closely, for instance Python code and classes that duplicate the functionality of corresponding Satoshi C++ code uses the same naming conventions: CTransaction, CBlockHeader, nValue etc. Otherwise Python naming conventions are followed. ## Mutable vs. Immutable objects Like the Bitcoin Core codebase CTransaction is immutable and CMutableTransaction is mutable; unlike the Bitcoin Core codebase this distinction also applies to COutPoint, CTxIn, CTxOut, and CBlock. ## Endianness Gotchas Rather confusingly Bitcoin Core shows transaction and block hashes as little-endian hex rather than the big-endian the rest of the world uses for SHA256. python-bitcoinlib provides the convenience functions x() and lx() in bitcoin.core to convert from big-endian and little-endian hex to raw bytes to accommodate this. In addition see b2x() and b2lx() for conversion from bytes to big/little-endian hex. ## Module import style While not always good style, it's often convenient for quick scripts if `import *` can be used. To support that all the modules have `__all__` defined appropriately. # Example Code See `examples/` directory. For instance this example creates a transaction spending a pay-to-script-hash transaction output: $ PYTHONPATH=. examples/spend-p2sh-txout.py ## Selecting the chain to use Do the following: import bitcoin bitcoin.SelectParams(NAME) Where NAME is one of 'testnet', 'mainnet', 'signet', or 'regtest'. The chain currently selected is a global variable that changes behavior everywhere, just like in the Satoshi codebase. ## Unit tests Under bitcoin/tests using test data from Bitcoin Core. To run them: python3 -m unittest discover Alternately, if Tox (see https://tox.readthedocs.org/) is available on your system, you can run unit tests for multiple Python versions: ./runtests.sh HTML coverage reports can then be found in the htmlcov/ subdirectory. ## Documentation Sphinx documentation is in the "doc" subdirectory. Run "make help" from there to see how to build. You will need the Python "sphinx" package installed. Currently this is just API documentation generated from the code and docstrings. Higher level written docs would be useful, perhaps starting with much of this README. Pages are written in reStructuredText and linked from index.rst. python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/000077500000000000000000000000001430270607500225045ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/__init__.py000066400000000000000000000065771430270607500246340ustar00rootroot00000000000000# Copyright (C) 2012-2018 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import bitcoin.core # Note that setup.py can break if __init__.py imports any external # dependencies, as these might not be installed when setup.py runs. In this # case __version__ could be moved to a separate version.py and imported here. __version__ = '0.11.2' class MainParams(bitcoin.core.CoreMainParams): MESSAGE_START = b'\xf9\xbe\xb4\xd9' DEFAULT_PORT = 8333 RPC_PORT = 8332 DNS_SEEDS = (('bitcoin.sipa.be', 'seed.bitcoin.sipa.be'), ('bluematt.me', 'dnsseed.bluematt.me'), ('dashjr.org', 'dnsseed.bitcoin.dashjr.org'), ('bitcoinstats.com', 'seed.bitcoinstats.com'), ('xf2.org', 'bitseed.xf2.org'), ('bitcoin.jonasschnelli.ch', 'seed.bitcoin.jonasschnelli.ch')) BASE58_PREFIXES = {'PUBKEY_ADDR':0, 'SCRIPT_ADDR':5, 'SECRET_KEY' :128} BECH32_HRP = 'bc' class TestNetParams(bitcoin.core.CoreTestNetParams): MESSAGE_START = b'\x0b\x11\x09\x07' DEFAULT_PORT = 18333 RPC_PORT = 18332 DNS_SEEDS = (('testnetbitcoin.jonasschnelli.ch', 'testnet-seed.bitcoin.jonasschnelli.ch'), ('petertodd.org', 'seed.tbtc.petertodd.org'), ('bluematt.me', 'testnet-seed.bluematt.me'), ('bitcoin.schildbach.de', 'testnet-seed.bitcoin.schildbach.de')) BASE58_PREFIXES = {'PUBKEY_ADDR':111, 'SCRIPT_ADDR':196, 'SECRET_KEY' :239} BECH32_HRP = 'tb' class SigNetParams(bitcoin.core.CoreSigNetParams): MESSAGE_START = b'\x0a\x03\xcf\x40' DEFAULT_PORT = 38333 RPC_PORT = 38332 DNS_SEEDS = (("signet.bitcoin.sprovoost.nl", "seed.signet.bitcoin.sprovoost.nl")) BASE58_PREFIXES = {'PUBKEY_ADDR':111, 'SCRIPT_ADDR':196, 'SECRET_KEY' :239} BECH32_HRP = 'tb' class RegTestParams(bitcoin.core.CoreRegTestParams): MESSAGE_START = b'\xfa\xbf\xb5\xda' DEFAULT_PORT = 18444 RPC_PORT = 18443 DNS_SEEDS = () BASE58_PREFIXES = {'PUBKEY_ADDR':111, 'SCRIPT_ADDR':196, 'SECRET_KEY' :239} BECH32_HRP = 'bcrt' """Master global setting for what chain params we're using. However, don't set this directly, use SelectParams() instead so as to set the bitcoin.core.params correctly too. """ #params = bitcoin.core.coreparams = MainParams() params = MainParams() def SelectParams(name): """Select the chain parameters to use name is one of 'mainnet', 'testnet', or 'regtest' Default chain is 'mainnet' """ global params bitcoin.core._SelectCoreParams(name) if name == 'mainnet': params = bitcoin.core.coreparams = MainParams() elif name == 'testnet': params = bitcoin.core.coreparams = TestNetParams() elif name == 'regtest': params = bitcoin.core.coreparams = RegTestParams() elif name == 'signet': params = bitcoin.core.coreparams = SigNetParams() else: raise ValueError('Unknown chain %r' % name) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/base58.py000066400000000000000000000073471430270607500241600ustar00rootroot00000000000000# Copyright (C) 2011 Sam Rushing # Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Base58 encoding and decoding""" import binascii import bitcoin.core B58_DIGITS = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz' class Base58Error(Exception): pass class InvalidBase58Error(Base58Error): """Raised on generic invalid base58 data, such as bad characters. Checksum failures raise Base58ChecksumError specifically. """ pass def encode(b): """Encode bytes to a base58-encoded string""" # Convert big-endian bytes to integer n = int('0x0' + binascii.hexlify(b).decode('utf8'), 16) # Divide that integer into bas58 res = [] while n > 0: n, r = divmod(n, 58) res.append(B58_DIGITS[r]) res = ''.join(res[::-1]) # Encode leading zeros as base58 zeros czero = 0 pad = 0 for c in b: if c == czero: pad += 1 else: break return B58_DIGITS[0] * pad + res def decode(s): """Decode a base58-encoding string, returning bytes""" if not s: return b'' # Convert the string to an integer n = 0 for c in s: n *= 58 if c not in B58_DIGITS: raise InvalidBase58Error('Character %r is not a valid base58 character' % c) digit = B58_DIGITS.index(c) n += digit # Convert the integer to bytes h = '%x' % n if len(h) % 2: h = '0' + h res = binascii.unhexlify(h.encode('utf8')) # Add padding back. pad = 0 for c in s[:-1]: if c == B58_DIGITS[0]: pad += 1 else: break return b'\x00' * pad + res class Base58ChecksumError(Base58Error): """Raised on Base58 checksum errors""" pass class CBase58Data(bytes): """Base58-encoded data Includes a version and checksum. """ def __new__(cls, s): k = decode(s) verbyte, data, check0 = k[0:1], k[1:-4], k[-4:] check1 = bitcoin.core.Hash(verbyte + data)[:4] if check0 != check1: raise Base58ChecksumError('Checksum mismatch: expected %r, calculated %r' % (check0, check1)) return cls.from_bytes(data, verbyte[0]) def __init__(self, s): """Initialize from base58-encoded string Note: subclasses put your initialization routines here, but ignore the argument - that's handled by __new__(), and .from_bytes() will call __init__() with None in place of the string. """ @classmethod def from_bytes(cls, data, nVersion): """Instantiate from data and nVersion""" if not (0 <= nVersion <= 255): raise ValueError('nVersion must be in range 0 to 255 inclusive; got %d' % nVersion) self = bytes.__new__(cls, data) self.nVersion = nVersion return self def to_bytes(self): """Convert to bytes instance Note that it's the data represented that is converted; the checkum and nVersion is not included. """ return b'' + self def __str__(self): """Convert to string""" vs = bytes([self.nVersion]) + self check = bitcoin.core.Hash(vs)[0:4] return encode(vs + check) def __repr__(self): return '%s(%r)' % (self.__class__.__name__, str(self)) __all__ = ( 'B58_DIGITS', 'Base58Error', 'InvalidBase58Error', 'encode', 'decode', 'Base58ChecksumError', 'CBase58Data', ) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/bech32.py000066400000000000000000000040231430270607500241230ustar00rootroot00000000000000# Copyright (C) 2017 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Bech32 encoding and decoding""" from bitcoin.segwit_addr import encode, decode import bitcoin class Bech32Error(Exception): pass class Bech32ChecksumError(Bech32Error): pass class CBech32Data(bytes): """Bech32-encoded data Includes a witver and checksum. """ def __new__(cls, s): """from bech32 addr to """ witver, data = decode(bitcoin.params.BECH32_HRP, s) if witver is None and data is None: raise Bech32Error('Bech32 decoding error') return cls.from_bytes(witver, data) def __init__(self, s): """Initialize from bech32-encoded string Note: subclasses put your initialization routines here, but ignore the argument - that's handled by __new__(), and .from_bytes() will call __init__() with None in place of the string. """ @classmethod def from_bytes(cls, witver, witprog): """Instantiate from witver and data""" if not (0 <= witver <= 16): raise ValueError('witver must be in range 0 to 16 inclusive; got %d' % witver) self = bytes.__new__(cls, witprog) self.witver = witver return self def to_bytes(self): """Convert to bytes instance Note that it's the data represented that is converted; the checkum and witver is not included. """ return b'' + self def __str__(self): """Convert to string""" return encode(bitcoin.params.BECH32_HRP, self.witver, self) def __repr__(self): return '%s(%r)' % (self.__class__.__name__, str(self)) __all__ = ( 'Bech32Error', 'Bech32ChecksumError', 'CBech32Data', ) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/bloom.py000066400000000000000000000133141430270607500241700ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Bloom filter support""" import struct import math import bitcoin.core import bitcoin.core.serialize def _ROTL32(x, r): assert x <= 0xFFFFFFFF return ((x << r) & 0xFFFFFFFF) | (x >> (32 - r)) def MurmurHash3(nHashSeed, vDataToHash): """MurmurHash3 (x86_32) Used for bloom filters. See http://code.google.com/p/smhasher/source/browse/trunk/MurmurHash3.cpp """ assert nHashSeed <= 0xFFFFFFFF h1 = nHashSeed c1 = 0xcc9e2d51 c2 = 0x1b873593 # body i = 0 while (i < len(vDataToHash) - len(vDataToHash) % 4 and len(vDataToHash) - i >= 4): k1 = struct.unpack(b"= 3: k1 ^= vDataToHash[j+2] << 16 if len(vDataToHash) & 3 >= 2: k1 ^= vDataToHash[j+1] << 8 if len(vDataToHash) & 3 >= 1: k1 ^= vDataToHash[j] k1 &= 0xFFFFFFFF k1 = (k1 * c1) & 0xFFFFFFFF k1 = _ROTL32(k1, 15) k1 = (k1 * c2) & 0xFFFFFFFF h1 ^= k1 # finalization h1 ^= len(vDataToHash) & 0xFFFFFFFF h1 ^= (h1 & 0xFFFFFFFF) >> 16 h1 *= 0x85ebca6b h1 ^= (h1 & 0xFFFFFFFF) >> 13 h1 *= 0xc2b2ae35 h1 ^= (h1 & 0xFFFFFFFF) >> 16 return h1 & 0xFFFFFFFF class CBloomFilter(bitcoin.core.serialize.Serializable): # 20,000 items with fp rate < 0.1% or 10,000 items and <0.0001% MAX_BLOOM_FILTER_SIZE = 36000 MAX_HASH_FUNCS = 50 UPDATE_NONE = 0 UPDATE_ALL = 1 UPDATE_P2PUBKEY_ONLY = 2 UPDATE_MASK = 3 def __init__(self, nElements, nFPRate, nTweak, nFlags): """Create a new bloom filter The filter will have a given false-positive rate when filled with the given number of elements. Note that if the given parameters will result in a filter outside the bounds of the protocol limits, the filter created will be as close to the given parameters as possible within the protocol limits. This will apply if nFPRate is very low or nElements is unreasonably high. nTweak is a constant which is added to the seed value passed to the hash function It should generally always be a random value (and is largely only exposed for unit testing) nFlags should be one of the UPDATE_* enums (but not _MASK) """ LN2SQUARED = 0.4804530139182014246671025263266649717305529515945455 LN2 = 0.6931471805599453094172321214581765680755001343602552 self.vData = bytearray(int(min(-1 / LN2SQUARED * nElements * math.log(nFPRate), self.MAX_BLOOM_FILTER_SIZE * 8) / 8)) self.nHashFuncs = int(min(len(self.vData) * 8 / nElements * LN2, self.MAX_HASH_FUNCS)) self.nTweak = nTweak self.nFlags = nFlags def bloom_hash(self, nHashNum, vDataToHash): return MurmurHash3(((nHashNum * 0xFBA4C795) + self.nTweak) & 0xFFFFFFFF, vDataToHash) % (len(self.vData) * 8) __bit_mask = bytearray([0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80]) def insert(self, elem): """Insert an element in the filter. elem may be a COutPoint or bytes """ if isinstance(elem, bitcoin.core.COutPoint): elem = elem.serialize() if len(self.vData) == 1 and self.vData[0] == 0xff: return for i in range(0, self.nHashFuncs): nIndex = self.bloom_hash(i, elem) # Sets bit nIndex of vData self.vData[nIndex >> 3] |= self.__bit_mask[7 & nIndex] def contains(self, elem): """Test if the filter contains an element elem may be a COutPoint or bytes """ if isinstance(elem, bitcoin.core.COutPoint): elem = elem.serialize() if len(self.vData) == 1 and self.vData[0] == 0xff: return True for i in range(0, self.nHashFuncs): nIndex = self.bloom_hash(i, elem) if not (self.vData[nIndex >> 3] & self.__bit_mask[7 & nIndex]): return False return True def IsWithinSizeConstraints(self): return len(self.vData) <= self.MAX_BLOOM_FILTER_SIZE and self.nHashFuncs <= self.MAX_HASH_FUNCS def IsRelevantAndUpdate(tx, tx_hash): # Not useful for a client, so not implemented yet. raise NotImplementedError __struct = struct.Struct(b'= 0: return "CTxOut(%s*COIN, %r)" % (str_money_value(self.nValue), self.scriptPubKey) else: return "CTxOut(%d, %r)" % (self.nValue, self.scriptPubKey) @classmethod def from_txout(cls, txout): """Create an immutable copy of an existing TxOut If txout is already immutable (txout.__class__ is CTxOut) then it will be returned directly. """ if txout.__class__ is CTxOut: return txout else: return cls(txout.nValue, txout.scriptPubKey) @__make_mutable class CMutableTxOut(CTxOut): """A mutable CTxOut""" __slots__ = [] @classmethod def from_txout(cls, txout): """Create a fullly mutable copy of an existing TxOut""" return cls(txout.nValue, txout.scriptPubKey) class CTxInWitness(ImmutableSerializable): """Witness data for a single transaction input""" __slots__ = ['scriptWitness'] def __init__(self, scriptWitness=CScriptWitness()): object.__setattr__(self, 'scriptWitness', scriptWitness) def is_null(self): return self.scriptWitness.is_null() @classmethod def stream_deserialize(cls, f): scriptWitness = CScriptWitness.stream_deserialize(f) return cls(scriptWitness) def stream_serialize(self, f): self.scriptWitness.stream_serialize(f) def __repr__(self): return "CTxInWitness(%s)" % (repr(self.scriptWitness)) @classmethod def from_txinwitness(cls, txinwitness): """Create an immutable copy of an existing TxInWitness If txin is already immutable (txin.__class__ is CTxIn) it is returned directly. """ if txinwitness.__class__ is CTxInWitness: return txinwitness else: return cls(txinwitness.scriptWitness) class CTxWitness(ImmutableSerializable): """Witness data for all inputs to a transaction""" __slots__ = ['vtxinwit'] def __init__(self, vtxinwit=()): object.__setattr__(self, 'vtxinwit', vtxinwit) def is_null(self): for n in range(len(self.vtxinwit)): if not self.vtxinwit[n].is_null(): return False return True # FIXME this cannot be a @classmethod like the others because we need to # know how many items to deserialize, which comes from len(vin) def stream_deserialize(self, f): vtxinwit = tuple(CTxInWitness.stream_deserialize(f) for dummy in range(len(self.vtxinwit))) return CTxWitness(vtxinwit) def stream_serialize(self, f): for i in range(len(self.vtxinwit)): self.vtxinwit[i].stream_serialize(f) def __repr__(self): return "CTxWitness(%s)" % (','.join(repr(w) for w in self.vtxinwit)) @classmethod def from_txwitness(cls, txwitness): """Create an immutable copy of an existing TxWitness If txwitness is already immutable (txwitness.__class__ is CTxWitness) it is returned directly. """ if txwitness.__class__ is CTxWitness: return txwitness else: return cls(txwitness.vtxinwit) class CTransaction(ImmutableSerializable): """A transaction""" __slots__ = ['nVersion', 'vin', 'vout', 'nLockTime', 'wit'] def __init__(self, vin=(), vout=(), nLockTime=0, nVersion=1, witness=CTxWitness()): """Create a new transaction vin and vout are iterables of transaction inputs and outputs respectively. If their contents are not already immutable, immutable copies will be made. """ if not (0 <= nLockTime <= 0xffffffff): raise ValueError('CTransaction: nLockTime must be in range 0x0 to 0xffffffff; got %x' % nLockTime) object.__setattr__(self, 'nLockTime', nLockTime) object.__setattr__(self, 'nVersion', nVersion) object.__setattr__(self, 'vin', tuple(CTxIn.from_txin(txin) for txin in vin)) object.__setattr__(self, 'vout', tuple(CTxOut.from_txout(txout) for txout in vout)) object.__setattr__(self, 'wit', CTxWitness.from_txwitness(witness)) @classmethod def stream_deserialize(cls, f): """Deserialize transaction This implementation corresponds to Bitcoin's SerializeTransaction() and consensus behavior. Note that Bitcoin's DecodeHexTx() also has the option to attempt deserializing as a non-witness transaction first, falling back to the consensus behavior if it fails. The difference lies in transactions which have zero inputs: they are invalid but may be (de)serialized anyway for the purpose of signing them and adding inputs. If the behavior of DecodeHexTx() is needed it could be added, but not here. """ # FIXME can't assume f is seekable nVersion = struct.unpack(b"> 24) & 0xff dDiff = float(0x0000ffff) / float(nBits & 0x00ffffff) while nShift < 29: dDiff *= 256.0 nShift += 1 while nShift > 29: dDiff /= 256.0 nShift -= 1 return dDiff difficulty = property(lambda self: CBlockHeader.calc_difficulty(self.nBits)) def __repr__(self): return "%s(%i, lx(%s), lx(%s), %s, 0x%08x, 0x%08x)" % \ (self.__class__.__name__, self.nVersion, b2lx(self.hashPrevBlock), b2lx(self.hashMerkleRoot), self.nTime, self.nBits, self.nNonce) class NoWitnessData(Exception): """The block does not have witness data""" class CBlock(CBlockHeader): """A block including all transactions in it""" __slots__ = ['vtx', 'vMerkleTree', 'vWitnessMerkleTree'] @staticmethod def build_merkle_tree_from_txids(txids): """Build a full CBlock merkle tree from txids txids - iterable of txids Returns a new merkle tree in deepest first order. The last element is the merkle root. WARNING! If you're reading this because you're learning about crypto and/or designing a new system that will use merkle trees, keep in mind that the following merkle tree algorithm has a serious flaw related to duplicate txids, resulting in a vulnerability. (CVE-2012-2459) Bitcoin has since worked around the flaw, but for new applications you should use something different; don't just copy-and-paste this code without understanding the problem first. """ merkle_tree = list(txids) size = len(txids) j = 0 while size > 1: for i in range(0, size, 2): i2 = min(i+1, size-1) merkle_tree.append(Hash(merkle_tree[j+i] + merkle_tree[j+i2])) j += size size = (size + 1) // 2 return merkle_tree @staticmethod def build_merkle_tree_from_txs(txs): """Build a full merkle tree from transactions""" txids = [tx.GetTxid() for tx in txs] return CBlock.build_merkle_tree_from_txids(txids) def calc_merkle_root(self): """Calculate the merkle root The calculated merkle root is not cached; every invocation re-calculates it from scratch. """ if not len(self.vtx): raise ValueError('Block contains no transactions') return self.build_merkle_tree_from_txs(self.vtx)[-1] @staticmethod def build_witness_merkle_tree_from_txs(txs): """Calculate the witness merkle tree from transactions""" has_witness = False hashes = [] for tx in txs: hashes.append(tx.GetHash()) has_witness |= tx.has_witness() if not has_witness: raise NoWitnessData hashes[0] = b'\x00' * 32 return CBlock.build_merkle_tree_from_txids(hashes) def calc_witness_merkle_root(self): """Calculate the witness merkle root The calculated merkle root is not cached; every invocation re-calculates it from scratch. """ if not len(self.vtx): raise ValueError('Block contains no transactions') return self.build_witness_merkle_tree_from_txs(self.vtx)[-1] def get_witness_commitment_index(self): """Find txout # of witness commitment in coinbase Return None or an index """ if not len(self.vtx): raise ValueError('Block contains no transactions') commit_pos = None for index, out in enumerate(self.vtx[0].vout): script = out.scriptPubKey if len(script) >= 38 and script[:6] == WITNESS_COINBASE_SCRIPTPUBKEY_MAGIC: commit_pos = index if commit_pos is None: raise ValueError('The witness commitment is missed') return commit_pos def __init__(self, nVersion=2, hashPrevBlock=b'\x00'*32, hashMerkleRoot=b'\x00'*32, nTime=0, nBits=0, nNonce=0, vtx=()): """Create a new block""" if vtx: vMerkleTree = tuple(CBlock.build_merkle_tree_from_txs(vtx)) if hashMerkleRoot == b'\x00'*32: hashMerkleRoot = vMerkleTree[-1] elif hashMerkleRoot != vMerkleTree[-1]: raise CheckBlockError("CBlock : hashMerkleRoot is not compatible with vtx") else: vMerkleTree = () super(CBlock, self).__init__(nVersion, hashPrevBlock, hashMerkleRoot, nTime, nBits, nNonce) object.__setattr__(self, 'vMerkleTree', vMerkleTree) try: vWitnessMerkleTree = tuple(CBlock.build_witness_merkle_tree_from_txs(vtx)) except NoWitnessData: vWitnessMerkleTree = () object.__setattr__(self, 'vWitnessMerkleTree', vWitnessMerkleTree) object.__setattr__(self, 'vtx', tuple(CTransaction.from_tx(tx) for tx in vtx)) @classmethod def stream_deserialize(cls, f): self = super(CBlock, cls).stream_deserialize(f) vtx = VectorSerializer.stream_deserialize(CTransaction, f) vMerkleTree = tuple(CBlock.build_merkle_tree_from_txs(vtx)) object.__setattr__(self, 'vMerkleTree', vMerkleTree) try: vWitnessMerkleTree = tuple(CBlock.build_witness_merkle_tree_from_txs(vtx)) except NoWitnessData: vWitnessMerkleTree = () object.__setattr__(self, 'vWitnessMerkleTree', vWitnessMerkleTree) object.__setattr__(self, 'vtx', tuple(vtx)) return self def stream_serialize(self, f, include_witness=True): super(CBlock, self).stream_serialize(f) VectorSerializer.stream_serialize(CTransaction, self.vtx, f, dict(include_witness=include_witness)) def get_header(self): """Return the block header Returned header is a new object. """ return CBlockHeader(nVersion=self.nVersion, hashPrevBlock=self.hashPrevBlock, hashMerkleRoot=self.hashMerkleRoot, nTime=self.nTime, nBits=self.nBits, nNonce=self.nNonce) def GetHash(self): """Return the block hash Note that this is the hash of the header, not the entire serialized block. """ try: return self._cached_GetHash except AttributeError: _cached_GetHash = self.get_header().GetHash() object.__setattr__(self, '_cached_GetHash', _cached_GetHash) return _cached_GetHash def GetWeight(self): """Return the block weight: (stripped_size * 3) + total_size""" return len(self.serialize(dict(include_witness=False))) * 3 + len(self.serialize()) class CoreChainParams(object): """Define consensus-critical parameters of a given instance of the Bitcoin system""" MAX_MONEY = None GENESIS_BLOCK = None PROOF_OF_WORK_LIMIT = None SUBSIDY_HALVING_INTERVAL = None NAME = None class CoreMainParams(CoreChainParams): MAX_MONEY = 21000000 * COIN NAME = 'mainnet' GENESIS_BLOCK = CBlock.deserialize(x('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000')) SUBSIDY_HALVING_INTERVAL = 210000 PROOF_OF_WORK_LIMIT = 2**256-1 >> 32 class CoreTestNetParams(CoreMainParams): NAME = 'testnet' GENESIS_BLOCK = CBlock.deserialize(x('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff001d1aa4ae180101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000')) class CoreSigNetParams(CoreMainParams): NAME = 'signet' GENESIS_BLOCK = CBlock.deserialize(x('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a008f4d5fae77031e8ad222030101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000')) class CoreRegTestParams(CoreTestNetParams): NAME = 'regtest' GENESIS_BLOCK = CBlock.deserialize(x('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff7f20020000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000')) SUBSIDY_HALVING_INTERVAL = 150 PROOF_OF_WORK_LIMIT = 2**256-1 >> 1 """Master global setting for what core chain params we're using""" coreparams = CoreMainParams() def _SelectCoreParams(name): """Select the core chain parameters to use Don't use this directly, use bitcoin.SelectParams() instead so both consensus-critical and general parameters are set properly. """ global coreparams if name == 'mainnet': coreparams = CoreMainParams() elif name == 'testnet': coreparams = CoreTestNetParams() elif name == 'regtest': coreparams = CoreRegTestParams() elif name == 'signet': coreparams = CoreSigNetParams() else: raise ValueError('Unknown chain %r' % name) class CheckTransactionError(ValidationError): pass def CheckTransaction(tx): """Basic transaction checks that don't depend on any context. Raises CheckTransactionError """ global coreparams if not tx.vin: raise CheckTransactionError("CheckTransaction() : vin empty") if not tx.vout: raise CheckTransactionError("CheckTransaction() : vout empty") # Size limits base_tx = CTransaction(tx.vin, tx.vout, tx.nLockTime, tx.nVersion) if len(base_tx.serialize()) > MAX_BLOCK_SIZE: raise CheckTransactionError("CheckTransaction() : size limits failed") # Check for negative or overflow output values nValueOut = 0 for txout in tx.vout: if txout.nValue < 0: raise CheckTransactionError("CheckTransaction() : txout.nValue negative") if txout.nValue > coreparams.MAX_MONEY: raise CheckTransactionError("CheckTransaction() : txout.nValue too high") nValueOut += txout.nValue if not MoneyRange(nValueOut): raise CheckTransactionError("CheckTransaction() : txout total out of range") # Check for duplicate inputs vin_outpoints = set() for txin in tx.vin: if txin.prevout in vin_outpoints: raise CheckTransactionError("CheckTransaction() : duplicate inputs") vin_outpoints.add(txin.prevout) if tx.is_coinbase(): if not (2 <= len(tx.vin[0].scriptSig) <= 100): raise CheckTransactionError("CheckTransaction() : coinbase script size") else: for txin in tx.vin: if txin.prevout.is_null(): raise CheckTransactionError("CheckTransaction() : prevout is null") class CheckBlockHeaderError(ValidationError): pass class CheckProofOfWorkError(CheckBlockHeaderError): pass def CheckProofOfWork(hash, nBits): """Check a proof-of-work Raises CheckProofOfWorkError """ target = uint256_from_compact(nBits) # Check range if not (0 < target <= coreparams.PROOF_OF_WORK_LIMIT): raise CheckProofOfWorkError("CheckProofOfWork() : nBits below minimum work") # Check proof of work matches claimed amount hash = uint256_from_str(hash) if hash > target: raise CheckProofOfWorkError("CheckProofOfWork() : hash doesn't match nBits") def CheckBlockHeader(block_header, fCheckPoW = True, cur_time=None): """Context independent CBlockHeader checks. fCheckPoW - Check proof-of-work. cur_time - Current time. Defaults to time.time() Raises CBlockHeaderError if block header is invalid. """ if cur_time is None: cur_time = time.time() # Check proof-of-work matches claimed amount if fCheckPoW: CheckProofOfWork(block_header.GetHash(), block_header.nBits) # Check timestamp if block_header.nTime > cur_time + 2 * 60 * 60: raise CheckBlockHeaderError("CheckBlockHeader() : block timestamp too far in the future") class CheckBlockError(CheckBlockHeaderError): pass def GetLegacySigOpCount(tx): nSigOps = 0 for txin in tx.vin: nSigOps += txin.scriptSig.GetSigOpCount(False) for txout in tx.vout: nSigOps += txout.scriptPubKey.GetSigOpCount(False) return nSigOps def CheckBlock(block, fCheckPoW = True, fCheckMerkleRoot = True, cur_time=None): """Context independent CBlock checks. CheckBlockHeader() is called first, which may raise a CheckBlockHeader exception, followed the block tests. CheckTransaction() is called for every transaction. fCheckPoW - Check proof-of-work. fCheckMerkleRoot - Check merkle root and witness merkle root matches transactions. - Check witness commitment in coinbase cur_time - Current time. Defaults to time.time() """ # Block header checks CheckBlockHeader(block.get_header(), fCheckPoW=fCheckPoW, cur_time=cur_time) # Size limits if not block.vtx: raise CheckBlockError("CheckBlock() : vtx empty") if len(block.serialize(dict(include_witness=False))) > MAX_BLOCK_SIZE: raise CheckBlockError("CheckBlock() : block larger than MAX_BLOCK_SIZE") if block.GetWeight() > MAX_BLOCK_WEIGHT: raise CheckBlockError("CheckBlock() : block larger than MAX_BLOCK_WEIGHT") # First transaction must be coinbase if not block.vtx[0].is_coinbase(): raise CheckBlockError("CheckBlock() : first tx is not coinbase") # Check rest of transactions. Note how we do things "all at once", which # could potentially be a consensus failure if there was some obscure bug. # For unique txid uniqueness testing. If coinbase tx is included twice # it'll be caught by the "more than one coinbase" test. unique_txids = set() nSigOps = 0 for tx in block.vtx[1:]: if tx.is_coinbase(): raise CheckBlockError("CheckBlock() : more than one coinbase") CheckTransaction(tx) txid = tx.GetTxid() if txid in unique_txids: raise CheckBlockError("CheckBlock() : duplicate transaction") unique_txids.add(txid) nSigOps += GetLegacySigOpCount(tx) if nSigOps > MAX_BLOCK_SIGOPS: raise CheckBlockError("CheckBlock() : out-of-bounds SigOpCount") # Check merkle root if fCheckMerkleRoot: if block.hashMerkleRoot != block.calc_merkle_root(): raise CheckBlockError("CheckBlock() : hashMerkleRoot mismatch") if len(block.vWitnessMerkleTree): # At least 1 tx has witness: check witness merkle tree root = block.vWitnessMerkleTree[-1] # vtx[0]: coinbase # vtxinwit[0]: first input nonce_script = block.vtx[0].wit.vtxinwit[0].scriptWitness nonce = nonce_script.stack[0] if len(nonce_script.stack) != 1 or len(nonce) != 32: raise CheckBlockError("CheckBlock() : invalid coinbase witnessScript") try: index = block.get_witness_commitment_index() except ValueError as e: raise CheckBlockError("CheckBlock() : " + str(e)) commit_script = block.vtx[0].vout[index].scriptPubKey if not (6 + 32 <= len(commit_script) <= 6 + 32 + 1): raise CheckBlockError("CheckBlock() : invalid segwit commitment length") commitment = commit_script[6:6 + 32] commit = commit_script[6:6 + 32] if commit != Hash(root + nonce): raise CheckBlockError("CheckBlock() : invalid segwit commitment") __all__ = ( 'Hash', 'Hash160', 'COIN', 'MAX_BLOCK_SIZE', 'MAX_BLOCK_SIGOPS', 'MoneyRange', 'x', 'b2x', 'lx', 'b2lx', 'str_money_value', 'ValidationError', 'COutPoint', 'CMutableOutPoint', 'CTxIn', 'CMutableTxIn', 'CTxOut', 'CMutableTxOut', 'CTransaction', 'CMutableTransaction', 'CTxWitness', 'CTxInWitness', 'CBlockHeader', 'CBlock', 'CoreChainParams', 'CoreMainParams', 'CoreTestNetParams', 'CoreRegTestParams', 'CheckTransactionError', 'CheckTransaction', 'CheckBlockHeaderError', 'CheckProofOfWorkError', 'CheckProofOfWork', 'CheckBlockHeader', 'CheckBlockError', 'GetLegacySigOpCount', 'CheckBlock', ) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/core/_bignum.py000066400000000000000000000041661430270607500254350ustar00rootroot00000000000000# Copyright (C) 2012-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. # Bignum routines # # Internally used for script evaluation; not to be used externally. import struct # generic big endian MPI format def bn_bytes(v, have_ext=False): ext = 0 if have_ext: ext = 1 return ((v.bit_length() + 7) // 8) + ext def bn2bin(v): s = bytearray() i = bn_bytes(v) while i > 0: s.append((v >> ((i - 1) * 8)) & 0xff) i -= 1 return s def bin2bn(s): l = 0 for ch in s: l = (l << 8) | ch return l def bn2mpi(v): have_ext = False if v.bit_length() > 0: have_ext = (v.bit_length() & 0x07) == 0 neg = False if v < 0: neg = True v = -v s = struct.pack(b">I", bn_bytes(v, have_ext)) ext = bytearray() if have_ext: ext.append(0) v_bin = bn2bin(v) if neg: if have_ext: ext[0] |= 0x80 else: v_bin[0] |= 0x80 return s + ext + v_bin def mpi2bn(s): if len(s) < 4: return None s_size = bytes(s[:4]) v_len = struct.unpack(b">I", s_size)[0] if len(s) != (v_len + 4): return None if v_len == 0: return 0 v_str = bytearray(s[4:]) neg = False i = v_str[0] if i & 0x80: neg = True i &= ~0x80 v_str[0] = i v = bin2bn(v_str) if neg: return -v return v # bitcoin-specific little endian format, with implicit size def mpi2vch(s): r = s[4:] # strip size r = r[::-1] # reverse string, converting BE->LE return r def bn2vch(v): return bytes(mpi2vch(bn2mpi(v))) def vch2mpi(s): r = struct.pack(b">I", len(s)) # size r += s[::-1] # reverse string, converting LE->BE return r def vch2bn(s): return mpi2bn(vch2mpi(s)) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/core/contrib/000077500000000000000000000000001430270607500250745ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/core/contrib/__init__.py000066400000000000000000000000001430270607500271730ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/core/contrib/ripemd160.py000066400000000000000000000077531430270607500271710ustar00rootroot00000000000000# Copyright (c) 2021 Pieter Wuille # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. """ Pure Python RIPEMD160 implementation. Note that this impelentation is not constant time. Original source: https://github.com/bitcoin/bitcoin/pull/23716 """ # Message schedule indexes for the left path. ML = [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 7, 4, 13, 1, 10, 6, 15, 3, 12, 0, 9, 5, 2, 14, 11, 8, 3, 10, 14, 4, 9, 15, 8, 1, 2, 7, 0, 6, 13, 11, 5, 12, 1, 9, 11, 10, 0, 8, 12, 4, 13, 3, 7, 15, 14, 5, 6, 2, 4, 0, 5, 9, 7, 12, 2, 10, 14, 1, 3, 8, 11, 6, 15, 13 ] # Message schedule indexes for the right path. MR = [ 5, 14, 7, 0, 9, 2, 11, 4, 13, 6, 15, 8, 1, 10, 3, 12, 6, 11, 3, 7, 0, 13, 5, 10, 14, 15, 8, 12, 4, 9, 1, 2, 15, 5, 1, 3, 7, 14, 6, 9, 11, 8, 12, 2, 10, 0, 4, 13, 8, 6, 4, 1, 3, 11, 15, 0, 5, 12, 2, 13, 9, 7, 10, 14, 12, 15, 10, 4, 1, 5, 8, 7, 6, 2, 13, 14, 0, 3, 9, 11 ] # Rotation counts for the left path. RL = [ 11, 14, 15, 12, 5, 8, 7, 9, 11, 13, 14, 15, 6, 7, 9, 8, 7, 6, 8, 13, 11, 9, 7, 15, 7, 12, 15, 9, 11, 7, 13, 12, 11, 13, 6, 7, 14, 9, 13, 15, 14, 8, 13, 6, 5, 12, 7, 5, 11, 12, 14, 15, 14, 15, 9, 8, 9, 14, 5, 6, 8, 6, 5, 12, 9, 15, 5, 11, 6, 8, 13, 12, 5, 12, 13, 14, 11, 8, 5, 6 ] # Rotation counts for the right path. RR = [ 8, 9, 9, 11, 13, 15, 15, 5, 7, 7, 8, 11, 14, 14, 12, 6, 9, 13, 15, 7, 12, 8, 9, 11, 7, 7, 12, 7, 6, 15, 13, 11, 9, 7, 15, 11, 8, 6, 6, 14, 12, 13, 5, 14, 13, 13, 7, 5, 15, 5, 8, 11, 14, 14, 6, 14, 6, 9, 12, 9, 12, 5, 15, 8, 8, 5, 12, 9, 12, 5, 14, 6, 8, 13, 6, 5, 15, 13, 11, 11 ] # K constants for the left path. KL = [0, 0x5a827999, 0x6ed9eba1, 0x8f1bbcdc, 0xa953fd4e] # K constants for the right path. KR = [0x50a28be6, 0x5c4dd124, 0x6d703ef3, 0x7a6d76e9, 0] def fi(x, y, z, i): """The f1, f2, f3, f4, and f5 functions from the specification.""" if i == 0: return x ^ y ^ z elif i == 1: return (x & y) | (~x & z) elif i == 2: return (x | ~y) ^ z elif i == 3: return (x & z) | (y & ~z) elif i == 4: return x ^ (y | ~z) else: assert False def rol(x, i): """Rotate the bottom 32 bits of x left by i bits.""" return ((x << i) | ((x & 0xffffffff) >> (32 - i))) & 0xffffffff def compress(h0, h1, h2, h3, h4, block): """Compress state (h0, h1, h2, h3, h4) with block.""" # Left path variables. al, bl, cl, dl, el = h0, h1, h2, h3, h4 # Right path variables. ar, br, cr, dr, er = h0, h1, h2, h3, h4 # Message variables. x = [int.from_bytes(block[4*i:4*(i+1)], 'little') for i in range(16)] # Iterate over the 80 rounds of the compression. for j in range(80): rnd = j >> 4 # Perform left side of the transformation. al = rol(al + fi(bl, cl, dl, rnd) + x[ML[j]] + KL[rnd], RL[j]) + el al, bl, cl, dl, el = el, al, bl, rol(cl, 10), dl # Perform right side of the transformation. ar = rol(ar + fi(br, cr, dr, 4 - rnd) + x[MR[j]] + KR[rnd], RR[j]) + er ar, br, cr, dr, er = er, ar, br, rol(cr, 10), dr # Compose old state, left transform, and right transform into new state. return h1 + cl + dr, h2 + dl + er, h3 + el + ar, h4 + al + br, h0 + bl + cr def ripemd160(data): """Compute the RIPEMD-160 hash of data.""" # Initialize state. state = (0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0) # Process full 64-byte blocks in the input. for b in range(len(data) >> 6): state = compress(*state, data[64*b:64*(b+1)]) # Construct final blocks (with padding and size). pad = b"\x80" + b"\x00" * ((119 - len(data)) & 63) fin = data[len(data) & ~63:] + pad + (8 * len(data)).to_bytes(8, 'little') # Process final blocks. for b in range(len(fin) >> 6): state = compress(*state, fin[64*b:64*(b+1)]) # Produce output. return b"".join((h & 0xffffffff).to_bytes(4, 'little') for h in state)python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/core/key.py000066400000000000000000000526421430270607500246070ustar00rootroot00000000000000# Copyright (C) 2011 Sam Rushing # Copyright (C) 2012-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """ECC secp256k1 crypto routines WARNING: This module does not mlock() secrets; your private keys may end up on disk in swap! Use with caution! """ import ctypes import ctypes.util import hashlib from os import urandom import bitcoin import bitcoin.signature import bitcoin.core.script _ssl = ctypes.cdll.LoadLibrary( ctypes.util.find_library('ssl.35') or ctypes.util.find_library('ssl') or 'libeay32' ) _libsecp256k1_path = ctypes.util.find_library('secp256k1') _libsecp256k1_enable_signing = False _libsecp256k1_context = None _libsecp256k1 = None class OpenSSLException(EnvironmentError): pass # Thx to Sam Devlin for the ctypes magic 64-bit fix (FIXME: should this # be applied to every OpenSSL call whose return type is a pointer?) def _check_res_void_p(val, func, args): # pylint: disable=unused-argument if val == 0: errno = _ssl.ERR_get_error() errmsg = ctypes.create_string_buffer(120) _ssl.ERR_error_string_n(errno, errmsg, 120) raise OpenSSLException(errno, str(errmsg.value)) return ctypes.c_void_p(val) _ssl.BN_add.restype = ctypes.c_int _ssl.BN_add.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] _ssl.BN_bin2bn.restype = ctypes.c_void_p _ssl.BN_bin2bn.argtypes = [ctypes.c_char_p, ctypes.c_int, ctypes.c_void_p] _ssl.BN_cmp.restype = ctypes.c_int _ssl.BN_cmp.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.BN_copy.restype = ctypes.c_void_p _ssl.BN_copy.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.BN_free.restype = None _ssl.BN_free.argtypes = [ctypes.c_void_p] _ssl.BN_mod_inverse.restype = ctypes.c_void_p _ssl.BN_mod_inverse.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] _ssl.BN_mod_mul.restype = ctypes.c_int _ssl.BN_mod_mul.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] _ssl.BN_mod_sub.restype = ctypes.c_int _ssl.BN_mod_sub.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] _ssl.BN_mul_word.restype = ctypes.c_int _ssl.BN_mul_word.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.BN_new.errcheck = _check_res_void_p _ssl.BN_new.restype = ctypes.c_void_p _ssl.BN_new.argtypes = [] _ssl.BN_rshift.restype = ctypes.c_int _ssl.BN_rshift.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int] _ssl.BN_rshift1.restype = ctypes.c_int _ssl.BN_rshift1.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.BN_sub.restype = ctypes.c_int _ssl.BN_sub.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] # _ssl.BN_zero.restype = ctypes.c_int # _ssl.BN_zero.argtypes = [ctypes.c_void_p] _ssl.BN_CTX_free.restype = None _ssl.BN_CTX_free.argtypes = [ctypes.c_void_p] _ssl.BN_CTX_get.restype = ctypes.c_void_p _ssl.BN_CTX_get.argtypes = [ctypes.c_void_p] _ssl.BN_CTX_new.errcheck = _check_res_void_p _ssl.BN_CTX_new.restype = ctypes.c_void_p _ssl.BN_CTX_new.argtypes = [] _ssl.EC_GROUP_get_curve_GFp.restype = ctypes.c_int _ssl.EC_GROUP_get_curve_GFp.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] _ssl.EC_GROUP_get_degree.restype = ctypes.c_int _ssl.EC_GROUP_get_degree.argtypes = [ctypes.c_void_p] _ssl.EC_GROUP_get_order.restype = ctypes.c_int _ssl.EC_GROUP_get_order.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] _ssl.EC_KEY_free.restype = None _ssl.EC_KEY_free.argtypes = [ctypes.c_void_p] _ssl.EC_KEY_new_by_curve_name.errcheck = _check_res_void_p _ssl.EC_KEY_new_by_curve_name.restype = ctypes.c_void_p _ssl.EC_KEY_new_by_curve_name.argtypes = [ctypes.c_int] _ssl.EC_KEY_get0_group.restype = ctypes.c_void_p _ssl.EC_KEY_get0_group.argtypes = [ctypes.c_void_p] _ssl.EC_KEY_get0_public_key.restype = ctypes.c_void_p _ssl.EC_KEY_get0_public_key.argtypes = [ctypes.c_void_p] _ssl.EC_KEY_set_conv_form.restype = None _ssl.EC_KEY_set_conv_form.argtypes = [ctypes.c_void_p, ctypes.c_int] _ssl.EC_KEY_set_private_key.restype = ctypes.c_int _ssl.EC_KEY_set_private_key.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.EC_KEY_set_public_key.restype = ctypes.c_int _ssl.EC_KEY_set_public_key.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.EC_POINT_free.restype = None _ssl.EC_POINT_free.argtypes = [ctypes.c_void_p] _ssl.EC_POINT_is_at_infinity.restype = ctypes.c_int _ssl.EC_POINT_is_at_infinity.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.EC_POINT_new.errcheck = _check_res_void_p _ssl.EC_POINT_new.restype = ctypes.c_void_p _ssl.EC_POINT_new.argtypes = [ctypes.c_void_p] _ssl.EC_POINT_mul.restype = ctypes.c_int _ssl.EC_POINT_mul.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] _ssl.EC_POINT_set_compressed_coordinates_GFp.restype = ctypes.c_int _ssl.EC_POINT_set_compressed_coordinates_GFp.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p] _ssl.ECDSA_sign.restype = ctypes.c_int _ssl.ECDSA_sign.argtypes = [ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p, ctypes.c_void_p] _ssl.ECDSA_size.restype = ctypes.c_int _ssl.ECDSA_size.argtypes = [ctypes.c_void_p] _ssl.ECDSA_verify.restype = ctypes.c_int _ssl.ECDSA_verify.argtypes = [ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p] _ssl.ECDSA_SIG_free.restype = None _ssl.ECDSA_SIG_free.argtypes = [ctypes.c_void_p] _ssl.ECDH_compute_key.restype = ctypes.c_int _ssl.ECDH_compute_key.argtypes = [ctypes.c_void_p, ctypes.c_int, ctypes.c_void_p, ctypes.c_void_p] _ssl.ERR_error_string_n.restype = None _ssl.ERR_error_string_n.argtypes = [ctypes.c_ulong, ctypes.c_char_p, ctypes.c_size_t] _ssl.ERR_get_error.restype = ctypes.c_ulong _ssl.ERR_get_error.argtypes = [] _ssl.d2i_ECDSA_SIG.restype = ctypes.c_void_p _ssl.d2i_ECDSA_SIG.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_long] _ssl.d2i_ECPrivateKey.restype = ctypes.c_void_p _ssl.d2i_ECPrivateKey.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_long] _ssl.i2d_ECDSA_SIG.restype = ctypes.c_int _ssl.i2d_ECDSA_SIG.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.i2d_ECPrivateKey.restype = ctypes.c_int _ssl.i2d_ECPrivateKey.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.i2o_ECPublicKey.restype = ctypes.c_void_p _ssl.i2o_ECPublicKey.argtypes = [ctypes.c_void_p, ctypes.c_void_p] _ssl.o2i_ECPublicKey.restype = ctypes.c_void_p _ssl.o2i_ECPublicKey.argtypes = [ctypes.c_void_p, ctypes.c_void_p, ctypes.c_long] _ssl.BN_num_bits.restype = ctypes.c_int _ssl.BN_num_bits.argtypes = [ctypes.c_void_p] _ssl.EC_KEY_get0_private_key.restype = ctypes.c_void_p # this specifies the curve used with ECDSA. _NID_secp256k1 = 714 # from openssl/obj_mac.h # test that OpenSSL supports secp256k1 _ssl.EC_KEY_new_by_curve_name(_NID_secp256k1) SECP256K1_FLAGS_TYPE_CONTEXT = (1 << 0) SECP256K1_FLAGS_BIT_CONTEXT_SIGN = (1 << 9) SECP256K1_CONTEXT_SIGN = \ (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN) def is_libsec256k1_available(): return _libsecp256k1_path is not None def use_libsecp256k1_for_signing(do_use): global _libsecp256k1 global _libsecp256k1_context global _libsecp256k1_enable_signing if not do_use: _libsecp256k1_enable_signing = False return if not is_libsec256k1_available(): raise ImportError("unable to locate libsecp256k1") if _libsecp256k1_context is None: _libsecp256k1 = ctypes.cdll.LoadLibrary(_libsecp256k1_path) _libsecp256k1.secp256k1_context_create.restype = ctypes.c_void_p _libsecp256k1.secp256k1_context_create.errcheck = _check_res_void_p _libsecp256k1.secp256k1_context_randomize.restype = ctypes.c_int _libsecp256k1.secp256k1_context_randomize.argtypes = [ctypes.c_void_p, ctypes.c_char_p] _libsecp256k1_context = _libsecp256k1.secp256k1_context_create(SECP256K1_CONTEXT_SIGN) assert(_libsecp256k1_context is not None) seed = urandom(32) result = _libsecp256k1.secp256k1_context_randomize(_libsecp256k1_context, seed) assert 1 == result _libsecp256k1_enable_signing = True # From openssl/ecdsa.h class ECDSA_SIG_st(ctypes.Structure): _fields_ = [("r", ctypes.c_void_p), ("s", ctypes.c_void_p)] class CECKey: """Wrapper around OpenSSL's EC_KEY""" POINT_CONVERSION_COMPRESSED = 2 POINT_CONVERSION_UNCOMPRESSED = 4 def __init__(self): self.k = _ssl.EC_KEY_new_by_curve_name(_NID_secp256k1) def __del__(self): if _ssl: _ssl.EC_KEY_free(self.k) self.k = None def set_secretbytes(self, secret): priv_key = _ssl.BN_bin2bn(secret, 32, None) group = _ssl.EC_KEY_get0_group(self.k) pub_key = _ssl.EC_POINT_new(group) ctx = _ssl.BN_CTX_new() if not _ssl.EC_POINT_mul(group, pub_key, priv_key, None, None, ctx): raise ValueError("Could not derive public key from the supplied secret.") _ssl.EC_KEY_set_private_key(self.k, priv_key) _ssl.EC_KEY_set_public_key(self.k, pub_key) _ssl.EC_POINT_free(pub_key) _ssl.BN_free(priv_key) _ssl.BN_CTX_free(ctx) return self.k def set_privkey(self, key): self.mb = ctypes.create_string_buffer(key) return _ssl.d2i_ECPrivateKey(ctypes.byref(self.k), ctypes.byref(ctypes.pointer(self.mb)), len(key)) def set_pubkey(self, key): self.mb = ctypes.create_string_buffer(key) return _ssl.o2i_ECPublicKey(ctypes.byref(self.k), ctypes.byref(ctypes.pointer(self.mb)), len(key)) def get_privkey(self): size = _ssl.i2d_ECPrivateKey(self.k, 0) mb_pri = ctypes.create_string_buffer(size) _ssl.i2d_ECPrivateKey(self.k, ctypes.byref(ctypes.pointer(mb_pri))) return mb_pri.raw def get_pubkey(self): size = _ssl.i2o_ECPublicKey(self.k, 0) mb = ctypes.create_string_buffer(size) _ssl.i2o_ECPublicKey(self.k, ctypes.byref(ctypes.pointer(mb))) return mb.raw def get_raw_ecdh_key(self, other_pubkey): ecdh_keybuffer = ctypes.create_string_buffer(32) r = _ssl.ECDH_compute_key(ctypes.pointer(ecdh_keybuffer), 32, _ssl.EC_KEY_get0_public_key(other_pubkey.k), self.k, 0) if r != 32: raise Exception('CKey.get_ecdh_key(): ECDH_compute_key() failed') return ecdh_keybuffer.raw def get_ecdh_key(self, other_pubkey, kdf=lambda k: hashlib.sha256(k).digest()): # FIXME: be warned it's not clear what the kdf should be as a default r = self.get_raw_ecdh_key(other_pubkey) return kdf(r) def get_raw_privkey(self): bn = _ssl.EC_KEY_get0_private_key(self.k) bn = ctypes.c_void_p(bn) size = (_ssl.BN_num_bits(bn) + 7) / 8 mb = ctypes.create_string_buffer(int(size)) _ssl.BN_bn2bin(bn, mb) return mb.raw.rjust(32, b'\x00') def _sign_with_libsecp256k1(self, hash): raw_sig = ctypes.create_string_buffer(64) result = _libsecp256k1.secp256k1_ecdsa_sign( _libsecp256k1_context, raw_sig, hash, self.get_raw_privkey(), None, None) assert 1 == result sig_size0 = ctypes.c_size_t() sig_size0.value = 75 mb_sig = ctypes.create_string_buffer(sig_size0.value) result = _libsecp256k1.secp256k1_ecdsa_signature_serialize_der( _libsecp256k1_context, mb_sig, ctypes.byref(sig_size0), raw_sig) assert 1 == result # libsecp256k1 creates signatures already in lower-S form, no further # conversion needed. return mb_sig.raw[:sig_size0.value] def sign(self, hash): # pylint: disable=redefined-builtin if not isinstance(hash, bytes): raise TypeError('Hash must be bytes instance; got %r' % hash.__class__) if len(hash) != 32: raise ValueError('Hash must be exactly 32 bytes long') if _libsecp256k1_enable_signing: return self._sign_with_libsecp256k1(hash) sig_size0 = ctypes.c_uint32() sig_size0.value = _ssl.ECDSA_size(self.k) mb_sig = ctypes.create_string_buffer(sig_size0.value) result = _ssl.ECDSA_sign(0, hash, len(hash), mb_sig, ctypes.byref(sig_size0), self.k) assert 1 == result if bitcoin.core.script.IsLowDERSignature(mb_sig.raw[:sig_size0.value]): return mb_sig.raw[:sig_size0.value] else: return self.signature_to_low_s(mb_sig.raw[:sig_size0.value]) def sign_compact(self, hash): # pylint: disable=redefined-builtin if not isinstance(hash, bytes): raise TypeError('Hash must be bytes instance; got %r' % hash.__class__) if len(hash) != 32: raise ValueError('Hash must be exactly 32 bytes long') sig_size0 = ctypes.c_uint32() sig_size0.value = _ssl.ECDSA_size(self.k) mb_sig = ctypes.create_string_buffer(sig_size0.value) result = _ssl.ECDSA_sign(0, hash, len(hash), mb_sig, ctypes.byref(sig_size0), self.k) assert 1 == result if bitcoin.core.script.IsLowDERSignature(mb_sig.raw[:sig_size0.value]): sig = mb_sig.raw[:sig_size0.value] else: sig = self.signature_to_low_s(mb_sig.raw[:sig_size0.value]) sig = bitcoin.signature.DERSignature.deserialize(sig) r_val = sig.r s_val = sig.s # assert that the r and s are less than 32 long, excluding leading 0s assert len(r_val) <= 32 or r_val[0:-32] == b'\x00' assert len(s_val) <= 32 or s_val[0:-32] == b'\x00' # ensure r and s are always 32 chars long by 0padding r_val = ((b'\x00' * 32) + r_val)[-32:] s_val = ((b'\x00' * 32) + s_val)[-32:] # tmp pubkey of self, but always compressed pubkey = CECKey() pubkey.set_pubkey(self.get_pubkey()) pubkey.set_compressed(True) # bitcoin core does <4, but I've seen other places do <2 and I've never seen a i > 1 so far for i in range(0, 4): cec_key = CECKey() cec_key.set_compressed(True) result = cec_key.recover(r_val, s_val, hash, len(hash), i, 1) if result == 1: if cec_key.get_pubkey() == pubkey.get_pubkey(): return r_val + s_val, i raise ValueError def signature_to_low_s(self, sig): der_sig = ECDSA_SIG_st() _ssl.d2i_ECDSA_SIG(ctypes.byref(ctypes.pointer(der_sig)), ctypes.byref(ctypes.c_char_p(sig)), len(sig)) group = _ssl.EC_KEY_get0_group(self.k) order = _ssl.BN_new() halforder = _ssl.BN_new() ctx = _ssl.BN_CTX_new() _ssl.EC_GROUP_get_order(group, order, ctx) _ssl.BN_rshift1(halforder, order) # Verify that s is over half the order of the curve before we actually subtract anything from it if _ssl.BN_cmp(der_sig.s, halforder) > 0: _ssl.BN_sub(der_sig.s, order, der_sig.s) _ssl.BN_free(halforder) _ssl.BN_free(order) _ssl.BN_CTX_free(ctx) derlen = _ssl.i2d_ECDSA_SIG(ctypes.pointer(der_sig), 0) if derlen == 0: _ssl.ECDSA_SIG_free(der_sig) return None new_sig = ctypes.create_string_buffer(derlen) _ssl.i2d_ECDSA_SIG(ctypes.pointer(der_sig), ctypes.byref(ctypes.pointer(new_sig))) _ssl.BN_free(der_sig.r) _ssl.BN_free(der_sig.s) return new_sig.raw def verify(self, hash, sig): # pylint: disable=redefined-builtin """Verify a DER signature""" if not sig: return False # New versions of OpenSSL will reject non-canonical DER signatures. de/re-serialize first. norm_sig = ctypes.c_void_p(0) _ssl.d2i_ECDSA_SIG(ctypes.byref(norm_sig), ctypes.byref(ctypes.c_char_p(sig)), len(sig)) derlen = _ssl.i2d_ECDSA_SIG(norm_sig, 0) if derlen == 0: _ssl.ECDSA_SIG_free(norm_sig) return False norm_der = ctypes.create_string_buffer(derlen) _ssl.i2d_ECDSA_SIG(norm_sig, ctypes.byref(ctypes.pointer(norm_der))) _ssl.ECDSA_SIG_free(norm_sig) # -1 = error, 0 = bad sig, 1 = good return _ssl.ECDSA_verify(0, hash, len(hash), norm_der, derlen, self.k) == 1 def set_compressed(self, compressed): if compressed: form = self.POINT_CONVERSION_COMPRESSED else: form = self.POINT_CONVERSION_UNCOMPRESSED _ssl.EC_KEY_set_conv_form(self.k, form) def recover(self, sigR, sigS, msg, msglen, recid, check): """ Perform ECDSA key recovery (see SEC1 4.1.6) for curves over (mod p)-fields recid selects which key is recovered if check is non-zero, additional checks are performed """ i = int(recid / 2) r = None s = None ctx = None R = None O = None Q = None assert len(sigR) == 32, len(sigR) assert len(sigS) == 32, len(sigS) try: r = _ssl.BN_bin2bn(bytes(sigR), len(sigR), _ssl.BN_new()) s = _ssl.BN_bin2bn(bytes( sigS), len(sigS), _ssl.BN_new()) group = _ssl.EC_KEY_get0_group(self.k) ctx = _ssl.BN_CTX_new() order = _ssl.BN_CTX_get(ctx) ctx = _ssl.BN_CTX_new() if not _ssl.EC_GROUP_get_order(group, order, ctx): return -2 x = _ssl.BN_CTX_get(ctx) if not _ssl.BN_copy(x, order): return -1 if not _ssl.BN_mul_word(x, i): return -1 if not _ssl.BN_add(x, x, r): return -1 field = _ssl.BN_CTX_get(ctx) if not _ssl.EC_GROUP_get_curve_GFp(group, field, None, None, ctx): return -2 if _ssl.BN_cmp(x, field) >= 0: return 0 R = _ssl.EC_POINT_new(group) if R is None: return -2 if not _ssl.EC_POINT_set_compressed_coordinates_GFp(group, R, x, recid % 2, ctx): return 0 if check: O = _ssl.EC_POINT_new(group) if O is None: return -2 if not _ssl.EC_POINT_mul(group, O, None, R, order, ctx): return -2 if not _ssl.EC_POINT_is_at_infinity(group, O): return 0 Q = _ssl.EC_POINT_new(group) if Q is None: return -2 n = _ssl.EC_GROUP_get_degree(group) e = _ssl.BN_CTX_get(ctx) if not _ssl.BN_bin2bn(msg, msglen, e): return -1 if 8 * msglen > n: _ssl.BN_rshift(e, e, 8 - (n & 7)) zero = _ssl.BN_CTX_get(ctx) # if not _ssl.BN_zero(zero): # return -1 if not _ssl.BN_mod_sub(e, zero, e, order, ctx): return -1 rr = _ssl.BN_CTX_get(ctx) if not _ssl.BN_mod_inverse(rr, r, order, ctx): return -1 sor = _ssl.BN_CTX_get(ctx) if not _ssl.BN_mod_mul(sor, s, rr, order, ctx): return -1 eor = _ssl.BN_CTX_get(ctx) if not _ssl.BN_mod_mul(eor, e, rr, order, ctx): return -1 if not _ssl.EC_POINT_mul(group, Q, eor, R, sor, ctx): return -2 if not _ssl.EC_KEY_set_public_key(self.k, Q): return -2 return 1 finally: if r: _ssl.BN_free(r) if s: _ssl.BN_free(s) if ctx: _ssl.BN_CTX_free(ctx) if R: _ssl.EC_POINT_free(R) if O: _ssl.EC_POINT_free(O) if Q: _ssl.EC_POINT_free(Q) class CPubKey(bytes): """An encapsulated public key Attributes: is_valid - Corresponds to CPubKey.IsValid() is_fullyvalid - Corresponds to CPubKey.IsFullyValid() is_compressed - Corresponds to CPubKey.IsCompressed() """ def __new__(cls, buf, _cec_key=None): self = super(CPubKey, cls).__new__(cls, buf) if _cec_key is None: _cec_key = CECKey() self._cec_key = _cec_key self.is_fullyvalid = _cec_key.set_pubkey(self) is not None return self @classmethod def recover_compact(cls, hash, sig): # pylint: disable=redefined-builtin """Recover a public key from a compact signature.""" if len(sig) != 65: raise ValueError("Signature should be 65 characters, not [%d]" % (len(sig), )) recid = (sig[0] - 27) & 3 compressed = (sig[0] - 27) & 4 != 0 cec_key = CECKey() cec_key.set_compressed(compressed) sigR = sig[1:33] sigS = sig[33:65] result = cec_key.recover(sigR, sigS, hash, len(hash), recid, 0) if result < 1: return False pubkey = cec_key.get_pubkey() return CPubKey(pubkey, _cec_key=cec_key) @property def is_valid(self): return len(self) > 0 @property def is_compressed(self): return len(self) == 33 def verify(self, hash, sig): # pylint: disable=redefined-builtin return self._cec_key.verify(hash, sig) def __str__(self): return repr(self) def __repr__(self): return '%s(%s)' % (self.__class__.__name__, super(CPubKey, self).__repr__()) __all__ = ( 'CECKey', 'CPubKey', ) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/core/script.py000066400000000000000000001036761430270607500253270ustar00rootroot00000000000000# Copyright (C) 2012-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Scripts Functionality to build scripts, as well as SignatureHash(). Script evaluation is in bitcoin.core.scripteval """ from io import BytesIO import struct import bitcoin.core import bitcoin.core._bignum from .serialize import * MAX_SCRIPT_SIZE = 10000 MAX_SCRIPT_ELEMENT_SIZE = 520 MAX_SCRIPT_OPCODES = 201 OPCODE_NAMES = {} _opcode_instances = [] class CScriptOp(int): """A single script opcode""" __slots__ = [] @staticmethod def encode_op_pushdata(d): """Encode a PUSHDATA op, returning bytes""" if len(d) < 0x4c: return bytes([len(d)]) + d # OP_PUSHDATA elif len(d) <= 0xff: return b'\x4c' + bytes([len(d)]) + d # OP_PUSHDATA1 elif len(d) <= 0xffff: return b'\x4d' + struct.pack(b' OP_PUSHDATA4: yield (opcode, None, sop_idx) else: datasize = None pushdata_type = None if opcode < OP_PUSHDATA1: pushdata_type = 'PUSHDATA(%d)' % opcode datasize = opcode elif opcode == OP_PUSHDATA1: pushdata_type = 'PUSHDATA1' if i >= len(self): raise CScriptInvalidError('PUSHDATA1: missing data length') datasize = self[i] i += 1 elif opcode == OP_PUSHDATA2: pushdata_type = 'PUSHDATA2' if i + 1 >= len(self): raise CScriptInvalidError('PUSHDATA2: missing data length') datasize = self[i] + (self[i+1] << 8) i += 2 elif opcode == OP_PUSHDATA4: pushdata_type = 'PUSHDATA4' if i + 3 >= len(self): raise CScriptInvalidError('PUSHDATA4: missing data length') datasize = self[i] + (self[i+1] << 8) + (self[i+2] << 16) + (self[i+3] << 24) i += 4 else: assert False # shouldn't happen data = bytes(self[i:i+datasize]) # Check for truncation if len(data) < datasize: raise CScriptTruncatedPushDataError('%s: truncated data' % pushdata_type, data) i += datasize yield (opcode, data, sop_idx) def __iter__(self): """'Cooked' iteration Returns either a CScriptOP instance, an integer, or bytes, as appropriate. See raw_iter() if you need to distinguish the different possible PUSHDATA encodings. """ for (opcode, data, sop_idx) in self.raw_iter(): if opcode == 0: yield 0 elif data is not None: yield data else: opcode = CScriptOp(opcode) if opcode.is_small_int(): yield opcode.decode_op_n() else: yield CScriptOp(opcode) def __repr__(self): # For Python3 compatibility add b before strings so testcases don't # need to change def _repr(o): if isinstance(o, bytes): return "x('%s')" % bitcoin.core.b2x(o) else: return repr(o) ops = [] i = iter(self) while True: op = None try: op = _repr(next(i)) except CScriptTruncatedPushDataError as err: op = '%s...' % (_repr(err.data), err) break except CScriptInvalidError as err: op = '' % err break except StopIteration: break finally: if op is not None: ops.append(op) return "CScript([%s])" % ', '.join(ops) def is_p2sh(self): """Test if the script is a p2sh scriptPubKey Note that this test is consensus-critical. """ return (len(self) == 23 and self[0] == OP_HASH160 and self[1] == 0x14 and self[22] == OP_EQUAL) def is_witness_scriptpubkey(self): """Returns true if this is a scriptpubkey signaling segregated witness data. A witness program is any valid CScript that consists of a 1-byte push opcode followed by a data push between 2 and 40 bytes. """ size = len(self) if size < 4 or size > 42: return False head = struct.unpack(' OP_16: return False except CScriptInvalidError: return False return True def has_canonical_pushes(self): """Test if script only uses canonical pushes Not yet consensus critical; may be in the future. """ try: for (op, data, idx) in self.raw_iter(): if op > OP_16: continue elif op < OP_PUSHDATA1 and op > OP_0 and len(data) == 1 and data[0] <= 16: # Could have used an OP_n code, rather than a 1-byte push. return False elif op == OP_PUSHDATA1 and len(data) < OP_PUSHDATA1: # Could have used a normal n-byte push, rather than OP_PUSHDATA1. return False elif op == OP_PUSHDATA2 and len(data) <= 0xFF: # Could have used a OP_PUSHDATA1. return False elif op == OP_PUSHDATA4 and len(data) <= 0xFFFF: # Could have used a OP_PUSHDATA2. return False except CScriptInvalidError: # Invalid pushdata return False return True def is_unspendable(self): """Test if the script is provably unspendable""" return (len(self) > 0 and self[0] == OP_RETURN) def is_valid(self): """Return True if the script is valid, False otherwise The script is valid if all PUSHDATA's are valid; invalid opcodes do not make is_valid() return False. """ try: list(self) except CScriptInvalidError: return False return True def to_p2sh_scriptPubKey(self, checksize=True): """Create P2SH scriptPubKey from this redeemScript That is, create the P2SH scriptPubKey that requires this script as a redeemScript to spend. checksize - Check if the redeemScript is larger than the 520-byte max pushdata limit; raise ValueError if limit exceeded. Since a >520-byte PUSHDATA makes EvalScript() fail, it's not actually possible to redeem P2SH outputs with redeem scripts >520 bytes. """ if checksize and len(self) > MAX_SCRIPT_ELEMENT_SIZE: raise ValueError("redeemScript exceeds max allowed size; P2SH output would be unspendable") return CScript([OP_HASH160, bitcoin.core.Hash160(self), OP_EQUAL]) def GetSigOpCount(self, fAccurate): """Get the SigOp count. fAccurate - Accurately count CHECKMULTISIG, see BIP16 for details. Note that this is consensus-critical. """ n = 0 lastOpcode = OP_INVALIDOPCODE for (opcode, data, sop_idx) in self.raw_iter(): if opcode in (OP_CHECKSIG, OP_CHECKSIGVERIFY): n += 1 elif opcode in (OP_CHECKMULTISIG, OP_CHECKMULTISIGVERIFY): if fAccurate and (OP_1 <= lastOpcode <= OP_16): n += opcode.decode_op_n() else: n += 20 lastOpcode = opcode return n class CScriptWitness(ImmutableSerializable): """An encoding of the data elements on the initial stack for (segregated witness) """ __slots__ = ['stack'] def __init__(self, stack=()): object.__setattr__(self, 'stack', stack) def __len__(self): return len(self.stack) def __iter__(self): return iter(self.stack) def __repr__(self): return 'CScriptWitness(' + ','.join("x('%s')" % bitcoin.core.b2x(s) for s in self.stack) + ')' def is_null(self): return len(self.stack) == 0 @classmethod def stream_deserialize(cls, f): n = VarIntSerializer.stream_deserialize(f) stack = tuple(BytesSerializer.stream_deserialize(f) for i in range(n)) return cls(stack) def stream_serialize(self, f): VarIntSerializer.stream_serialize(len(self.stack), f) for s in self.stack: BytesSerializer.stream_serialize(s, f) SIGHASH_ALL = 1 SIGHASH_NONE = 2 SIGHASH_SINGLE = 3 SIGHASH_ANYONECANPAY = 0x80 def FindAndDelete(script, sig): """Consensus critical, see FindAndDelete() in Satoshi codebase""" r = b'' last_sop_idx = sop_idx = 0 skip = True for (opcode, data, sop_idx) in script.raw_iter(): if not skip: r += script[last_sop_idx:sop_idx] last_sop_idx = sop_idx if script[sop_idx:sop_idx + len(sig)] == sig: skip = True else: skip = False if not skip: r += script[last_sop_idx:] return CScript(r) def IsLowDERSignature(sig): """ Loosely correlates with IsLowDERSignature() from script/interpreter.cpp Verifies that the S value in a DER signature is the lowest possible value. Used by BIP62 malleability fixes. """ length_r = sig[3] if isinstance(length_r, str): length_r = int(struct.unpack('B', length_r)[0]) length_s = sig[5 + length_r] if isinstance(length_s, str): length_s = int(struct.unpack('B', length_s)[0]) s_val = list(struct.unpack(str(length_s) + 'B', sig[6 + length_r:6 + length_r + length_s])) # If the S value is above the order of the curve divided by two, its # complement modulo the order could have been used instead, which is # one byte shorter when encoded correctly. max_mod_half_order = [ 0x7f,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff, 0x5d,0x57,0x6e,0x73,0x57,0xa4,0x50,0x1d, 0xdf,0xe9,0x2f,0x46,0x68,0x1b,0x20,0xa0] return CompareBigEndian(s_val, [0]) > 0 and \ CompareBigEndian(s_val, max_mod_half_order) <= 0 def CompareBigEndian(c1, c2): """ Loosely matches CompareBigEndian() from eccryptoverify.cpp Compares two arrays of bytes, and returns a negative value if the first is less than the second, 0 if they're equal, and a positive value if the first is greater than the second. """ c1 = list(c1) c2 = list(c2) # Adjust starting positions until remaining lengths of the two arrays match while len(c1) > len(c2): if c1.pop(0) > 0: return 1 while len(c2) > len(c1): if c2.pop(0) > 0: return -1 while len(c1) > 0: diff = c1.pop(0) - c2.pop(0) if diff != 0: return diff return 0 def RawSignatureHash(script, txTo, inIdx, hashtype): """Consensus-correct SignatureHash Returns (hash, err) to precisely match the consensus-critical behavior of the SIGHASH_SINGLE bug. (inIdx is *not* checked for validity) If you're just writing wallet software you probably want SignatureHash() instead. """ HASH_ONE = b'\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' if inIdx >= len(txTo.vin): return (HASH_ONE, "inIdx %d out of range (%d)" % (inIdx, len(txTo.vin))) txtmp = bitcoin.core.CMutableTransaction.from_tx(txTo) for txin in txtmp.vin: txin.scriptSig = b'' txtmp.vin[inIdx].scriptSig = FindAndDelete(script, CScript([OP_CODESEPARATOR])) if (hashtype & 0x1f) == SIGHASH_NONE: txtmp.vout = [] for i in range(len(txtmp.vin)): if i != inIdx: txtmp.vin[i].nSequence = 0 elif (hashtype & 0x1f) == SIGHASH_SINGLE: outIdx = inIdx if outIdx >= len(txtmp.vout): return (HASH_ONE, "outIdx %d out of range (%d)" % (outIdx, len(txtmp.vout))) tmp = txtmp.vout[outIdx] txtmp.vout = [] for i in range(outIdx): txtmp.vout.append(bitcoin.core.CTxOut()) txtmp.vout.append(tmp) for i in range(len(txtmp.vin)): if i != inIdx: txtmp.vin[i].nSequence = 0 if hashtype & SIGHASH_ANYONECANPAY: tmp = txtmp.vin[inIdx] txtmp.vin = [] txtmp.vin.append(tmp) txtmp.wit = bitcoin.core.CTxWitness() s = txtmp.serialize() s += struct.pack(b" MAX_NUM_SIZE: raise err_raiser(EvalScriptError, 'CastToBigNum() : overflow') return v def _CastToBool(s): for i in range(len(s)): sv = s[i] if sv != 0: if (i == (len(s) - 1)) and (sv == 0x80): return False return True return False def _CheckSig(sig, pubkey, script, txTo, inIdx, err_raiser): key = bitcoin.core.key.CECKey() key.set_pubkey(pubkey) if len(sig) == 0: return False hashtype = sig[-1] sig = sig[:-1] # Raw signature hash due to the SIGHASH_SINGLE bug # # Note that we never raise an exception if RawSignatureHash() returns an # error code. However the first error code case, where inIdx >= # len(txTo.vin), shouldn't ever happen during EvalScript() as that would # imply the scriptSig being checked doesn't correspond to a valid txout - # that should cause other validation machinery to fail long before we ever # got here. (h, err) = RawSignatureHash(script, txTo, inIdx, hashtype) return key.verify(h, sig) def _CheckMultiSig(opcode, script, stack, txTo, inIdx, flags, err_raiser, nOpCount): i = 1 if len(stack) < i: err_raiser(MissingOpArgumentsError, opcode, stack, i) keys_count = _CastToBigNum(stack[-i], err_raiser) if keys_count < 0 or keys_count > 20: err_raiser(ArgumentsInvalidError, opcode, "keys count invalid") i += 1 ikey = i i += keys_count nOpCount[0] += keys_count if nOpCount[0] > MAX_SCRIPT_OPCODES: err_raiser(MaxOpCountError) if len(stack) < i: err_raiser(ArgumentsInvalidError, opcode, "not enough keys on stack") sigs_count = _CastToBigNum(stack[-i], err_raiser) if sigs_count < 0 or sigs_count > keys_count: err_raiser(ArgumentsInvalidError, opcode, "sigs count invalid") i += 1 isig = i i += sigs_count if len(stack) < i-1: raise err_raiser(ArgumentsInvalidError, opcode, "not enough sigs on stack") elif len(stack) < i: raise err_raiser(ArgumentsInvalidError, opcode, "missing dummy value") # Drop the signature, since there's no way for a signature to sign itself # # Of course, this can only come up in very contrived cases now that # scriptSig and scriptPubKey are processed separately. for k in range(sigs_count): sig = stack[-isig - k] script = FindAndDelete(script, CScript([sig])) success = True while success and sigs_count > 0: sig = stack[-isig] pubkey = stack[-ikey] if _CheckSig(sig, pubkey, script, txTo, inIdx, err_raiser): isig += 1 sigs_count -= 1 ikey += 1 keys_count -= 1 if sigs_count > keys_count: success = False # with VERIFY bail now before we modify the stack if opcode == OP_CHECKMULTISIGVERIFY: err_raiser(VerifyOpFailedError, opcode) while i > 1: stack.pop() i -= 1 # Note how Bitcoin Core duplicates the len(stack) check, rather than # letting pop() handle it; maybe that's wrong? if len(stack) and SCRIPT_VERIFY_NULLDUMMY in flags: if stack[-1] != b'': raise err_raiser(ArgumentsInvalidError, opcode, "dummy value not OP_0") stack.pop() if opcode == OP_CHECKMULTISIG: if success: stack.append(b"\x01") else: # FIXME: this is incorrect, but not caught by existing # test cases stack.append(b"\x00") # OP_2MUL and OP_2DIV are *not* included in this list as they are disabled _ISA_UNOP = { OP_1ADD, OP_1SUB, OP_NEGATE, OP_ABS, OP_NOT, OP_0NOTEQUAL, } def _UnaryOp(opcode, stack, err_raiser): if len(stack) < 1: err_raiser(MissingOpArgumentsError, opcode, stack, 1) bn = _CastToBigNum(stack[-1], err_raiser) stack.pop() if opcode == OP_1ADD: bn += 1 elif opcode == OP_1SUB: bn -= 1 elif opcode == OP_NEGATE: bn = -bn elif opcode == OP_ABS: if bn < 0: bn = -bn elif opcode == OP_NOT: bn = int(bn == 0) elif opcode == OP_0NOTEQUAL: bn = int(bn != 0) else: raise AssertionError("Unknown unary opcode encountered; this should not happen") stack.append(bitcoin.core._bignum.bn2vch(bn)) # OP_LSHIFT and OP_RSHIFT are *not* included in this list as they are disabled _ISA_BINOP = { OP_ADD, OP_SUB, OP_BOOLAND, OP_BOOLOR, OP_NUMEQUAL, OP_NUMEQUALVERIFY, OP_NUMNOTEQUAL, OP_LESSTHAN, OP_GREATERTHAN, OP_LESSTHANOREQUAL, OP_GREATERTHANOREQUAL, OP_MIN, OP_MAX, } def _BinOp(opcode, stack, err_raiser): if len(stack) < 2: err_raiser(MissingOpArgumentsError, opcode, stack, 2) bn2 = _CastToBigNum(stack[-1], err_raiser) bn1 = _CastToBigNum(stack[-2], err_raiser) # We don't pop the stack yet so that OP_NUMEQUALVERIFY can raise # VerifyOpFailedError with a correct stack. if opcode == OP_ADD: bn = bn1 + bn2 elif opcode == OP_SUB: bn = bn1 - bn2 elif opcode == OP_BOOLAND: bn = int(bn1 != 0 and bn2 != 0) elif opcode == OP_BOOLOR: bn = int(bn1 != 0 or bn2 != 0) elif opcode == OP_NUMEQUAL: bn = int(bn1 == bn2) elif opcode == OP_NUMEQUALVERIFY: bn = int(bn1 == bn2) if not bn: err_raiser(VerifyOpFailedError, opcode) else: # No exception, so time to pop the stack stack.pop() stack.pop() return elif opcode == OP_NUMNOTEQUAL: bn = int(bn1 != bn2) elif opcode == OP_LESSTHAN: bn = int(bn1 < bn2) elif opcode == OP_GREATERTHAN: bn = int(bn1 > bn2) elif opcode == OP_LESSTHANOREQUAL: bn = int(bn1 <= bn2) elif opcode == OP_GREATERTHANOREQUAL: bn = int(bn1 >= bn2) elif opcode == OP_MIN: if bn1 < bn2: bn = bn1 else: bn = bn2 elif opcode == OP_MAX: if bn1 > bn2: bn = bn1 else: bn = bn2 else: raise AssertionError("Unknown binop opcode encountered; this should not happen") stack.pop() stack.pop() stack.append(bitcoin.core._bignum.bn2vch(bn)) def _CheckExec(vfExec): for b in vfExec: if not b: return False return True def _EvalScript(stack, scriptIn, txTo, inIdx, flags=()): """Evaluate a script """ if len(scriptIn) > MAX_SCRIPT_SIZE: raise EvalScriptError('script too large; got %d bytes; maximum %d bytes' % (len(scriptIn), MAX_SCRIPT_SIZE), stack=stack, scriptIn=scriptIn, txTo=txTo, inIdx=inIdx, flags=flags) altstack = [] vfExec = [] pbegincodehash = 0 nOpCount = [0] for (sop, sop_data, sop_pc) in scriptIn.raw_iter(): fExec = _CheckExec(vfExec) def err_raiser(cls, *args): """Helper function for raising EvalScriptError exceptions cls - subclass you want to raise *args - arguments Fills in the state of execution for you. """ raise cls(*args, sop=sop, sop_data=sop_data, sop_pc=sop_pc, stack=stack, scriptIn=scriptIn, txTo=txTo, inIdx=inIdx, flags=flags, altstack=altstack, vfExec=vfExec, pbegincodehash=pbegincodehash, nOpCount=nOpCount[0]) if sop in DISABLED_OPCODES: err_raiser(EvalScriptError, 'opcode %s is disabled' % OPCODE_NAMES[sop]) if sop > OP_16: nOpCount[0] += 1 if nOpCount[0] > MAX_SCRIPT_OPCODES: err_raiser(MaxOpCountError) def check_args(n): if len(stack) < n: err_raiser(MissingOpArgumentsError, sop, stack, n) if sop <= OP_PUSHDATA4: if len(sop_data) > MAX_SCRIPT_ELEMENT_SIZE: err_raiser(EvalScriptError, 'PUSHDATA of length %d; maximum allowed is %d' % (len(sop_data), MAX_SCRIPT_ELEMENT_SIZE)) elif fExec: stack.append(sop_data) continue elif fExec or (OP_IF <= sop <= OP_ENDIF): if sop == OP_1NEGATE or ((sop >= OP_1) and (sop <= OP_16)): v = sop - (OP_1 - 1) stack.append(bitcoin.core._bignum.bn2vch(v)) elif sop in _ISA_BINOP: _BinOp(sop, stack, err_raiser) elif sop in _ISA_UNOP: _UnaryOp(sop, stack, err_raiser) elif sop == OP_2DROP: check_args(2) stack.pop() stack.pop() elif sop == OP_2DUP: check_args(2) v1 = stack[-2] v2 = stack[-1] stack.append(v1) stack.append(v2) elif sop == OP_2OVER: check_args(4) v1 = stack[-4] v2 = stack[-3] stack.append(v1) stack.append(v2) elif sop == OP_2ROT: check_args(6) v1 = stack[-6] v2 = stack[-5] del stack[-6] del stack[-5] stack.append(v1) stack.append(v2) elif sop == OP_2SWAP: check_args(4) tmp = stack[-4] stack[-4] = stack[-2] stack[-2] = tmp tmp = stack[-3] stack[-3] = stack[-1] stack[-1] = tmp elif sop == OP_3DUP: check_args(3) v1 = stack[-3] v2 = stack[-2] v3 = stack[-1] stack.append(v1) stack.append(v2) stack.append(v3) elif sop == OP_CHECKMULTISIG or sop == OP_CHECKMULTISIGVERIFY: tmpScript = CScript(scriptIn[pbegincodehash:]) _CheckMultiSig(sop, tmpScript, stack, txTo, inIdx, flags, err_raiser, nOpCount) elif sop == OP_CHECKSIG or sop == OP_CHECKSIGVERIFY: check_args(2) vchPubKey = stack[-1] vchSig = stack[-2] tmpScript = CScript(scriptIn[pbegincodehash:]) # Drop the signature, since there's no way for a signature to sign itself # # Of course, this can only come up in very contrived cases now that # scriptSig and scriptPubKey are processed separately. tmpScript = FindAndDelete(tmpScript, CScript([vchSig])) ok = _CheckSig(vchSig, vchPubKey, tmpScript, txTo, inIdx, err_raiser) if not ok and sop == OP_CHECKSIGVERIFY: err_raiser(VerifyOpFailedError, sop) else: stack.pop() stack.pop() if ok: if sop != OP_CHECKSIGVERIFY: stack.append(b"\x01") else: # FIXME: this is incorrect, but not caught by existing # test cases stack.append(b"\x00") elif sop == OP_CODESEPARATOR: pbegincodehash = sop_pc elif sop == OP_DEPTH: bn = len(stack) stack.append(bitcoin.core._bignum.bn2vch(bn)) elif sop == OP_DROP: check_args(1) stack.pop() elif sop == OP_DUP: check_args(1) v = stack[-1] stack.append(v) elif sop == OP_ELSE: if len(vfExec) == 0: err_raiser(EvalScriptError, 'ELSE found without prior IF') vfExec[-1] = not vfExec[-1] elif sop == OP_ENDIF: if len(vfExec) == 0: err_raiser(EvalScriptError, 'ENDIF found without prior IF') vfExec.pop() elif sop == OP_EQUAL: check_args(2) v1 = stack.pop() v2 = stack.pop() if v1 == v2: stack.append(b"\x01") else: stack.append(b"") elif sop == OP_EQUALVERIFY: check_args(2) v1 = stack[-1] v2 = stack[-2] if v1 == v2: stack.pop() stack.pop() else: err_raiser(VerifyOpFailedError, sop) elif sop == OP_FROMALTSTACK: if len(altstack) < 1: err_raiser(MissingOpArgumentsError, sop, altstack, 1) v = altstack.pop() stack.append(v) elif sop == OP_HASH160: check_args(1) stack.append(bitcoin.core.serialize.Hash160(stack.pop())) elif sop == OP_HASH256: check_args(1) stack.append(bitcoin.core.serialize.Hash(stack.pop())) elif sop == OP_IF or sop == OP_NOTIF: val = False if fExec: check_args(1) vch = stack.pop() val = _CastToBool(vch) if sop == OP_NOTIF: val = not val vfExec.append(val) elif sop == OP_IFDUP: check_args(1) vch = stack[-1] if _CastToBool(vch): stack.append(vch) elif sop == OP_NIP: check_args(2) del stack[-2] elif sop == OP_NOP: pass elif sop >= OP_NOP1 and sop <= OP_NOP10: if SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS in flags: err_raiser(EvalScriptError, "%s reserved for soft-fork upgrades" % OPCODE_NAMES[sop]) else: pass elif sop == OP_OVER: check_args(2) vch = stack[-2] stack.append(vch) elif sop == OP_PICK or sop == OP_ROLL: check_args(2) n = _CastToBigNum(stack.pop(), err_raiser) if n < 0 or n >= len(stack): err_raiser(EvalScriptError, "Argument for %s out of bounds" % OPCODE_NAMES[sop]) vch = stack[-n-1] if sop == OP_ROLL: del stack[-n-1] stack.append(vch) elif sop == OP_RETURN: err_raiser(EvalScriptError, "OP_RETURN called") elif sop == OP_RIPEMD160: check_args(1) stack.append(ripemd160(stack.pop())) elif sop == OP_ROT: check_args(3) tmp = stack[-3] stack[-3] = stack[-2] stack[-2] = tmp tmp = stack[-2] stack[-2] = stack[-1] stack[-1] = tmp elif sop == OP_SIZE: check_args(1) bn = len(stack[-1]) stack.append(bitcoin.core._bignum.bn2vch(bn)) elif sop == OP_SHA1: check_args(1) stack.append(hashlib.sha1(stack.pop()).digest()) elif sop == OP_SHA256: check_args(1) stack.append(hashlib.sha256(stack.pop()).digest()) elif sop == OP_SWAP: check_args(2) tmp = stack[-2] stack[-2] = stack[-1] stack[-1] = tmp elif sop == OP_TOALTSTACK: check_args(1) v = stack.pop() altstack.append(v) elif sop == OP_TUCK: check_args(2) vch = stack[-1] stack.insert(len(stack) - 2, vch) elif sop == OP_VERIFY: check_args(1) v = _CastToBool(stack[-1]) if v: stack.pop() else: raise err_raiser(VerifyOpFailedError, sop) elif sop == OP_WITHIN: check_args(3) bn3 = _CastToBigNum(stack[-1], err_raiser) bn2 = _CastToBigNum(stack[-2], err_raiser) bn1 = _CastToBigNum(stack[-3], err_raiser) stack.pop() stack.pop() stack.pop() v = (bn2 <= bn1) and (bn1 < bn3) if v: stack.append(b"\x01") else: # FIXME: this is incorrect, but not caught by existing # test cases stack.append(b"\x00") else: err_raiser(EvalScriptError, 'unsupported opcode 0x%x' % sop) # size limits if len(stack) + len(altstack) > MAX_STACK_ITEMS: err_raiser(EvalScriptError, 'max stack items limit reached') # Unterminated IF/NOTIF/ELSE block if len(vfExec): raise EvalScriptError('Unterminated IF/ELSE block', stack=stack, scriptIn=scriptIn, txTo=txTo, inIdx=inIdx, flags=flags) def EvalScript(stack, scriptIn, txTo, inIdx, flags=()): """Evaluate a script stack - Initial stack scriptIn - Script txTo - Transaction the script is a part of inIdx - txin index of the scriptSig flags - SCRIPT_VERIFY_* flags to apply """ try: _EvalScript(stack, scriptIn, txTo, inIdx, flags=flags) except CScriptInvalidError as err: raise EvalScriptError(repr(err), stack=stack, scriptIn=scriptIn, txTo=txTo, inIdx=inIdx, flags=flags) class VerifyScriptError(bitcoin.core.ValidationError): pass def VerifyScript(scriptSig, scriptPubKey, txTo, inIdx, flags=()): """Verify a scriptSig satisfies a scriptPubKey scriptSig - Signature scriptPubKey - PubKey txTo - Spending transaction inIdx - Index of the transaction input containing scriptSig Raises a ValidationError subclass if the validation fails. """ stack = [] EvalScript(stack, scriptSig, txTo, inIdx, flags=flags) if SCRIPT_VERIFY_P2SH in flags: stackCopy = list(stack) EvalScript(stack, scriptPubKey, txTo, inIdx, flags=flags) if len(stack) == 0: raise VerifyScriptError("scriptPubKey left an empty stack") if not _CastToBool(stack[-1]): raise VerifyScriptError("scriptPubKey returned false") # Additional validation for spend-to-script-hash transactions if SCRIPT_VERIFY_P2SH in flags and scriptPubKey.is_p2sh(): if not scriptSig.is_push_only(): raise VerifyScriptError("P2SH scriptSig not is_push_only()") # restore stack stack = stackCopy # stack cannot be empty here, because if it was the # P2SH HASH <> EQUAL scriptPubKey would be evaluated with # an empty stack and the EvalScript above would return false. assert len(stack) pubKey2 = CScript(stack.pop()) EvalScript(stack, pubKey2, txTo, inIdx, flags=flags) if not len(stack): raise VerifyScriptError("P2SH inner scriptPubKey left an empty stack") if not _CastToBool(stack[-1]): raise VerifyScriptError("P2SH inner scriptPubKey returned false") if SCRIPT_VERIFY_CLEANSTACK in flags: assert SCRIPT_VERIFY_P2SH in flags if len(stack) != 1: raise VerifyScriptError("scriptPubKey left extra items on stack") class VerifySignatureError(bitcoin.core.ValidationError): pass def VerifySignature(txFrom, txTo, inIdx): """Verify a scriptSig signature can spend a txout Verifies that the scriptSig in txTo.vin[inIdx] is a valid scriptSig for the corresponding COutPoint in transaction txFrom. """ if inIdx < 0: raise VerifySignatureError("inIdx negative") if inIdx >= len(txTo.vin): raise VerifySignatureError("inIdx >= len(txTo.vin)") txin = txTo.vin[inIdx] if txin.prevout.n < 0: raise VerifySignatureError("txin prevout.n negative") if txin.prevout.n >= len(txFrom.vout): raise VerifySignatureError("txin prevout.n >= len(txFrom.vout)") txout = txFrom.vout[txin.prevout.n] if txin.prevout.hash != txFrom.GetTxid(): raise VerifySignatureError("prevout hash does not match txFrom") VerifyScript(txin.scriptSig, txout.scriptPubKey, txTo, inIdx) __all__ = ( 'MAX_STACK_ITEMS', 'SCRIPT_VERIFY_P2SH', 'SCRIPT_VERIFY_STRICTENC', 'SCRIPT_VERIFY_DERSIG', 'SCRIPT_VERIFY_LOW_S', 'SCRIPT_VERIFY_NULLDUMMY', 'SCRIPT_VERIFY_SIGPUSHONLY', 'SCRIPT_VERIFY_MINIMALDATA', 'SCRIPT_VERIFY_DISCOURAGE_UPGRADABLE_NOPS', 'SCRIPT_VERIFY_CLEANSTACK', 'SCRIPT_VERIFY_CHECKLOCKTIMEVERIFY', 'SCRIPT_VERIFY_FLAGS_BY_NAME', 'EvalScriptError', 'MaxOpCountError', 'MissingOpArgumentsError', 'ArgumentsInvalidError', 'VerifyOpFailedError', 'EvalScript', 'VerifyScriptError', 'VerifyScript', 'VerifySignatureError', 'VerifySignature', ) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/core/serialize.py000066400000000000000000000244051430270607500260020ustar00rootroot00000000000000# Copyright (C) 2012-2018 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Serialization routines You probably don't need to use these directly. """ import hashlib import struct from io import BytesIO from bitcoin.core.contrib.ripemd160 import ripemd160 MAX_SIZE = 0x02000000 def Hash(msg): """SHA256^2)(msg) -> bytes""" return hashlib.sha256(hashlib.sha256(msg).digest()).digest() def Hash160(msg): """RIPEME160(SHA256(msg)) -> bytes""" return ripemd160(hashlib.sha256(msg).digest()) class SerializationError(Exception): """Base class for serialization errors""" class SerializationTruncationError(SerializationError): """Serialized data was truncated Thrown by deserialize() and stream_deserialize() """ class DeserializationExtraDataError(SerializationError): """Deserialized data had extra data at the end Thrown by deserialize() when not all data is consumed during deserialization. The deserialized object and extra padding not consumed are saved. """ def __init__(self, msg, obj, padding): super(DeserializationExtraDataError, self).__init__(msg) self.obj = obj self.padding = padding def ser_read(f, n): """Read from a stream safely Raises SerializationError and SerializationTruncationError appropriately. Use this instead of f.read() in your classes stream_(de)serialization() functions. """ if n > MAX_SIZE: raise SerializationError('Asked to read 0x%x bytes; MAX_SIZE exceeded' % n) r = f.read(n) if len(r) < n: raise SerializationTruncationError('Asked to read %i bytes, but only got %i' % (n, len(r))) return r class Serializable(object): """Base class for serializable objects""" __slots__ = [] def stream_serialize(self, f, **kwargs): """Serialize to a stream""" raise NotImplementedError @classmethod def stream_deserialize(cls, f, **kwargs): """Deserialize from a stream""" raise NotImplementedError def serialize(self, params={}): """Serialize, returning bytes""" f = BytesIO() self.stream_serialize(f, **params) return f.getvalue() @classmethod def deserialize(cls, buf, allow_padding=False, params={}): """Deserialize bytes, returning an instance allow_padding - Allow buf to include extra padding. (default False) If allow_padding is False and not all bytes are consumed during deserialization DeserializationExtraDataError will be raised. """ fd = BytesIO(buf) r = cls.stream_deserialize(fd, **params) if not allow_padding: padding = fd.read() if len(padding) != 0: raise DeserializationExtraDataError('Not all bytes consumed during deserialization', r, padding) return r def GetHash(self): """Return the hash of the serialized object""" return Hash(self.serialize()) def __eq__(self, other): if (not isinstance(other, self.__class__) and not isinstance(self, other.__class__)): return NotImplemented return self.serialize() == other.serialize() def __ne__(self, other): return not (self == other) def __hash__(self): return hash(self.serialize()) class ImmutableSerializable(Serializable): """Immutable serializable object""" __slots__ = ['_cached_GetHash', '_cached__hash__'] def __setattr__(self, name, value): raise AttributeError('Object is immutable') def __delattr__(self, name): raise AttributeError('Object is immutable') def GetHash(self): """Return the hash of the serialized object""" try: return self._cached_GetHash except AttributeError: _cached_GetHash = super(ImmutableSerializable, self).GetHash() object.__setattr__(self, '_cached_GetHash', _cached_GetHash) return _cached_GetHash def __hash__(self): try: return self._cached__hash__ except AttributeError: _cached__hash__ = hash(self.serialize()) object.__setattr__(self, '_cached__hash__', _cached__hash__) return _cached__hash__ class Serializer(object): """Base class for object serializers""" def __new__(cls): raise NotImplementedError @classmethod def stream_serialize(cls, obj, f): raise NotImplementedError @classmethod def stream_deserialize(cls, f): raise NotImplementedError @classmethod def serialize(cls, obj): f = BytesIO() cls.stream_serialize(obj, f) return f.getvalue() @classmethod def deserialize(cls, buf): if isinstance(buf, str) or isinstance(buf, bytes): buf = BytesIO(buf) return cls.stream_deserialize(buf) class VarIntSerializer(Serializer): """Serialization of variable length ints""" @classmethod def stream_serialize(cls, i, f): if i < 0: raise ValueError('varint must be non-negative integer') elif i < 0xfd: f.write(bytes([i])) elif i <= 0xffff: f.write(b'\xfd') f.write(struct.pack(b'> 24) & 0xFF if nbytes <= 3: v = (c & 0xFFFFFF) >> 8 * (3 - nbytes) else: v = (c & 0xFFFFFF) << (8 * (nbytes - 3)) return v def compact_from_uint256(v): """Convert uint256 to compact encoding """ nbytes = (v.bit_length() + 7) >> 3 compact = 0 if nbytes <= 3: compact = (v & 0xFFFFFF) << 8 * (3 - nbytes) else: compact = v >> 8 * (nbytes - 3) compact = compact & 0xFFFFFF # If the sign bit (0x00800000) is set, divide the mantissa by 256 and # increase the exponent to get an encoding without it set. if compact & 0x00800000: compact >>= 8 nbytes += 1 return compact | nbytes << 24 def uint256_to_str(u): r = b"" for i in range(8): r += struct.pack('> (i * 32) & 0xffffffff) return r def uint256_to_shortstr(u): s = "%064x" % (u,) return s[:16] __all__ = ( 'MAX_SIZE', 'Hash', 'Hash160', 'SerializationError', 'SerializationTruncationError', 'DeserializationExtraDataError', 'ser_read', 'Serializable', 'ImmutableSerializable', 'Serializer', 'VarIntSerializer', 'BytesSerializer', 'VectorSerializer', 'uint256VectorSerializer', 'intVectorSerializer', 'VarStringSerializer', 'uint256_from_str', 'uint256_from_compact', 'compact_from_uint256', 'uint256_to_str', 'uint256_to_shortstr', ) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/messages.py000066400000000000000000000353001430270607500246660ustar00rootroot00000000000000# Copyright (C) 2012-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import hashlib import random import struct import time # Py3 compatibility import sys from io import BytesIO # Bad practice, so we have a __all__ at the end; this should be cleaned up # later. from bitcoin.core import * from bitcoin.core.serialize import * from bitcoin.net import * import bitcoin MSG_WITNESS_FLAG = 1 << 30 MSG_TYPE_MASK = 0xffffffff >> 2 MSG_TX = 1 MSG_BLOCK = 2 MSG_FILTERED_BLOCK = 3 MSG_CMPCT_BLOCK = 4 MSG_WITNESS_BLOCK = MSG_BLOCK | MSG_WITNESS_FLAG, MSG_WITNESS_TX = MSG_TX | MSG_WITNESS_FLAG, MSG_FILTERED_WITNESS_BLOCK = MSG_FILTERED_BLOCK | MSG_WITNESS_FLAG, class MsgSerializable(Serializable): def __init__(self, protover=PROTO_VERSION): self.protover = protover def msg_ser(self, f): raise NotImplementedError @classmethod def msg_deser(cls, f, protover=PROTO_VERSION): raise NotImplementedError def to_bytes(self): f = BytesIO() self.msg_ser(f) body = f.getvalue() res = bitcoin.params.MESSAGE_START res += self.command res += b"\x00" * (12 - len(self.command)) res += struct.pack(b"= 106: c.addrFrom = CAddress.stream_deserialize(f, True) c.nNonce = struct.unpack(b"= 209: c.nStartingHeight = struct.unpack(b"= 70001: c.fRelay = struct.unpack(b"= CADDR_TIME_VERSION and not without_time: c.nTime = struct.unpack(b"H", ser_read(f, 2))[0] return c def stream_serialize(self, f, without_time=False): if self.protover >= CADDR_TIME_VERSION and not without_time: f.write(struct.pack(b"H", self.port)) def __repr__(self): return "CAddress(nTime=%d nServices=%i ip=%s port=%i)" % (self.nTime, self.nServices, self.ip, self.port) class CInv(Serializable): typemap = { 0: "Error", 1: "TX", 2: "Block", 3: "FilteredBlock", 4: "CompactBlock"} def __init__(self): self.type = 0 self.hash = 0 @classmethod def stream_deserialize(cls, f): c = cls() c.type = struct.unpack(b">> import simplejson >>> import bitcoin.rpc >>> bitcoin.rpc.json = simplejson (``simplejson`` is the externally maintained version of the same module and thus better optimized but perhaps less stable.) """ import http.client as httplib import base64 import binascii import decimal import json import os import platform import urllib.parse as urlparse import bitcoin from bitcoin.core import COIN, x, lx, b2lx, CBlock, CBlockHeader, CTransaction, COutPoint, CTxOut from bitcoin.core.script import CScript from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret DEFAULT_USER_AGENT = "AuthServiceProxy/0.1" DEFAULT_HTTP_TIMEOUT = 30 def unhexlify_str(h): """ Converts a string containing hexadecimal encoding into a bytes-object. It works by encoding the given string h as ASCII, then interpreting each of its two-character ASCII tuples as bytes: - "00" to byte 0 - "ff" to byte 255 - "FF" also to byte 255 The string must only contain characters in the ranges 0-9, a-f and A-F. If the string contains characters not in ASCII, UnicodeEncodeError is raised. If the string contains out-of-range ASCII characters, binascii.Error is raised. If number of encoded ASCII bytes is odd, binascii.Error is raised. """ return binascii.unhexlify(h.encode('ascii')) def hexlify_str(b): """ Given an arbitrary bytes-like object, returns a string (that would encode as ASCII) containing the hex-representation of the bytes-like object. Always succeeds. """ return binascii.hexlify(b).decode('ascii') class JSONRPCError(Exception): """JSON-RPC protocol error base class Subclasses of this class also exist for specific types of errors; the set of all subclasses is by no means complete. """ SUBCLS_BY_CODE = {} @classmethod def _register_subcls(cls, subcls): cls.SUBCLS_BY_CODE[subcls.RPC_ERROR_CODE] = subcls return subcls def __new__(cls, rpc_error): assert cls is JSONRPCError cls = JSONRPCError.SUBCLS_BY_CODE.get(rpc_error['code'], cls) self = Exception.__new__(cls) super(JSONRPCError, self).__init__( 'msg: %r code: %r' % (rpc_error['message'], rpc_error['code'])) self.error = rpc_error return self @JSONRPCError._register_subcls class ForbiddenBySafeModeError(JSONRPCError): RPC_ERROR_CODE = -2 @JSONRPCError._register_subcls class InvalidAddressOrKeyError(JSONRPCError): RPC_ERROR_CODE = -5 @JSONRPCError._register_subcls class InvalidParameterError(JSONRPCError): RPC_ERROR_CODE = -8 @JSONRPCError._register_subcls class VerifyError(JSONRPCError): RPC_ERROR_CODE = -25 @JSONRPCError._register_subcls class VerifyRejectedError(JSONRPCError): RPC_ERROR_CODE = -26 @JSONRPCError._register_subcls class VerifyAlreadyInChainError(JSONRPCError): RPC_ERROR_CODE = -27 @JSONRPCError._register_subcls class InWarmupError(JSONRPCError): RPC_ERROR_CODE = -28 class BaseProxy(object): """Base JSON-RPC proxy class. Contains only private methods; do not use directly.""" def __init__(self, service_url=None, service_port=None, btc_conf_file=None, timeout=DEFAULT_HTTP_TIMEOUT, connection=None): # Create a dummy connection early on so if __init__() fails prior to # __conn being created __del__() can detect the condition and handle it # correctly. self.__conn = None authpair = None if service_url is None: # Figure out the path to the bitcoin.conf file if btc_conf_file is None: if platform.system() == 'Darwin': btc_conf_file = os.path.expanduser('~/Library/Application Support/Bitcoin/') elif platform.system() == 'Windows': btc_conf_file = os.path.join(os.environ['APPDATA'], 'Bitcoin') else: btc_conf_file = os.path.expanduser('~/.bitcoin') btc_conf_file = os.path.join(btc_conf_file, 'bitcoin.conf') # Bitcoin Core accepts empty rpcuser, not specified in btc_conf_file conf = {'rpcuser': ""} # Extract contents of bitcoin.conf to build service_url try: with open(btc_conf_file, 'r') as fd: for line in fd.readlines(): if '#' in line: line = line[:line.index('#')] if '=' not in line: continue k, v = line.split('=', 1) conf[k.strip()] = v.strip() # Treat a missing bitcoin.conf as though it were empty except FileNotFoundError: pass if service_port is None: service_port = bitcoin.params.RPC_PORT conf['rpcport'] = int(conf.get('rpcport', service_port)) conf['rpchost'] = conf.get('rpcconnect', 'localhost') service_url = ('%s://%s:%d' % ('http', conf['rpchost'], conf['rpcport'])) cookie_dir = conf.get('datadir', os.path.dirname(btc_conf_file)) if bitcoin.params.NAME != "mainnet": cookie_dir = os.path.join(cookie_dir, bitcoin.params.NAME) cookie_file = os.path.join(cookie_dir, ".cookie") try: with open(cookie_file, 'r') as fd: authpair = fd.read() except IOError as err: if 'rpcpassword' in conf: authpair = "%s:%s" % (conf['rpcuser'], conf['rpcpassword']) else: raise ValueError('Cookie file unusable (%s) and rpcpassword not specified in the configuration file: %r' % (err, btc_conf_file)) else: url = urlparse.urlparse(service_url) authpair = "%s:%s" % (url.username, url.password) self.__service_url = service_url self.__url = urlparse.urlparse(service_url) if self.__url.scheme not in ('http',): raise ValueError('Unsupported URL scheme %r' % self.__url.scheme) if self.__url.port is None: port = httplib.HTTP_PORT else: port = self.__url.port self.__id_count = 0 if authpair is None: self.__auth_header = None else: authpair = authpair.encode('utf8') self.__auth_header = b"Basic " + base64.b64encode(authpair) if connection: self.__conn = connection else: self.__conn = httplib.HTTPConnection(self.__url.hostname, port=port, timeout=timeout) def _call(self, service_name, *args): self.__id_count += 1 postdata = json.dumps({'version': '1.1', 'method': service_name, 'params': args, 'id': self.__id_count}) headers = { 'Host': self.__url.hostname, 'User-Agent': DEFAULT_USER_AGENT, 'Content-type': 'application/json', } if self.__auth_header is not None: headers['Authorization'] = self.__auth_header self.__conn.request('POST', self.__url.path, postdata, headers) response = self._get_response() err = response.get('error') if err is not None: if isinstance(err, dict): raise JSONRPCError( {'code': err.get('code', -345), 'message': err.get('message', 'error message not specified')}) raise JSONRPCError({'code': -344, 'message': str(err)}) elif 'result' not in response: raise JSONRPCError({ 'code': -343, 'message': 'missing JSON-RPC result'}) else: return response['result'] def _batch(self, rpc_call_list): postdata = json.dumps(list(rpc_call_list)) headers = { 'Host': self.__url.hostname, 'User-Agent': DEFAULT_USER_AGENT, 'Content-type': 'application/json', } if self.__auth_header is not None: headers['Authorization'] = self.__auth_header self.__conn.request('POST', self.__url.path, postdata, headers) return self._get_response() def _get_response(self): http_response = self.__conn.getresponse() if http_response is None: raise JSONRPCError({ 'code': -342, 'message': 'missing HTTP response from server'}) rdata = http_response.read().decode('utf8') try: return json.loads(rdata, parse_float=decimal.Decimal) except Exception: raise JSONRPCError({ 'code': -342, 'message': ('non-JSON HTTP response with \'%i %s\' from server: \'%.20s%s\'' % (http_response.status, http_response.reason, rdata, '...' if len(rdata) > 20 else ''))}) def close(self): if self.__conn is not None: self.__conn.close() def __del__(self): if self.__conn is not None: self.__conn.close() class RawProxy(BaseProxy): """Low-level proxy to a bitcoin JSON-RPC service Unlike ``Proxy``, no conversion is done besides parsing JSON. As far as Python is concerned, you can call any method; ``JSONRPCError`` will be raised if the server does not recognize it. """ def __init__(self, service_url=None, service_port=None, btc_conf_file=None, timeout=DEFAULT_HTTP_TIMEOUT, **kwargs): super(RawProxy, self).__init__(service_url=service_url, service_port=service_port, btc_conf_file=btc_conf_file, timeout=timeout, **kwargs) def __getattr__(self, name): if name.startswith('__') and name.endswith('__'): # Prevent RPC calls for non-existing python internal attribute # access. If someone tries to get an internal attribute # of RawProxy instance, and the instance does not have this # attribute, we do not want the bogus RPC call to happen. raise AttributeError # Create a callable to do the actual call f = lambda *args: self._call(name, *args) # Make debuggers show rather than > f.__name__ = name return f class Proxy(BaseProxy): """Proxy to a bitcoin RPC service Unlike ``RawProxy``, data is passed as ``bitcoin.core`` objects or packed bytes, rather than JSON or hex strings. Not all methods are implemented yet; you can use ``call`` to access missing ones in a forward-compatible way. Assumes Bitcoin Core version >= v0.16.0; older versions mostly work, but there are a few incompatibilities. """ def __init__(self, service_url=None, service_port=None, btc_conf_file=None, timeout=DEFAULT_HTTP_TIMEOUT, **kwargs): """Create a proxy object If ``service_url`` is not specified, the username and password are read out of the file ``btc_conf_file``. If ``btc_conf_file`` is not specified, ``~/.bitcoin/bitcoin.conf`` or equivalent is used by default. The default port is set according to the chain parameters in use: mainnet, testnet, signet, or regtest. Usually no arguments to ``Proxy()`` are needed; the local bitcoind will be used. ``timeout`` - timeout in seconds before the HTTP interface times out """ super(Proxy, self).__init__(service_url=service_url, service_port=service_port, btc_conf_file=btc_conf_file, timeout=timeout, **kwargs) def call(self, service_name, *args): """Call an RPC method by name and raw (JSON encodable) arguments""" return self._call(service_name, *args) def dumpprivkey(self, addr): """Return the private key matching an address """ r = self._call('dumpprivkey', str(addr)) return CBitcoinSecret(r) def fundrawtransaction(self, tx, include_watching=False): """Add inputs to a transaction until it has enough in value to meet its out value. include_watching - Also select inputs which are watch only Returns dict: {'tx': Resulting tx, 'fee': Fee the resulting transaction pays, 'changepos': Position of added change output, or -1, } """ hextx = hexlify_str(tx.serialize()) r = self._call('fundrawtransaction', hextx, include_watching) r['tx'] = CTransaction.deserialize(unhexlify_str(r['hex'])) del r['hex'] r['fee'] = int(r['fee'] * COIN) return r def generate(self, numblocks): """ DEPRECATED (will be removed in bitcoin-core v0.19) Mine blocks immediately (before the RPC call returns) numblocks - How many blocks are generated immediately. Returns iterable of block hashes generated. """ r = self._call('generate', numblocks) return (lx(blk_hash) for blk_hash in r) def generatetoaddress(self, numblocks, addr): """Mine blocks immediately (before the RPC call returns) and allocate block reward to passed address. Replaces deprecated "generate(self,numblocks)" method. numblocks - How many blocks are generated immediately. addr - Address to receive block reward (CBitcoinAddress instance) Returns iterable of block hashes generated. """ r = self._call('generatetoaddress', numblocks, str(addr)) return (lx(blk_hash) for blk_hash in r) def getaccountaddress(self, account=None): """Return the current Bitcoin address for receiving payments to this account.""" r = self._call('getaccountaddress', account) return CBitcoinAddress(r) def getbalance(self, account='*', minconf=1, include_watchonly=False): """Get the balance account - The selected account. Defaults to "*" for entire wallet. It may be the default account using "". minconf - Only include transactions confirmed at least this many times. (default=1) include_watchonly - Also include balance in watch-only addresses (see 'importaddress') (default=False) """ r = self._call('getbalance', account, minconf, include_watchonly) return int(r*COIN) def getbestblockhash(self): """Return hash of best (tip) block in longest block chain.""" return lx(self._call('getbestblockhash')) def getblockheader(self, block_hash, verbose=False): """Get block header verbose - If true a dict is returned with the values returned by getblockheader that are not in the block header itself (height, nextblockhash, etc.) Raises IndexError if block_hash is not valid. """ try: block_hash = b2lx(block_hash) except TypeError: raise TypeError('%s.getblockheader(): block_hash must be bytes; got %r instance' % (self.__class__.__name__, block_hash.__class__)) try: r = self._call('getblockheader', block_hash, verbose) except InvalidAddressOrKeyError as ex: raise IndexError('%s.getblockheader(): %s (%d)' % (self.__class__.__name__, ex.error['message'], ex.error['code'])) if verbose: nextblockhash = None if 'nextblockhash' in r: nextblockhash = lx(r['nextblockhash']) return {'confirmations':r['confirmations'], 'height':r['height'], 'mediantime':r['mediantime'], 'nextblockhash':nextblockhash, 'chainwork':x(r['chainwork'])} else: return CBlockHeader.deserialize(unhexlify_str(r)) def getblock(self, block_hash): """Get block Raises IndexError if block_hash is not valid. """ try: block_hash = b2lx(block_hash) except TypeError: raise TypeError('%s.getblock(): block_hash must be bytes; got %r instance' % (self.__class__.__name__, block_hash.__class__)) try: # With this change ( https://github.com/bitcoin/bitcoin/commit/96c850c20913b191cff9f66fedbb68812b1a41ea#diff-a0c8f511d90e83aa9b5857e819ced344 ), # bitcoin core's rpc takes 0/1/2 instead of true/false as the 2nd argument which specifies verbosity, since v0.15.0. # The change above is backward-compatible so far; the old "false" is taken as the new "0". r = self._call('getblock', block_hash, False) except InvalidAddressOrKeyError as ex: raise IndexError('%s.getblock(): %s (%d)' % (self.__class__.__name__, ex.error['message'], ex.error['code'])) return CBlock.deserialize(unhexlify_str(r)) def getblockcount(self): """Return the number of blocks in the longest block chain""" return self._call('getblockcount') def getblockhash(self, height): """Return hash of block in best-block-chain at height. Raises IndexError if height is not valid. """ try: return lx(self._call('getblockhash', height)) except InvalidParameterError as ex: raise IndexError('%s.getblockhash(): %s (%d)' % (self.__class__.__name__, ex.error['message'], ex.error['code'])) def getinfo(self): """Return a JSON object containing various state info""" r = self._call('getinfo') if 'balance' in r: r['balance'] = int(r['balance'] * COIN) if 'paytxfee' in r: r['paytxfee'] = int(r['paytxfee'] * COIN) return r def getmininginfo(self): """Return a JSON object containing mining-related information""" return self._call('getmininginfo') def getnewaddress(self, account=None): """Return a new Bitcoin address for receiving payments. If account is not None, it is added to the address book so payments received with the address will be credited to account. """ r = None if account is not None: r = self._call('getnewaddress', account) else: r = self._call('getnewaddress') return CBitcoinAddress(r) def getrawchangeaddress(self): """Returns a new Bitcoin address, for receiving change. This is for use with raw transactions, NOT normal use. """ r = self._call('getrawchangeaddress') return CBitcoinAddress(r) def getrawmempool(self, verbose=False): """Return the mempool""" if verbose: return self._call('getrawmempool', verbose) else: r = self._call('getrawmempool') r = [lx(txid) for txid in r] return r def getrawtransaction(self, txid, verbose=False, block_hash=None): """Return transaction with hash txid Raises IndexError if transaction not found. verbose - If true a dict is returned instead with additional information on the transaction. block_hash - Hash of the block containing the transaction (required when transaction not currently indexed by Bitcoin Core) Note that if all txouts are spent and the transaction index is not enabled the transaction may not be available. """ try: if block_hash is None: r = self._call('getrawtransaction', b2lx(txid), 1 if verbose else 0) else: r = self._call('getrawtransaction', b2lx(txid), 1 if verbose else 0, b2lx(block_hash)) except InvalidAddressOrKeyError as ex: raise IndexError('%s.getrawtransaction(): %s (%d)' % (self.__class__.__name__, ex.error['message'], ex.error['code'])) if verbose: r['tx'] = CTransaction.deserialize(unhexlify_str(r['hex'])) del r['hex'] del r['txid'] del r['version'] del r['locktime'] del r['vin'] del r['vout'] r['blockhash'] = lx(r['blockhash']) if 'blockhash' in r else None else: r = CTransaction.deserialize(unhexlify_str(r)) return r def getreceivedbyaddress(self, addr, minconf=1): """Return total amount received by given a (wallet) address Get the amount received by
in transactions with at least [minconf] confirmations. Works only for addresses in the local wallet; other addresses will always show zero. addr - The address. (CBitcoinAddress instance) minconf - Only include transactions confirmed at least this many times. (default=1) """ r = self._call('getreceivedbyaddress', str(addr), minconf) return int(r * COIN) def gettransaction(self, txid): """Get detailed information about in-wallet transaction txid Raises IndexError if transaction not found in the wallet. FIXME: Returned data types are not yet converted. """ try: r = self._call('gettransaction', b2lx(txid)) except InvalidAddressOrKeyError as ex: raise IndexError('%s.getrawtransaction(): %s (%d)' % (self.__class__.__name__, ex.error['message'], ex.error['code'])) return r def gettxout(self, outpoint, includemempool=True): """Return details about an unspent transaction output. Raises IndexError if outpoint is not found or was spent. includemempool - Include mempool txouts """ r = self._call('gettxout', b2lx(outpoint.hash), outpoint.n, includemempool) if r is None: raise IndexError('%s.gettxout(): unspent txout %r not found' % (self.__class__.__name__, outpoint)) r['txout'] = CTxOut(int(r['value'] * COIN), CScript(unhexlify_str(r['scriptPubKey']['hex']))) del r['value'] del r['scriptPubKey'] r['bestblock'] = lx(r['bestblock']) return r def importaddress(self, addr, label='', rescan=True): """Adds an address or pubkey to wallet without the associated privkey.""" addr = str(addr) r = self._call('importaddress', addr, label, rescan) return r def listunspent(self, minconf=0, maxconf=9999999, addrs=None): """Return unspent transaction outputs in wallet Outputs will have between minconf and maxconf (inclusive) confirmations, optionally filtered to only include txouts paid to addresses in addrs. """ r = None if addrs is None: r = self._call('listunspent', minconf, maxconf) else: addrs = [str(addr) for addr in addrs] r = self._call('listunspent', minconf, maxconf, addrs) r2 = [] for unspent in r: unspent['outpoint'] = COutPoint(lx(unspent['txid']), unspent['vout']) del unspent['txid'] del unspent['vout'] # address isn't always available as Bitcoin Core allows scripts w/o # an address type to be imported into the wallet, e.g. non-p2sh # segwit try: unspent['address'] = CBitcoinAddress(unspent['address']) except KeyError: pass unspent['scriptPubKey'] = CScript(unhexlify_str(unspent['scriptPubKey'])) unspent['amount'] = int(unspent['amount'] * COIN) r2.append(unspent) return r2 def lockunspent(self, unlock, outpoints): """Lock or unlock outpoints""" json_outpoints = [{'txid':b2lx(outpoint.hash), 'vout':outpoint.n} for outpoint in outpoints] return self._call('lockunspent', unlock, json_outpoints) def sendrawtransaction(self, tx, allowhighfees=False): """Submit transaction to local node and network. allowhighfees - Allow even if fees are unreasonably high. """ hextx = hexlify_str(tx.serialize()) r = None if allowhighfees: r = self._call('sendrawtransaction', hextx, True) else: r = self._call('sendrawtransaction', hextx) return lx(r) def sendmany(self, fromaccount, payments, minconf=1, comment='', subtractfeefromamount=[]): """Send amount to given addresses. payments - dict with {address: amount} """ json_payments = {str(addr):float(amount)/COIN for addr, amount in payments.items()} r = self._call('sendmany', fromaccount, json_payments, minconf, comment, subtractfeefromamount) return lx(r) def sendtoaddress(self, addr, amount, comment='', commentto='', subtractfeefromamount=False): """Send amount to a given address""" addr = str(addr) amount = float(amount)/COIN r = self._call('sendtoaddress', addr, amount, comment, commentto, subtractfeefromamount) return lx(r) def signrawtransaction(self, tx, *args): """Sign inputs for transaction FIXME: implement options """ hextx = hexlify_str(tx.serialize()) r = self._call('signrawtransaction', hextx, *args) r['tx'] = CTransaction.deserialize(unhexlify_str(r['hex'])) del r['hex'] return r def signrawtransactionwithwallet(self, tx, *args): """Sign inputs for transaction bicoincore >= 0.17.x FIXME: implement options """ hextx = hexlify_str(tx.serialize()) r = self._call('signrawtransactionwithwallet', hextx, *args) r['tx'] = CTransaction.deserialize(unhexlify_str(r['hex'])) del r['hex'] return r def submitblock(self, block, params=None): """Submit a new block to the network. params is optional and is currently ignored by bitcoind. See https://en.bitcoin.it/wiki/BIP_0022 for full specification. """ hexblock = hexlify_str(block.serialize()) if params is not None: return self._call('submitblock', hexblock, params) else: return self._call('submitblock', hexblock) def validateaddress(self, address): """Return information about an address""" r = self._call('validateaddress', str(address)) if r['isvalid']: r['address'] = CBitcoinAddress(r['address']) if 'pubkey' in r: r['pubkey'] = unhexlify_str(r['pubkey']) return r def unlockwallet(self, password, timeout=60): """Stores the wallet decryption key in memory for 'timeout' seconds. password - The wallet passphrase. timeout - The time to keep the decryption key in seconds. (default=60) """ r = self._call('walletpassphrase', password, timeout) return r def _addnode(self, node, arg): r = self._call('addnode', node, arg) return r def addnode(self, node): return self._addnode(node, 'add') def addnodeonetry(self, node): return self._addnode(node, 'onetry') def removenode(self, node): return self._addnode(node, 'remove') __all__ = ( 'JSONRPCError', 'ForbiddenBySafeModeError', 'InvalidAddressOrKeyError', 'InvalidParameterError', 'VerifyError', 'VerifyRejectedError', 'VerifyAlreadyInChainError', 'InWarmupError', 'RawProxy', 'Proxy', ) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/segwit_addr.py000066400000000000000000000104271430270607500253560ustar00rootroot00000000000000# Copyright (c) 2017 Pieter Wuille # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. """Reference implementation for Bech32 and segwit addresses.""" CHARSET = "qpzry9x8gf2tvdw0s3jn54khce6mua7l" def bech32_polymod(values): """Internal function that computes the Bech32 checksum.""" generator = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3] chk = 1 for value in values: top = chk >> 25 chk = (chk & 0x1ffffff) << 5 ^ value for i in range(5): chk ^= generator[i] if ((top >> i) & 1) else 0 return chk def bech32_hrp_expand(hrp): """Expand the HRP into values for checksum computation.""" return [ord(x) >> 5 for x in hrp] + [0] + [ord(x) & 31 for x in hrp] def bech32_verify_checksum(hrp, data): """Verify a checksum given HRP and converted data characters.""" return bech32_polymod(bech32_hrp_expand(hrp) + data) == 1 def bech32_create_checksum(hrp, data): """Compute the checksum values given HRP and data.""" values = bech32_hrp_expand(hrp) + data polymod = bech32_polymod(values + [0, 0, 0, 0, 0, 0]) ^ 1 return [(polymod >> 5 * (5 - i)) & 31 for i in range(6)] def bech32_encode(hrp, data): """Compute a Bech32 string given HRP and data values.""" combined = data + bech32_create_checksum(hrp, data) return hrp + '1' + ''.join([CHARSET[d] for d in combined]) def bech32_decode(bech): """Validate a Bech32 string, and determine HRP and data.""" if ((any(ord(x) < 33 or ord(x) > 126 for x in bech)) or (bech.lower() != bech and bech.upper() != bech)): return (None, None) bech = bech.lower() pos = bech.rfind('1') if pos < 1 or pos + 7 > len(bech) or len(bech) > 90: return (None, None) if not all(x in CHARSET for x in bech[pos+1:]): return (None, None) hrp = bech[:pos] data = [CHARSET.find(x) for x in bech[pos+1:]] if not bech32_verify_checksum(hrp, data): return (None, None) return (hrp, data[:-6]) def convertbits(data, frombits, tobits, pad=True): """General power-of-2 base conversion.""" acc = 0 bits = 0 ret = [] maxv = (1 << tobits) - 1 max_acc = (1 << (frombits + tobits - 1)) - 1 for value in data: if value < 0 or (value >> frombits): return None acc = ((acc << frombits) | value) & max_acc bits += frombits while bits >= tobits: bits -= tobits ret.append((acc >> bits) & maxv) if pad: if bits: ret.append((acc << (tobits - bits)) & maxv) elif bits >= frombits or ((acc << (tobits - bits)) & maxv): return None return ret def decode(hrp, addr): """Decode a segwit address.""" hrpgot, data = bech32_decode(addr) if hrpgot != hrp: return (None, None) decoded = convertbits(data[1:], 5, 8, False) if decoded is None or len(decoded) < 2 or len(decoded) > 40: return (None, None) if data[0] > 16: return (None, None) if data[0] == 0 and len(decoded) != 20 and len(decoded) != 32: return (None, None) return (data[0], decoded) def encode(hrp, witver, witprog): """Encode a segwit address.""" ret = bech32_encode(hrp, [witver] + convertbits(witprog, 8, 5)) if decode(hrp, ret) == (None, None): return None return ret python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/signature.py000066400000000000000000000026661430270607500250710ustar00rootroot00000000000000# Copyright (C) 2012-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. from bitcoin.core.serialize import * # Py3 compatibility import sys from io import BytesIO class DERSignature(ImmutableSerializable): __slots__ = ['length', 'r', 's'] def __init__(self, r, s, length): object.__setattr__(self, 'r', r) object.__setattr__(self, 's', s) object.__setattr__(self, 'length', length) @classmethod def stream_deserialize(cls, f): assert ser_read(f, 1) == b"\x30" rs = BytesSerializer.stream_deserialize(f) f = BytesIO(rs) assert ser_read(f, 1) == b"\x02" r = BytesSerializer.stream_deserialize(f) assert ser_read(f, 1) == b"\x02" s = BytesSerializer.stream_deserialize(f) return cls(r, s, len(r + s)) def stream_serialize(self, f): f.write(b"\x30") f.write(b"\x02") BytesSerializer.stream_serialize(self.r, f) f.write(b"\x30") BytesSerializer.stream_serialize(self.s, f) def __repr__(self): return 'DERSignature(%s, %s)' % (self.r, self.s) __all__ = ( 'DERSignature', ) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/signmessage.py000066400000000000000000000035251430270607500253700ustar00rootroot00000000000000# Copyright (C) 2013-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. from bitcoin.core.key import CPubKey from bitcoin.core.serialize import ImmutableSerializable from bitcoin.wallet import P2PKHBitcoinAddress import bitcoin import base64 def VerifyMessage(address, message, sig): sig = base64.b64decode(sig) hash = message.GetHash() pubkey = CPubKey.recover_compact(hash, sig) return str(P2PKHBitcoinAddress.from_pubkey(pubkey)) == str(address) def SignMessage(key, message): sig, i = key.sign_compact(message.GetHash()) meta = 27 + i if key.is_compressed: meta += 4 return base64.b64encode(bytes([meta]) + sig) class BitcoinMessage(ImmutableSerializable): __slots__ = ['magic', 'message'] def __init__(self, message="", magic="Bitcoin Signed Message:\n"): object.__setattr__(self, 'message', message.encode("utf-8")) object.__setattr__(self, 'magic', magic.encode("utf-8")) @classmethod def stream_deserialize(cls, f): magic = bitcoin.core.serialize.BytesSerializer.stream_deserialize(f) message = bitcoin.core.serialize.BytesSerializer.stream_deserialize(f) return cls(message, magic) def stream_serialize(self, f): bitcoin.core.serialize.BytesSerializer.stream_serialize(self.magic, f) bitcoin.core.serialize.BytesSerializer.stream_serialize(self.message, f) def __str__(self): return self.message.decode('ascii') def __repr__(self): return 'BitcoinMessage(%s, %s)' % (self.magic, self.message)python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/000077500000000000000000000000001430270607500236465ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/__init__.py000066400000000000000000000006101430270607500257540ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/000077500000000000000000000000001430270607500245575ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/base58_encode_decode.json000066400000000000000000000006661430270607500313710ustar00rootroot00000000000000[ ["", ""], ["61", "2g"], ["626262", "a3gV"], ["636363", "aPEr"], ["73696d706c792061206c6f6e6720737472696e67", "2cFupjhnEsSn59qHXstmK2ffpLv2"], ["00eb15231dfceb60925886b67d065299925915aeb172c06647", "1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L"], ["516b6fcd0f", "ABnLTmg"], ["bf4f89001e670274dd", "3SEo3LWLoPntC"], ["572e4794", "3EFU7m"], ["ecac89cad93923c02321", "EJDM8drfXA6uyA"], ["10c8511e", "Rt5zm"], ["00000000000000000000", "1111111111"] ] python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/bech32_encode_decode.json000066400000000000000000000012251430270607500313400ustar00rootroot00000000000000[ ["0014751e76e8199196d454941c45d1b3a323f1433bd6", "BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4"], ["00201863143c14c5166804bd19203356da136c985678cd4d27a1b8c6329604903262", "tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7"], ["5128751e76e8199196d454941c45d1b3a323f1433bd6751e76e8199196d454941c45d1b3a323f1433bd6", "bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx"], ["6002751e", "BC1SW50QA3JX3S"], ["5210751e76e8199196d454941c45d1b3a323", "bc1zw508d6qejxtdg4y5r3zarvaryvg6kdaj"], ["0020000000c4a5cad46221b2a187905e5266362b99d5e91c6ce24d165dab93e86433", "tb1qqqqqp399et2xygdj5xreqhjjvcmzhxw4aywxecjdzew6hylgvsesrxh6hy"] ] python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/bech32_invalid.json000066400000000000000000000014461430270607500302330ustar00rootroot00000000000000[ ["tc1qw508d6qejxtdg4y5r3zarvary0c5xw7kg3g4ty", "Invalid human-readable part"], ["bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t5", "Invalid checksum"], ["BC13W508D6QEJXTDG4Y5R3ZARVARY0C5XW7KN40WF2", "Invalid witness version"], ["bc1rw5uspcuh", "Invalid program length"], ["bc10w508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7kw5rljs90", "Invalid program length"], ["BC1QR508D6QEJXTDG4Y5R3ZARVARYV98GJ9P", "Invalid program length for witness version 0 (per BIP141)"], ["tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sL5k7", "Mixed case"], ["bc1zw508d6qejxtdg4y5r3zarvaryvqyzf3du", "zero padding of more than 4 bits"], ["tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3pjxtptv", "Non-zero padding in 8-to-5 conversion"], ["bc1gmk9yu", "Empty data section"] ]python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/checkblock_invalid.json000066400000000000000000000146011430270607500312520ustar00rootroot00000000000000[ ["CheckBlock and CheckBlockHeader tests, valid blocks."], ["They are in the form"], ["[comment, fHeader, fCheckPow, cur_time, serialized_block/block_header],"], ["Objects that are only a single string (like this one) are ignored"], ["Genesis block with time set to two hours + 1 second behind", false, true, 1230999304, "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000"], ["Genesis with one byte changed", false, true, 1231006505, "1100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000"], ["Empty vtx", false, false, 0, "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a00000000ffff001d1dac2b7c00"], ["One tx, but not a coinbase", false, false, 1231731025, "0100000055bd840a78798ad0da853f68974f3d183e2bd1db6a842c1feecf222a00000000169e1e83e930853391bc6f35f605c6754cfead57cf8387639d3b4096c54f18f451b96a49ffff001d283e9e70010100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b00000000434104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000"], ["More than one coinbase (different coinbases)", false, false, 1231731025, "0100000055bd840a78798ad0da853f68974f3d183e2bd1db6a842c1feecf222a00000000622d1f9da7a372968847d7ecfc3892c51ccc08297762c4a767b51cdd6628d2cf51b96a49ffff001d283e9e700201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0102ffffffff0100f2052a01000000434104d46c4968bde02899d2aa0963367c7a6ce34eec332b32e42e5f3407e052d64ac625da6f0718e7b302140434bd725706957c092db53805b821a85b23a7ac61725bac0000000001000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0102ffffffff0100f2052a01000000434104d46c4968bde02899d2aa0963367c7a6ce34eec332b32e42e5f3407e052d64ac625da6f0718e7b302140434bd725706957c092db53805b821a85b23a7ac61725bac01000000"], ["Duplicate transaction", false, false, 1231731025, "0100000055bd840a78798ad0da853f68974f3d183e2bd1db6a842c1feecf222a00000000ff104ccb05421ab93e63f8c3ce5c2c2e9dbb37de2764b3a3175c8166562cac7d51b96a49ffff001d283e9e700301000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0102ffffffff0100f2052a01000000434104d46c4968bde02899d2aa0963367c7a6ce34eec332b32e42e5f3407e052d64ac625da6f0718e7b302140434bd725706957c092db53805b821a85b23a7ac61725bac000000000100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b00000000434104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac000000000100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b00000000434104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000"], ["Merkle root mismatch", false, false, 1293603080, "01000000e78b20013e6e9a21b6366ead5d866b2f9dc00664508b90f24da8000000000000f94b61259c7e9af3455b277275800d0d6a58b929eedf9e0153a6ef2278a5d53408d11a4d4c86041b0fbf10b00301000000010000000000000000000000000000000000000000000000000000000000000000ffffffff07044c86041b0119ffffffff0100f2052a0100000043410427e729f9cb5564abf2a1ccda596c636b77bd4d9d91f657d4738f3c70fce8ac4e12b1c782905554d9ff2c2e050fdfe3ff93c91c5817e617877d51f450b528c9e4ac000000000100000001e853c9e0c133547fd9e162b1d3860dd0f27d5b9b8a7430d28896c00fbb3f1bc7000000008c49304602210095bcd54ebd0caa7cee75f0f89de472a765e6ef4b98c5fd4b32c7f9d4905db9ae022100ebd3f668e3a1a36d56e30184c27531dbb9fc136c84b1282be562064d86997d1e014104727eb4fdcc90658cd26abe7dcb0ae7297810b15b9e27c32bcf8e3edd934901968806dc18b1276d7273cc4c223feee0070361ed947888a3cef422bebfede96e08ffffffff020065cd1d000000001976a91468c6c2b3c0bc4a8eeb10d16a300d627a31a3b58588ac0008af2f000000001976a9141d87f0a54a1d704ffc70eae83b025698bc0fdcfc88ac00000000010000000125f582f1d37b6713b14b85665a2daea4f464f5ed1c3ab3d4dcf152fb61414b9e000000008a473044022066ec12ced31659e1bf961b542b58bba76ba8f2a1e8f36d5f60be0601598eac21022047ce33685a63283a4c3ebc390261191f215999b2f7d8e1504b8af39aae4a2881014104c5e1d713d10fe59cc48f60701a3efcac418969c22e9c6cf57440f71e44dc82837af5351bf3e1d898f06aa5c792bf0251a39902311d1d27c16847b1b414494f35ffffffff02404b4c00000000001976a91466a3b2e43cfa5c6d9b2f0095f7be5a5cb608478c88ac80b8dc3c030000001976a9146df5ed8cee34df5c05c90406761a11ed143c202d88ac01000000"], ["FIXME: need to test sigops count, among other things"], ["Make diffs cleaner by leaving a comment here without comma at the end"] ] python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/checkblock_valid.json000066400000000000000000000134441430270607500307270ustar00rootroot00000000000000[ ["CheckBlock and CheckBlockHeader tests, valid blocks."], ["They are in the form"], ["[comment, fHeader, fCheckPow, cur_time, serialized_block/block_header],"], ["Objects that are only a single string (like this one) are ignored"], ["Genesis block", false, true, 1231006505, "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000"], ["Genesis block with time set to two hours - 1 second behind", false, true, 1230999305, "0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000"], ["Block 99960, three transactions", false, true, 1293603080, "01000000e78b20013e6e9a21b6366ead5d866b2f9dc00664508b90f24da8000000000000f94b61259c7e9af3455b277275800d0d6a58b929eedf9e0153a6ef2278a5d53408d11a4d4c86041b0fbf10b00301000000010000000000000000000000000000000000000000000000000000000000000000ffffffff07044c86041b0119ffffffff0100f2052a0100000043410427e729f9cb5564abf2a1ccda596c636b77bd4d9d91f657d4738f3c70fce8ac4e12b1c782905554d9ff2c2e050fdfe3ff93c91c5817e617877d51f450b528c9e4ac000000000100000001e853c9e0c133547fd9e162b1d3860dd0f27d5b9b8a7430d28896c00fbb3f1bc7000000008c49304602210095bcd54ebd0caa7cee75f0f89de472a765e6ef4b98c5fd4b32c7f9d4905db9ae022100ebd3f668e3a1a36d56e30184c27531dbb9fc136c84b1282be562064d86997d1e014104727eb4fdcc90658cd26abe7dcb0ae7297810b15b9e27c32bcf8e3edd934901968806dc18b1276d7273cc4c223feee0070361ed947888a3cef422bebfede96e08ffffffff020065cd1d000000001976a91468c6c2b3c0bc4a8eeb10d16a300d627a31a3b58588ac0008af2f000000001976a9141d87f0a54a1d704ffc70eae83b025698bc0fdcfc88ac00000000010000000125f582f1d37b6713b14b85665a2daea4f464f5ed1c3ab3d4dcf152fb61414b9e000000008a473044022066ec12ced31659e1bf961b542b58bba76ba8f2a1e8f36d5f60be0601598eac21022047ce33685a63283a4c3ebc390261191f215999b2f7d8e1504b8af39aae4a2881014104c5e1d713d10fe59cc48f60701a3efcac418969c22e9c6cf57440f71e44dc82837af5351bf3e1d898f06aa5c792bf0251a39902311d1d27c16847b1b414494f35ffffffff02404b4c00000000001976a91466a3b2e43cfa5c6d9b2f0095f7be5a5cb608478c88ac80b8dc3c030000001976a9146df5ed8cee34df5c05c90406761a11ed143c202d88ac00000000"], ["Block 99993, four transactions", false, true, 1293622397, "01000000acda3db591d5c2c63e8c09e7523a5b0581707ef3e3520d6ca180000000000000701179cb9a9e0fe709cc96261b6b943b31362b61dacba94b03f9b71a06cc2eff7d1c1b4d4c86041b75962f880401000000010000000000000000000000000000000000000000000000000000000000000000ffffffff07044c86041b0152ffffffff014034152a01000000434104216220ab283b5e2871c332de670d163fb1b7e509fd67db77997c5568e7c25afd988f19cd5cc5aec6430866ec64b5214826b28e0f7a86458073ff933994b47a5cac0000000001000000042a40ae58b06c3a61ae55dbee05cab546e80c508f71f24ef0cdc9749dac91ea5f000000004a49304602210089c685b37903c4aa62d984929afeaca554d1641f9a668398cd228fb54588f06b0221008a5cfbc5b0a38ba78c4f4341e53272b9cd0e377b2fb740106009b8d7fa693f0b01ffffffff7b999491e30af112b11105cb053bc3633a8a87f44740eb158849a76891ff228b00000000494830450221009a4aa8663ff4017063d2020519f2eade5b4e3e30be69bf9a62b4e6472d1747b2022021ee3b3090b8ce439dbf08a5df31e2dc23d68073ebda45dc573e8a4f74f5cdfc01ffffffffdea82ec2f9e88e0241faa676c13d093030b17c479770c6cc83239436a4327d49000000004a493046022100c29d9de71a34707c52578e355fa0fdc2bb69ce0a957e6b591658a02b1e039d69022100f82c8af79c166a822d305f0832fb800786d831aea419069b3aed97a6edf8f02101fffffffff3e7987da9981c2ae099f97a551783e1b21669ba0bf3aca8fe12896add91a11a0000000049483045022100e332c81781b281a3b35cf75a5a204a2be451746dad8147831255291ebac2604d02205f889a2935270d1bf1ef47db773d68c4d5c6a51bb51f082d3e1c491de63c345601ffffffff0100c817a8040000001976a91420420e56079150b50fb0617dce4c374bd61eccea88ac00000000010000000265a7293b2d69ba51d554cd32ac7586f7fbeaeea06835f26e03a2feab6aec375f000000004a493046022100922361eaafe316003087d355dd3c0ef3d9f44edae661c212a28a91e020408008022100c9b9c84d53d82c0ba9208f695c79eb42a453faea4d19706a8440e1d05e6cff7501fffffffff6971f00725d17c1c531088144b45ed795a307a22d51ca377c6f7f93675bb03a000000008b483045022100d060f2b2f4122edac61a25ea06396fe9135affdabc66d350b5ae1813bc6bf3f302205d8363deef2101fc9f3d528a8b3907e9d29c40772e587dcea12838c574cb80f801410449fce4a25c972a43a6bc67456407a0d4ced782d4cf8c0a35a130d5f65f0561e9f35198349a7c0b4ec79a15fead66bd7642f17cc8c40c5df95f15ac7190c76442ffffffff0200f2052a010000001976a914c3f537bc307c7eda43d86b55695e46047b770ea388ac00cf7b05000000001976a91407bef290008c089a60321b21b1df2d7f2202f40388ac0000000001000000014ab7418ecda2b2531eef0145d4644a4c82a7da1edd285d1aab1ec0595ac06b69000000008c493046022100a796490f89e0ef0326e8460edebff9161da19c36e00c7408608135f72ef0e03e0221009e01ef7bc17cddce8dfda1f1a6d3805c51f9ab2f8f2145793d8e85e0dd6e55300141043e6d26812f24a5a9485c9d40b8712215f0c3a37b0334d76b2c24fcafa587ae5258853b6f49ceeb29cd13ebb76aa79099fad84f516bbba47bd170576b121052f1ffffffff0200a24a04000000001976a9143542e17b6229a25d5b76909f9d28dd6ed9295b2088ac003fab01000000001976a9149cea2b6e3e64ad982c99ebba56a882b9e8a816fe88ac00000000"], ["FIXME: need test cases for PoW"], ["Make diffs cleaner by leaving a comment here without comma at the end"] ] python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/script_invalid.json000066400000000000000000001454251430270607500304770ustar00rootroot00000000000000[ ["Format is: [scriptSig, scriptPubKey, flags, ... comments]"], ["It is evaluated as if there was a crediting coinbase transaction with two 0"], ["pushes as scriptSig, and one output of 0 satoshi and given scriptPubKey,"], ["followed by a spending transaction which spends this output as only input (and"], ["correct prevout hash), using the given scriptSig. All nLockTimes are 0, all"], ["nSequences are max."], ["", "DEPTH", "P2SH,STRICTENC", "Test the test: we should have an empty stack after scriptSig evaluation"], [" ", "DEPTH", "P2SH,STRICTENC", "and multiple spaces should not change that."], [" ", "DEPTH", "P2SH,STRICTENC"], [" ", "DEPTH", "P2SH,STRICTENC"], ["", "", "P2SH,STRICTENC"], ["", "NOP", "P2SH,STRICTENC"], ["", "NOP DEPTH", "P2SH,STRICTENC"], ["NOP", "", "P2SH,STRICTENC"], ["NOP", "DEPTH", "P2SH,STRICTENC"], ["NOP","NOP", "P2SH,STRICTENC"], ["NOP","NOP DEPTH", "P2SH,STRICTENC"], ["DEPTH", "", "P2SH,STRICTENC"], ["0x4c01","0x01 NOP", "P2SH,STRICTENC", "PUSHDATA1 with not enough bytes"], ["0x4d0200ff","0x01 NOP", "P2SH,STRICTENC", "PUSHDATA2 with not enough bytes"], ["0x4e03000000ffff","0x01 NOP", "P2SH,STRICTENC", "PUSHDATA4 with not enough bytes"], ["1", "IF 0x50 ENDIF 1", "P2SH,STRICTENC", "0x50 is reserved"], ["0x52", "0x5f ADD 0x60 EQUAL", "P2SH,STRICTENC", "0x51 through 0x60 push 1 through 16 onto stack"], ["0","NOP", "P2SH,STRICTENC"], ["1", "IF VER ELSE 1 ENDIF", "P2SH,STRICTENC", "VER non-functional"], ["0", "IF VERIF ELSE 1 ENDIF", "P2SH,STRICTENC", "VERIF illegal everywhere"], ["0", "IF ELSE 1 ELSE VERIF ENDIF", "P2SH,STRICTENC", "VERIF illegal everywhere"], ["0", "IF VERNOTIF ELSE 1 ENDIF", "P2SH,STRICTENC", "VERNOTIF illegal everywhere"], ["0", "IF ELSE 1 ELSE VERNOTIF ENDIF", "P2SH,STRICTENC", "VERNOTIF illegal everywhere"], ["1 IF", "1 ENDIF", "P2SH,STRICTENC", "IF/ENDIF can't span scriptSig/scriptPubKey"], ["1 IF 0 ENDIF", "1 ENDIF", "P2SH,STRICTENC"], ["1 ELSE 0 ENDIF", "1", "P2SH,STRICTENC"], ["0 NOTIF", "123", "P2SH,STRICTENC"], ["0", "DUP IF ENDIF", "P2SH,STRICTENC"], ["0", "IF 1 ENDIF", "P2SH,STRICTENC"], ["0", "DUP IF ELSE ENDIF", "P2SH,STRICTENC"], ["0", "IF 1 ELSE ENDIF", "P2SH,STRICTENC"], ["0", "NOTIF ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0 1", "IF IF 1 ELSE 0 ENDIF ENDIF", "P2SH,STRICTENC"], ["0 0", "IF IF 1 ELSE 0 ENDIF ENDIF", "P2SH,STRICTENC"], ["1 0", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "P2SH,STRICTENC"], ["0 1", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "P2SH,STRICTENC"], ["0 0", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "P2SH,STRICTENC"], ["0 1", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "P2SH,STRICTENC"], ["1 1", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "P2SH,STRICTENC"], ["0 0", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "P2SH,STRICTENC"], ["1", "IF RETURN ELSE ELSE 1 ENDIF", "P2SH,STRICTENC", "Multiple ELSEs"], ["1", "IF 1 ELSE ELSE RETURN ENDIF", "P2SH,STRICTENC"], ["1", "ENDIF", "P2SH,STRICTENC", "Malformed IF/ELSE/ENDIF sequence"], ["1", "ELSE ENDIF", "P2SH,STRICTENC"], ["1", "ENDIF ELSE", "P2SH,STRICTENC"], ["1", "ENDIF ELSE IF", "P2SH,STRICTENC"], ["1", "IF ELSE ENDIF ELSE", "P2SH,STRICTENC"], ["1", "IF ELSE ENDIF ELSE ENDIF", "P2SH,STRICTENC"], ["1", "IF ENDIF ENDIF", "P2SH,STRICTENC"], ["1", "IF ELSE ELSE ENDIF ENDIF", "P2SH,STRICTENC"], ["1", "RETURN", "P2SH,STRICTENC"], ["1", "DUP IF RETURN ENDIF", "P2SH,STRICTENC"], ["1", "RETURN 'data'", "P2SH,STRICTENC", "canonical prunable txout format"], ["0 IF", "RETURN ENDIF 1", "P2SH,STRICTENC", "still prunable because IF/ENDIF can't span scriptSig/scriptPubKey"], ["0", "VERIFY 1", "P2SH,STRICTENC"], ["1", "VERIFY", "P2SH,STRICTENC"], ["1", "VERIFY 0", "P2SH,STRICTENC"], ["1 TOALTSTACK", "FROMALTSTACK 1", "P2SH,STRICTENC", "alt stack not shared between sig/pubkey"], ["IFDUP", "DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["DROP", "DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["DUP", "DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["1", "DUP 1 ADD 2 EQUALVERIFY 0 EQUAL", "P2SH,STRICTENC"], ["NOP", "NIP", "P2SH,STRICTENC"], ["NOP", "1 NIP", "P2SH,STRICTENC"], ["NOP", "1 0 NIP", "P2SH,STRICTENC"], ["NOP", "OVER 1", "P2SH,STRICTENC"], ["1", "OVER", "P2SH,STRICTENC"], ["0 1", "OVER DEPTH 3 EQUALVERIFY", "P2SH,STRICTENC"], ["19 20 21", "PICK 19 EQUALVERIFY DEPTH 2 EQUAL", "P2SH,STRICTENC"], ["NOP", "0 PICK", "P2SH,STRICTENC"], ["1", "-1 PICK", "P2SH,STRICTENC"], ["19 20 21", "0 PICK 20 EQUALVERIFY DEPTH 3 EQUAL", "P2SH,STRICTENC"], ["19 20 21", "1 PICK 21 EQUALVERIFY DEPTH 3 EQUAL", "P2SH,STRICTENC"], ["19 20 21", "2 PICK 22 EQUALVERIFY DEPTH 3 EQUAL", "P2SH,STRICTENC"], ["NOP", "0 ROLL", "P2SH,STRICTENC"], ["1", "-1 ROLL", "P2SH,STRICTENC"], ["19 20 21", "0 ROLL 20 EQUALVERIFY DEPTH 2 EQUAL", "P2SH,STRICTENC"], ["19 20 21", "1 ROLL 21 EQUALVERIFY DEPTH 2 EQUAL", "P2SH,STRICTENC"], ["19 20 21", "2 ROLL 22 EQUALVERIFY DEPTH 2 EQUAL", "P2SH,STRICTENC"], ["NOP", "ROT 1", "P2SH,STRICTENC"], ["NOP", "1 ROT 1", "P2SH,STRICTENC"], ["NOP", "1 2 ROT 1", "P2SH,STRICTENC"], ["NOP", "0 1 2 ROT", "P2SH,STRICTENC"], ["NOP", "SWAP 1", "P2SH,STRICTENC"], ["1", "SWAP 1", "P2SH,STRICTENC"], ["0 1", "SWAP 1 EQUALVERIFY", "P2SH,STRICTENC"], ["NOP", "TUCK 1", "P2SH,STRICTENC"], ["1", "TUCK 1", "P2SH,STRICTENC"], ["1 0", "TUCK DEPTH 3 EQUALVERIFY SWAP 2DROP", "P2SH,STRICTENC"], ["NOP", "2DUP 1", "P2SH,STRICTENC"], ["1", "2DUP 1", "P2SH,STRICTENC"], ["NOP", "3DUP 1", "P2SH,STRICTENC"], ["1", "3DUP 1", "P2SH,STRICTENC"], ["1 2", "3DUP 1", "P2SH,STRICTENC"], ["NOP", "2OVER 1", "P2SH,STRICTENC"], ["1", "2 3 2OVER 1", "P2SH,STRICTENC"], ["NOP", "2SWAP 1", "P2SH,STRICTENC"], ["1", "2 3 2SWAP 1", "P2SH,STRICTENC"], ["'a' 'b'", "CAT", "P2SH,STRICTENC", "CAT disabled"], ["'a' 'b' 0", "IF CAT ELSE 1 ENDIF", "P2SH,STRICTENC", "CAT disabled"], ["'abc' 1 1", "SUBSTR", "P2SH,STRICTENC", "SUBSTR disabled"], ["'abc' 1 1 0", "IF SUBSTR ELSE 1 ENDIF", "P2SH,STRICTENC", "SUBSTR disabled"], ["'abc' 2 0", "IF LEFT ELSE 1 ENDIF", "P2SH,STRICTENC", "LEFT disabled"], ["'abc' 2 0", "IF RIGHT ELSE 1 ENDIF", "P2SH,STRICTENC", "RIGHT disabled"], ["NOP", "SIZE 1", "P2SH,STRICTENC"], ["'abc'", "IF INVERT ELSE 1 ENDIF", "P2SH,STRICTENC", "INVERT disabled"], ["1 2 0 IF AND ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "AND disabled"], ["1 2 0 IF OR ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "OR disabled"], ["1 2 0 IF XOR ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "XOR disabled"], ["2 0 IF 2MUL ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "2MUL disabled"], ["2 0 IF 2DIV ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "2DIV disabled"], ["2 2 0 IF MUL ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "MUL disabled"], ["2 2 0 IF DIV ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "DIV disabled"], ["2 2 0 IF MOD ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "MOD disabled"], ["2 2 0 IF LSHIFT ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "LSHIFT disabled"], ["2 2 0 IF RSHIFT ELSE 1 ENDIF", "NOP", "P2SH,STRICTENC", "RSHIFT disabled"], ["", "EQUAL NOT", "P2SH,STRICTENC", "EQUAL must error when there are no stack items"], ["0", "EQUAL NOT", "P2SH,STRICTENC", "EQUAL must error when there are not 2 stack items"], ["0 1","EQUAL", "P2SH,STRICTENC"], ["1 1 ADD", "0 EQUAL", "P2SH,STRICTENC"], ["11 1 ADD 12 SUB", "11 EQUAL", "P2SH,STRICTENC"], ["2147483648 0 ADD", "NOP", "P2SH,STRICTENC", "arithmetic operands must be in range [-2^31...2^31] "], ["-2147483648 0 ADD", "NOP", "P2SH,STRICTENC", "arithmetic operands must be in range [-2^31...2^31] "], ["2147483647 DUP ADD", "4294967294 NUMEQUAL", "P2SH,STRICTENC", "NUMEQUAL must be in numeric range"], ["'abcdef' NOT", "0 EQUAL", "P2SH,STRICTENC", "NOT is an arithmetic operand"], ["2 DUP MUL", "4 EQUAL", "P2SH,STRICTENC", "disabled"], ["2 DUP DIV", "1 EQUAL", "P2SH,STRICTENC", "disabled"], ["2 2MUL", "4 EQUAL", "P2SH,STRICTENC", "disabled"], ["2 2DIV", "1 EQUAL", "P2SH,STRICTENC", "disabled"], ["7 3 MOD", "1 EQUAL", "P2SH,STRICTENC", "disabled"], ["2 2 LSHIFT", "8 EQUAL", "P2SH,STRICTENC", "disabled"], ["2 1 RSHIFT", "1 EQUAL", "P2SH,STRICTENC", "disabled"], ["1","NOP1 CHECKLOCKTIMEVERIFY NOP3 NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10 2 EQUAL", "P2SH,STRICTENC"], ["'NOP_1_to_10' NOP1 CHECKLOCKTIMEVERIFY NOP3 NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10","'NOP_1_to_11' EQUAL", "P2SH,STRICTENC"], ["Ensure 100% coverage of discouraged NOPS"], ["1", "NOP1", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["1", "CHECKLOCKTIMEVERIFY", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["1", "NOP3", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["1", "NOP4", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["1", "NOP5", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["1", "NOP6", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["1", "NOP7", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["1", "NOP8", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["1", "NOP9", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["1", "NOP10", "P2SH,DISCOURAGE_UPGRADABLE_NOPS"], ["NOP10", "1", "P2SH,DISCOURAGE_UPGRADABLE_NOPS", "Discouraged NOP10 in scriptSig"], ["1 0x01 0xb9", "HASH160 0x14 0x15727299b05b45fdaf9ac9ecf7565cfe27c3e567 EQUAL", "P2SH,DISCOURAGE_UPGRADABLE_NOPS", "Discouraged NOP10 in redeemScript"], ["0x50","1", "P2SH,STRICTENC", "opcode 0x50 is reserved"], ["1", "IF 0xba ELSE 1 ENDIF", "P2SH,STRICTENC", "opcodes above NOP10 invalid if executed"], ["1", "IF 0xbb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xbc ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xbd ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xbe ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xbf ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc1 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc2 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc3 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc4 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc5 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc6 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc7 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc8 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xc9 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xca ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xcb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xcc ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xcd ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xce ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xcf ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd1 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd2 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd3 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd4 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd5 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd6 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd7 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd8 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xd9 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xda ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xdb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xdc ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xdd ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xde ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xdf ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe1 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe2 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe3 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe4 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe5 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe6 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe7 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe8 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xe9 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xea ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xeb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xec ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xed ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xee ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xef ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf1 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf2 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf3 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf4 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf5 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf6 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf7 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf8 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xf9 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xfa ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xfb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xfc ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xfd ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xfe ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 0xff ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1 IF 1 ELSE", "0xff ENDIF", "P2SH,STRICTENC", "invalid because scriptSig and scriptPubKey are processed separately"], ["NOP", "RIPEMD160", "P2SH,STRICTENC"], ["NOP", "SHA1", "P2SH,STRICTENC"], ["NOP", "SHA256", "P2SH,STRICTENC"], ["NOP", "HASH160", "P2SH,STRICTENC"], ["NOP", "HASH256", "P2SH,STRICTENC"], ["NOP", "'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'", "P2SH,STRICTENC", ">520 byte push"], ["0", "IF 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' ENDIF 1", "P2SH,STRICTENC", ">520 byte push in non-executed IF branch"], ["1", "0x61616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161", "P2SH,STRICTENC", ">201 opcodes executed. 0x61 is NOP"], ["0", "IF 0x6161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161 ENDIF 1", "P2SH,STRICTENC", ">201 opcodes including non-executed IF branch. 0x61 is NOP"], ["1 2 3 4 5 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f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6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f 2DUP 0x616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161", "P2SH,STRICTENC", "10,001-byte scriptPubKey"], ["NOP1","NOP10", "P2SH,STRICTENC"], ["1","VER", "P2SH,STRICTENC", "OP_VER is reserved"], ["1","VERIF", "P2SH,STRICTENC", "OP_VERIF is reserved"], ["1","VERNOTIF", "P2SH,STRICTENC", "OP_VERNOTIF is reserved"], ["1","RESERVED", "P2SH,STRICTENC", "OP_RESERVED is reserved"], ["1","RESERVED1", "P2SH,STRICTENC", "OP_RESERVED1 is reserved"], ["1","RESERVED2", "P2SH,STRICTENC", "OP_RESERVED2 is reserved"], ["1","0xba", "P2SH,STRICTENC", "0xba == OP_NOP10 + 1"], ["2147483648", "1ADD 1", "P2SH,STRICTENC", "We cannot do math on 5-byte integers"], ["2147483648", "NEGATE 1", "P2SH,STRICTENC", "We cannot do math on 5-byte integers"], ["-2147483648", "1ADD 1", "P2SH,STRICTENC", "Because we use a sign bit, -2147483648 is also 5 bytes"], ["2147483647", "1ADD 1SUB 1", "P2SH,STRICTENC", "We cannot do math on 5-byte integers, even if the result is 4-bytes"], ["2147483648", "1SUB 1", "P2SH,STRICTENC", "We cannot do math on 5-byte integers, even if the result is 4-bytes"], ["2147483648 1", "BOOLOR 1", "P2SH,STRICTENC", "We cannot do BOOLOR on 5-byte integers (but we can still do IF etc)"], ["2147483648 1", "BOOLAND 1", "P2SH,STRICTENC", "We cannot do BOOLAND on 5-byte integers"], ["1", "1 ENDIF", "P2SH,STRICTENC", "ENDIF without IF"], ["1", "IF 1", "P2SH,STRICTENC", "IF without ENDIF"], ["1 IF 1", "ENDIF", "P2SH,STRICTENC", "IFs don't carry over"], ["NOP", "IF 1 ENDIF", "P2SH,STRICTENC", "The following tests check the if(stack.size() < N) tests in each opcode"], ["NOP", "NOTIF 1 ENDIF", "P2SH,STRICTENC", "They are here to catch copy-and-paste errors"], ["NOP", "VERIFY 1", "P2SH,STRICTENC", "Most of them are duplicated elsewhere,"], ["NOP", "TOALTSTACK 1", "P2SH,STRICTENC", "but, hey, more is always better, right?"], ["1", "FROMALTSTACK", "P2SH,STRICTENC"], ["1", "2DROP 1", "P2SH,STRICTENC"], ["1", "2DUP", "P2SH,STRICTENC"], ["1 1", "3DUP", "P2SH,STRICTENC"], ["1 1 1", "2OVER", "P2SH,STRICTENC"], ["1 1 1 1 1", "2ROT", "P2SH,STRICTENC"], ["1 1 1", "2SWAP", "P2SH,STRICTENC"], ["NOP", "IFDUP 1", "P2SH,STRICTENC"], ["NOP", "DROP 1", "P2SH,STRICTENC"], ["NOP", "DUP 1", "P2SH,STRICTENC"], ["1", "NIP", "P2SH,STRICTENC"], ["1", "OVER", "P2SH,STRICTENC"], ["1 1 1 3", "PICK", "P2SH,STRICTENC"], ["0", "PICK 1", "P2SH,STRICTENC"], ["1 1 1 3", "ROLL", "P2SH,STRICTENC"], ["0", "ROLL 1", "P2SH,STRICTENC"], ["1 1", "ROT", "P2SH,STRICTENC"], ["1", "SWAP", "P2SH,STRICTENC"], ["1", "TUCK", "P2SH,STRICTENC"], ["NOP", "SIZE 1", "P2SH,STRICTENC"], ["1", "EQUAL 1", "P2SH,STRICTENC"], ["1", "EQUALVERIFY 1", "P2SH,STRICTENC"], ["NOP", "1ADD 1", "P2SH,STRICTENC"], ["NOP", "1SUB 1", "P2SH,STRICTENC"], ["NOP", "NEGATE 1", "P2SH,STRICTENC"], ["NOP", "ABS 1", "P2SH,STRICTENC"], ["NOP", "NOT 1", "P2SH,STRICTENC"], ["NOP", "0NOTEQUAL 1", "P2SH,STRICTENC"], ["1", "ADD", "P2SH,STRICTENC"], ["1", "SUB", "P2SH,STRICTENC"], ["1", "BOOLAND", "P2SH,STRICTENC"], ["1", "BOOLOR", "P2SH,STRICTENC"], ["1", "NUMEQUAL", "P2SH,STRICTENC"], ["1", "NUMEQUALVERIFY 1", "P2SH,STRICTENC"], ["1", "NUMNOTEQUAL", "P2SH,STRICTENC"], ["1", "LESSTHAN", "P2SH,STRICTENC"], ["1", "GREATERTHAN", "P2SH,STRICTENC"], ["1", "LESSTHANOREQUAL", "P2SH,STRICTENC"], ["1", "GREATERTHANOREQUAL", "P2SH,STRICTENC"], ["1", "MIN", "P2SH,STRICTENC"], ["1", "MAX", "P2SH,STRICTENC"], ["1 1", "WITHIN", "P2SH,STRICTENC"], ["NOP", "RIPEMD160 1", "P2SH,STRICTENC"], ["NOP", "SHA1 1", "P2SH,STRICTENC"], ["NOP", "SHA256 1", "P2SH,STRICTENC"], ["NOP", "HASH160 1", "P2SH,STRICTENC"], ["NOP", "HASH256 1", "P2SH,STRICTENC"], ["Increase CHECKSIG and CHECKMULTISIG negative test coverage"], ["", "CHECKSIG NOT", "STRICTENC", "CHECKSIG must error when there are no stack items"], ["0", "CHECKSIG NOT", "STRICTENC", "CHECKSIG must error when there are not 2 stack items"], ["", "CHECKMULTISIG NOT", "STRICTENC", "CHECKMULTISIG must error when there are no stack items"], ["", "-1 CHECKMULTISIG NOT", "STRICTENC", "CHECKMULTISIG must error when the specified number of pubkeys is negative"], ["", "1 CHECKMULTISIG NOT", "STRICTENC", "CHECKMULTISIG must error when there are not enough pubkeys on the stack"], ["", "-1 0 CHECKMULTISIG NOT", "STRICTENC", "CHECKMULTISIG must error when the specified number of signatures is negative"], ["", "1 'pk1' 1 CHECKMULTISIG NOT", "STRICTENC", "CHECKMULTISIG must error when there are not enough signatures on the stack"], ["", "'dummy' 'sig1' 1 'pk1' 1 CHECKMULTISIG IF 1 ENDIF", "", "CHECKMULTISIG must push false to stack when signature is invalid when NOT in strict enc mode"], ["", "0 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG", "P2SH,STRICTENC", "202 CHECKMULTISIGS, fails due to 201 op limit"], ["1", "0 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY 0 0 CHECKMULTISIGVERIFY", "P2SH,STRICTENC"], ["", "NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG 0 0 'a' 'b' 'c' 'd' 'e' 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' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY", "P2SH,STRICTENC"], ["0 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21", "21 CHECKMULTISIG 1", "P2SH,STRICTENC", "nPubKeys > 20"], ["0 'sig' 1 0", "CHECKMULTISIG 1", "P2SH,STRICTENC", "nSigs > nPubKeys"], ["NOP 0x01 1", "HASH160 0x14 0xda1745e9b549bd0bfa1a569971c77eba30cd5a4b EQUAL", "P2SH,STRICTENC", "Tests for Script.IsPushOnly()"], ["NOP1 0x01 1", "HASH160 0x14 0xda1745e9b549bd0bfa1a569971c77eba30cd5a4b EQUAL", "P2SH,STRICTENC"], ["0 0x01 0x50", "HASH160 0x14 0xece424a6bb6ddf4db592c0faed60685047a361b1 EQUAL", "P2SH,STRICTENC", "OP_RESERVED in P2SH should fail"], ["0 0x01 VER", "HASH160 0x14 0x0f4d7845db968f2a81b530b6f3c1d6246d4c7e01 EQUAL", "P2SH,STRICTENC", "OP_VER in P2SH should fail"], ["0x00", "'00' EQUAL", "P2SH,STRICTENC", "Basic OP_0 execution"], ["Automatically generated test cases"], [ "0x47 0x304402200a5c6163f07b8c3b013c4d1d6dba25e780b39658d79ba37af7057a3b7f15ffa102201fd9b4eaa9943f734928b99a83592c2e7bf342ea2680f6a2bb705167966b742001", "0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG", "", "P2PK, bad sig" ], [ "0x47 0x3044022034bb0494b50b8ef130e2185bb220265b9284ef5b4b8a8da4d8415df489c83b5102206259a26d9cc0a125ac26af6153b17c02956855ebe1467412f066e402f5f05d1201 0x21 0x03363d90d446b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640", "DUP HASH160 0x14 0xc0834c0c158f53be706d234c38fd52de7eece656 EQUALVERIFY CHECKSIG", "", "P2PKH, bad pubkey" ], [ "0x47 0x304402204710a85181663b32d25c70ec2bbd14adff5ddfff6cb50d09e155ef5f541fc86c0220056b0cc949be9386ecc5f6c2ac0493269031dbb185781db90171b54ac127790201", "0x41 0x048282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f5150811f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf CHECKSIG", "", "P2PK anyonecanpay marked with normal hashtype" ], [ "0x47 0x3044022003fef42ed6c7be8917441218f525a60e2431be978e28b7aca4d7a532cc413ae8022067a1f82c74e8d69291b90d148778405c6257bbcfc2353cc38a3e1f22bf44254601 0x23 0x210279be667ef9dcbbac54a06295ce870b07029bfcdb2dce28d959f2815b16f81798ac", "HASH160 0x14 0x23b0ad3477f2178bc0b3eed26e4e6316f4e83aa1 EQUAL", "P2SH", "P2SH(P2PK), bad redeemscript" ], [ "0x47 0x304402204e2eb034be7b089534ac9e798cf6a2c79f38bcb34d1b179efd6f2de0841735db022071461beb056b5a7be1819da6a3e3ce3662831ecc298419ca101eb6887b5dd6a401 0x19 0x76a9147cf9c846cd4882efec4bf07e44ebdad495c94f4b88ac", "HASH160 0x14 0x2df519943d5acc0ef5222091f9dfe3543f489a82 EQUAL", "P2SH", "P2SH(P2PKH), bad sig" ], [ "0 0x47 0x3044022051254b9fb476a52d85530792b578f86fea70ec1ffb4393e661bcccb23d8d63d3022076505f94a403c86097841944e044c70c2045ce90e36de51f7e9d3828db98a07501 0x47 0x304402200a358f750934b3feb822f1966bfcd8bbec9eeaa3a8ca941e11ee5960e181fa01022050bf6b5a8e7750f70354ae041cb68a7bade67ec6c3ab19eb359638974410626e01 0", "3 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 3 CHECKMULTISIG", "", "3-of-3, 2 sigs" ], [ "0 0x47 0x304402205b7d2c2f177ae76cfbbf14d589c113b0b35db753d305d5562dd0b61cbf366cfb02202e56f93c4f08a27f986cd424ffc48a462c3202c4902104d4d0ff98ed28f4bf8001 0 0x4c69 0x52210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179821038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f515082103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff464053ae", "HASH160 0x14 0xc9e4a896d149702d0d1695434feddd52e24ad78d EQUAL", "P2SH", "P2SH(2-of-3), 1 sig" ], [ "0x47 0x30440220005ece1335e7f657a1a1f476a7fb5bd90964e8a022489f890614a04acfb734c002206c12b8294a6513c7710e8c82d3c23d75cdbfe83200eb7efb495701958501a5d601", "0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 CHECKSIG NOT", "", "P2PK NOT with too much R padding but no DERSIG" ], [ "0x47 0x304402208e43c0b91f7c1e5bc58e41c8185f8a6086e111b0090187968a86f2822462d3c902200a58f4076b1133b18ff1dc83ee51676e44c60cc608d9534e0df5ace0424fc0be01", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG NOT", "", "BIP66 example 2, without DERSIG" ], [ "0", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG", "", "BIP66 example 3, without DERSIG" ], [ "1", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG", "", "BIP66 example 5, without DERSIG" ], [ "0 0x47 0x30440220b119d67d389315308d1745f734a51ff3ec72e06081e84e236fdf9dc2f5d2a64802204b04e3bc38674c4422ea317231d642b56dc09d214a1ecbbf16ecca01ed996e2201 0x47 0x3044022079ea80afd538d9ada421b5101febeb6bc874e01dde5bca108c1d0479aec339a4022004576db8f66130d1df686ccf00935703689d69cf539438da1edab208b0d63c4801", "2 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 2 CHECKMULTISIG NOT", "", "BIP66 example 8, without DERSIG" ], [ "0 0 0x47 0x3044022081aa9d436f2154e8b6d600516db03d78de71df685b585a9807ead4210bd883490220534bb6bdf318a419ac0749660b60e78d17d515558ef369bf872eff405b676b2e01", "2 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 2 CHECKMULTISIG", "", "BIP66 example 9, without DERSIG" ], [ "0 0x47 0x30440220cae00b1444babfbf6071b0ba8707f6bd373da3df494d6e74119b0430c5db810502205d5231b8c5939c8ff0c82242656d6e06edb073d42af336c99fe8837c36ea39d501 0", "2 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 2 CHECKMULTISIG", "", "BIP66 example 11, without DERSIG" ], [ "0x47 0x30440220035d554e3153c14950c9993f41c496607a8e24093db0595be7bf875cf64fcf1f02204731c8c4e5daf15e706cec19cdd8f2c5b1d05490e11dab8465ed426569b6e92101", "0x41 0x0679be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG NOT", "", "P2PK NOT with hybrid pubkey but no STRICTENC" ], [ "0x47 0x30440220035d554e3153c14950c9993f41c496607a8e24093db0595be7bf875cf64fcf1f02204731c8c4e5daf15e706cec19cdd8f2c5b1d05490e11dab8465ed426569b6e92101", "0x41 0x0679be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG NOT", "STRICTENC", "P2PK NOT with hybrid pubkey" ], [ "1 0x47 0x3044022051254b9fb476a52d85530792b578f86fea70ec1ffb4393e661bcccb23d8d63d3022076505f94a403c86097841944e044c70c2045ce90e36de51f7e9d3828db98a07501 0x47 0x304402200a358f750934b3feb822f1966bfcd8bbec9eeaa3a8ca941e11ee5960e181fa01022050bf6b5a8e7750f70354ae041cb68a7bade67ec6c3ab19eb359638974410626e01 0x47 0x304402200955d031fff71d8653221e85e36c3c85533d2312fc3045314b19650b7ae2f81002202a6bb8505e36201909d0921f01abff390ae6b7ff97bbf959f98aedeb0a56730901", "3 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 3 CHECKMULTISIG", "NULLDUMMY", "3-of-3 with nonzero dummy" ], [ "1 0x47 0x304402201bb2edab700a5d020236df174fefed78087697143731f659bea59642c759c16d022061f42cdbae5bcd3e8790f20bf76687443436e94a634321c16a72aa54cbc7c2ea01 0x47 0x304402204bb4a64f2a6e5c7fb2f07fef85ee56fde5e6da234c6a984262307a20e99842d702206f8303aaba5e625d223897e2ffd3f88ef1bcffef55f38dc3768e5f2e94c923f901 0x47 0x3044022040c2809b71fffb155ec8b82fe7a27f666bd97f941207be4e14ade85a1249dd4d02204d56c85ec525dd18e29a0533d5ddf61b6b1bb32980c2f63edf951aebf7a27bfe01", "3 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 3 CHECKMULTISIG NOT", "NULLDUMMY", "3-of-3 NOT with invalid sig with nonzero dummy" ], [ "0x47 0x304402203e4516da7253cf068effec6b95c41221c0cf3a8e6ccb8cbf1725b562e9afde2c022054e1c258c2981cdfba5df1f46661fb6541c44f77ca0092f3600331abfffb125101 0x23 0x2103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640ac", "0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 CHECKSIG", "", "P2SH(P2PK) with non-push scriptSig but no SIGPUSHONLY" ], [ "0 0x47 0x304402205451ce65ad844dbb978b8bdedf5082e33b43cae8279c30f2c74d9e9ee49a94f802203fe95a7ccf74da7a232ee523ef4a53cb4d14bdd16289680cdb97a63819b8f42f01 0x46 0x304402205451ce65ad844dbb978b8bdedf5082e33b43cae8279c30f2c74d9e9ee49a94f802203fe95a7ccf74da7a232ee523ef4a53cb4d14bdd16289680cdb97a63819b8f42f", "2 0x21 0x02a673638cb9587cb68ea08dbef685c6f2d2a751a8b3c6f2a7e9a4999e6e4bfaf5 0x21 0x02a673638cb9587cb68ea08dbef685c6f2d2a751a8b3c6f2a7e9a4999e6e4bfaf5 0x21 0x02a673638cb9587cb68ea08dbef685c6f2d2a751a8b3c6f2a7e9a4999e6e4bfaf5 3 CHECKMULTISIG", "P2SH,STRICTENC", "2-of-3 with one valid and one invalid signature due to parse error, nSigs > validSigs" ], [ "11 0x47 0x304402200a5c6163f07b8d3b013c4d1d6dba25e780b39658d79ba37af7057a3b7f15ffa102201fd9b4eaa9943f734928b99a83592c2e7bf342ea2680f6a2bb705167966b742001", "0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG", "CLEANSTACK,P2SH", "P2PK with unnecessary input" ], [ "11 0x47 0x304402202f7505132be14872581f35d74b759212d9da40482653f1ffa3116c3294a4a51702206adbf347a2240ca41c66522b1a22a41693610b76a8e7770645dc721d1635854f01 0x43 0x410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8ac", "HASH160 0x14 0x31edc23bdafda4639e669f89ad6b2318dd79d032 EQUAL", "CLEANSTACK,P2SH", "P2SH with unnecessary input" ], ["The End"] ] python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/script_valid.json000066400000000000000000002546061430270607500301520ustar00rootroot00000000000000[ ["Format is: [scriptSig, scriptPubKey, flags, ... comments]"], ["It is evaluated as if there was a crediting coinbase transaction with two 0"], ["pushes as scriptSig, and one output of 0 satoshi and given scriptPubKey,"], ["followed by a spending transaction which spends this output as only input (and"], ["correct prevout hash), using the given scriptSig. All nLockTimes are 0, all"], ["nSequences are max."], ["", "DEPTH 0 EQUAL", "P2SH,STRICTENC", "Test the test: we should have an empty stack after scriptSig evaluation"], [" ", "DEPTH 0 EQUAL", "P2SH,STRICTENC", "and multiple spaces should not change that."], [" ", "DEPTH 0 EQUAL", "P2SH,STRICTENC"], [" ", "DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["1 2", "2 EQUALVERIFY 1 EQUAL", "P2SH,STRICTENC", "Similarly whitespace around and between symbols"], ["1 2", "2 EQUALVERIFY 1 EQUAL", "P2SH,STRICTENC"], [" 1 2", "2 EQUALVERIFY 1 EQUAL", "P2SH,STRICTENC"], ["1 2 ", "2 EQUALVERIFY 1 EQUAL", "P2SH,STRICTENC"], [" 1 2 ", "2 EQUALVERIFY 1 EQUAL", "P2SH,STRICTENC"], ["1", "", "P2SH,STRICTENC"], ["0x02 0x01 0x00", "", "P2SH,STRICTENC", "all bytes are significant, not only the last one"], ["0x09 0x00000000 0x00000000 0x10", "", "P2SH,STRICTENC", "equals zero when cast to Int64"], ["0x01 0x0b", "11 EQUAL", "P2SH,STRICTENC", "push 1 byte"], ["0x02 0x417a", "'Az' EQUAL", "P2SH,STRICTENC"], ["0x4b 0x417a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a7a", "'Azzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz' EQUAL", "P2SH,STRICTENC", "push 75 bytes"], ["0x4c 0x01 0x07","7 EQUAL", "P2SH,STRICTENC", "0x4c is OP_PUSHDATA1"], ["0x4d 0x0100 0x08","8 EQUAL", "P2SH,STRICTENC", "0x4d is OP_PUSHDATA2"], ["0x4e 0x01000000 0x09","9 EQUAL", "P2SH,STRICTENC", "0x4e is OP_PUSHDATA4"], ["0x4c 0x00","0 EQUAL", "P2SH,STRICTENC"], ["0x4d 0x0000","0 EQUAL", "P2SH,STRICTENC"], ["0x4e 0x00000000","0 EQUAL", "P2SH,STRICTENC"], ["0x4f 1000 ADD","999 EQUAL", "P2SH,STRICTENC"], ["0", "IF 0x50 ENDIF 1", "P2SH,STRICTENC", "0x50 is reserved (ok if not executed)"], ["0x51", "0x5f ADD 0x60 EQUAL", "P2SH,STRICTENC", "0x51 through 0x60 push 1 through 16 onto stack"], ["1","NOP", "P2SH,STRICTENC"], ["0", "IF VER ELSE 1 ENDIF", "P2SH,STRICTENC", "VER non-functional (ok if not executed)"], ["0", "IF RESERVED RESERVED1 RESERVED2 ELSE 1 ENDIF", "P2SH,STRICTENC", "RESERVED ok in un-executed IF"], ["1", "DUP IF ENDIF", "P2SH,STRICTENC"], ["1", "IF 1 ENDIF", "P2SH,STRICTENC"], ["1", "DUP IF ELSE ENDIF", "P2SH,STRICTENC"], ["1", "IF 1 ELSE ENDIF", "P2SH,STRICTENC"], ["0", "IF ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1 1", "IF IF 1 ELSE 0 ENDIF ENDIF", "P2SH,STRICTENC"], ["1 0", "IF IF 1 ELSE 0 ENDIF ENDIF", "P2SH,STRICTENC"], ["1 1", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "P2SH,STRICTENC"], ["0 0", "IF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "P2SH,STRICTENC"], ["1 0", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "P2SH,STRICTENC"], ["1 1", "NOTIF IF 1 ELSE 0 ENDIF ENDIF", "P2SH,STRICTENC"], ["1 0", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "P2SH,STRICTENC"], ["0 1", "NOTIF IF 1 ELSE 0 ENDIF ELSE IF 0 ELSE 1 ENDIF ENDIF", "P2SH,STRICTENC"], ["0", "IF 0 ELSE 1 ELSE 0 ENDIF", "P2SH,STRICTENC", "Multiple ELSE's are valid and executed inverts on each ELSE encountered"], ["1", "IF 1 ELSE 0 ELSE ENDIF", "P2SH,STRICTENC"], ["1", "IF ELSE 0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["1", "IF 1 ELSE 0 ELSE 1 ENDIF ADD 2 EQUAL", "P2SH,STRICTENC"], ["'' 1", "IF SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ENDIF 0x14 0x68ca4fec736264c13b859bac43d5173df6871682 EQUAL", "P2SH,STRICTENC"], ["1", "NOTIF 0 ELSE 1 ELSE 0 ENDIF", "P2SH,STRICTENC", "Multiple ELSE's are valid and execution inverts on each ELSE encountered"], ["0", "NOTIF 1 ELSE 0 ELSE ENDIF", "P2SH,STRICTENC"], ["0", "NOTIF ELSE 0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "NOTIF 1 ELSE 0 ELSE 1 ENDIF ADD 2 EQUAL", "P2SH,STRICTENC"], ["'' 0", "NOTIF SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ELSE ELSE SHA1 ENDIF 0x14 0x68ca4fec736264c13b859bac43d5173df6871682 EQUAL", "P2SH,STRICTENC"], ["0", "IF 1 IF RETURN ELSE RETURN ELSE RETURN ENDIF ELSE 1 IF 1 ELSE RETURN ELSE 1 ENDIF ELSE RETURN ENDIF ADD 2 EQUAL", "P2SH,STRICTENC", "Nested ELSE ELSE"], ["1", "NOTIF 0 NOTIF RETURN ELSE RETURN ELSE RETURN ENDIF ELSE 0 NOTIF 1 ELSE RETURN ELSE 1 ENDIF ELSE RETURN ENDIF ADD 2 EQUAL", "P2SH,STRICTENC"], ["0", "IF RETURN ENDIF 1", "P2SH,STRICTENC", "RETURN only works if executed"], ["1 1", "VERIFY", "P2SH,STRICTENC"], ["1 0x05 0x01 0x00 0x00 0x00 0x00", "VERIFY", "P2SH,STRICTENC", "values >4 bytes can be cast to boolean"], ["1 0x01 0x80", "IF 0 ENDIF", "P2SH,STRICTENC", "negative 0 is false"], ["10 0 11 TOALTSTACK DROP FROMALTSTACK", "ADD 21 EQUAL", "P2SH,STRICTENC"], ["'gavin_was_here' TOALTSTACK 11 FROMALTSTACK", "'gavin_was_here' EQUALVERIFY 11 EQUAL", "P2SH,STRICTENC"], ["0 IFDUP", "DEPTH 1 EQUALVERIFY 0 EQUAL", "P2SH,STRICTENC"], ["1 IFDUP", "DEPTH 2 EQUALVERIFY 1 EQUALVERIFY 1 EQUAL", "P2SH,STRICTENC"], ["0x05 0x0100000000 IFDUP", "DEPTH 2 EQUALVERIFY 0x05 0x0100000000 EQUAL", "P2SH,STRICTENC", "IFDUP dups non ints"], ["0 DROP", "DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["0", "DUP 1 ADD 1 EQUALVERIFY 0 EQUAL", "P2SH,STRICTENC"], ["0 1", "NIP", "P2SH,STRICTENC"], ["1 0", "OVER DEPTH 3 EQUALVERIFY", "P2SH,STRICTENC"], ["22 21 20", "0 PICK 20 EQUALVERIFY DEPTH 3 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "1 PICK 21 EQUALVERIFY DEPTH 3 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "2 PICK 22 EQUALVERIFY DEPTH 3 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "0 ROLL 20 EQUALVERIFY DEPTH 2 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "1 ROLL 21 EQUALVERIFY DEPTH 2 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "2 ROLL 22 EQUALVERIFY DEPTH 2 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "ROT 22 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "ROT DROP 20 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "ROT DROP DROP 21 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "ROT ROT 21 EQUAL", "P2SH,STRICTENC"], ["22 21 20", "ROT ROT ROT 20 EQUAL", "P2SH,STRICTENC"], ["25 24 23 22 21 20", "2ROT 24 EQUAL", "P2SH,STRICTENC"], ["25 24 23 22 21 20", "2ROT DROP 25 EQUAL", "P2SH,STRICTENC"], ["25 24 23 22 21 20", "2ROT 2DROP 20 EQUAL", "P2SH,STRICTENC"], ["25 24 23 22 21 20", "2ROT 2DROP DROP 21 EQUAL", "P2SH,STRICTENC"], ["25 24 23 22 21 20", "2ROT 2DROP 2DROP 22 EQUAL", "P2SH,STRICTENC"], ["25 24 23 22 21 20", "2ROT 2DROP 2DROP DROP 23 EQUAL", "P2SH,STRICTENC"], ["25 24 23 22 21 20", "2ROT 2ROT 22 EQUAL", "P2SH,STRICTENC"], ["25 24 23 22 21 20", "2ROT 2ROT 2ROT 20 EQUAL", "P2SH,STRICTENC"], ["1 0", "SWAP 1 EQUALVERIFY 0 EQUAL", "P2SH,STRICTENC"], ["0 1", "TUCK DEPTH 3 EQUALVERIFY SWAP 2DROP", "P2SH,STRICTENC"], ["13 14", "2DUP ROT EQUALVERIFY EQUAL", "P2SH,STRICTENC"], ["-1 0 1 2", "3DUP DEPTH 7 EQUALVERIFY ADD ADD 3 EQUALVERIFY 2DROP 0 EQUALVERIFY", "P2SH,STRICTENC"], ["1 2 3 5", "2OVER ADD ADD 8 EQUALVERIFY ADD ADD 6 EQUAL", "P2SH,STRICTENC"], ["1 3 5 7", "2SWAP ADD 4 EQUALVERIFY ADD 12 EQUAL", "P2SH,STRICTENC"], ["0", "SIZE 0 EQUAL", "P2SH,STRICTENC"], ["1", "SIZE 1 EQUAL", "P2SH,STRICTENC"], ["127", "SIZE 1 EQUAL", "P2SH,STRICTENC"], ["128", "SIZE 2 EQUAL", "P2SH,STRICTENC"], ["32767", "SIZE 2 EQUAL", "P2SH,STRICTENC"], ["32768", "SIZE 3 EQUAL", "P2SH,STRICTENC"], ["8388607", "SIZE 3 EQUAL", "P2SH,STRICTENC"], ["8388608", "SIZE 4 EQUAL", "P2SH,STRICTENC"], ["2147483647", "SIZE 4 EQUAL", "P2SH,STRICTENC"], ["2147483648", "SIZE 5 EQUAL", "P2SH,STRICTENC"], ["549755813887", "SIZE 5 EQUAL", "P2SH,STRICTENC"], ["549755813888", "SIZE 6 EQUAL", "P2SH,STRICTENC"], ["9223372036854775807", "SIZE 8 EQUAL", "P2SH,STRICTENC"], ["-1", "SIZE 1 EQUAL", "P2SH,STRICTENC"], ["-127", "SIZE 1 EQUAL", "P2SH,STRICTENC"], ["-128", "SIZE 2 EQUAL", "P2SH,STRICTENC"], ["-32767", "SIZE 2 EQUAL", "P2SH,STRICTENC"], ["-32768", "SIZE 3 EQUAL", "P2SH,STRICTENC"], ["-8388607", "SIZE 3 EQUAL", "P2SH,STRICTENC"], ["-8388608", "SIZE 4 EQUAL", "P2SH,STRICTENC"], ["-2147483647", "SIZE 4 EQUAL", "P2SH,STRICTENC"], ["-2147483648", "SIZE 5 EQUAL", "P2SH,STRICTENC"], ["-549755813887", "SIZE 5 EQUAL", "P2SH,STRICTENC"], ["-549755813888", "SIZE 6 EQUAL", "P2SH,STRICTENC"], ["-9223372036854775807", "SIZE 8 EQUAL", "P2SH,STRICTENC"], ["'abcdefghijklmnopqrstuvwxyz'", "SIZE 26 EQUAL", "P2SH,STRICTENC"], ["42", "SIZE 1 EQUALVERIFY 42 EQUAL", "P2SH,STRICTENC", "SIZE does not consume argument"], ["2 -2 ADD", "0 EQUAL", "P2SH,STRICTENC"], ["2147483647 -2147483647 ADD", "0 EQUAL", "P2SH,STRICTENC"], ["-1 -1 ADD", "-2 EQUAL", "P2SH,STRICTENC"], ["0 0","EQUAL", "P2SH,STRICTENC"], ["1 1 ADD", "2 EQUAL", "P2SH,STRICTENC"], ["1 1ADD", "2 EQUAL", "P2SH,STRICTENC"], ["111 1SUB", "110 EQUAL", "P2SH,STRICTENC"], ["111 1 ADD 12 SUB", "100 EQUAL", "P2SH,STRICTENC"], ["0 ABS", "0 EQUAL", "P2SH,STRICTENC"], ["16 ABS", "16 EQUAL", "P2SH,STRICTENC"], ["-16 ABS", "-16 NEGATE EQUAL", "P2SH,STRICTENC"], ["0 NOT", "NOP", "P2SH,STRICTENC"], ["1 NOT", "0 EQUAL", "P2SH,STRICTENC"], ["11 NOT", "0 EQUAL", "P2SH,STRICTENC"], ["0 0NOTEQUAL", "0 EQUAL", "P2SH,STRICTENC"], ["1 0NOTEQUAL", "1 EQUAL", "P2SH,STRICTENC"], ["111 0NOTEQUAL", "1 EQUAL", "P2SH,STRICTENC"], ["-111 0NOTEQUAL", "1 EQUAL", "P2SH,STRICTENC"], ["1 1 BOOLAND", "NOP", "P2SH,STRICTENC"], ["1 0 BOOLAND", "NOT", "P2SH,STRICTENC"], ["0 1 BOOLAND", "NOT", "P2SH,STRICTENC"], ["0 0 BOOLAND", "NOT", "P2SH,STRICTENC"], ["16 17 BOOLAND", "NOP", "P2SH,STRICTENC"], ["1 1 BOOLOR", "NOP", "P2SH,STRICTENC"], ["1 0 BOOLOR", "NOP", "P2SH,STRICTENC"], ["0 1 BOOLOR", "NOP", "P2SH,STRICTENC"], ["0 0 BOOLOR", "NOT", "P2SH,STRICTENC"], ["16 17 BOOLOR", "NOP", "P2SH,STRICTENC"], ["11 10 1 ADD", "NUMEQUAL", "P2SH,STRICTENC"], ["11 10 1 ADD", "NUMEQUALVERIFY 1", "P2SH,STRICTENC"], ["11 10 1 ADD", "NUMNOTEQUAL NOT", "P2SH,STRICTENC"], ["111 10 1 ADD", "NUMNOTEQUAL", "P2SH,STRICTENC"], ["11 10", "LESSTHAN NOT", "P2SH,STRICTENC"], ["4 4", "LESSTHAN NOT", "P2SH,STRICTENC"], ["10 11", "LESSTHAN", "P2SH,STRICTENC"], ["-11 11", "LESSTHAN", "P2SH,STRICTENC"], ["-11 -10", "LESSTHAN", "P2SH,STRICTENC"], ["11 10", "GREATERTHAN", "P2SH,STRICTENC"], ["4 4", "GREATERTHAN NOT", "P2SH,STRICTENC"], ["10 11", "GREATERTHAN NOT", "P2SH,STRICTENC"], ["-11 11", "GREATERTHAN NOT", "P2SH,STRICTENC"], ["-11 -10", "GREATERTHAN NOT", "P2SH,STRICTENC"], ["11 10", "LESSTHANOREQUAL NOT", "P2SH,STRICTENC"], ["4 4", "LESSTHANOREQUAL", "P2SH,STRICTENC"], ["10 11", "LESSTHANOREQUAL", "P2SH,STRICTENC"], ["-11 11", "LESSTHANOREQUAL", "P2SH,STRICTENC"], ["-11 -10", "LESSTHANOREQUAL", "P2SH,STRICTENC"], ["11 10", "GREATERTHANOREQUAL", "P2SH,STRICTENC"], ["4 4", "GREATERTHANOREQUAL", "P2SH,STRICTENC"], ["10 11", "GREATERTHANOREQUAL NOT", "P2SH,STRICTENC"], ["-11 11", "GREATERTHANOREQUAL NOT", "P2SH,STRICTENC"], ["-11 -10", "GREATERTHANOREQUAL NOT", "P2SH,STRICTENC"], ["1 0 MIN", "0 NUMEQUAL", "P2SH,STRICTENC"], ["0 1 MIN", "0 NUMEQUAL", "P2SH,STRICTENC"], ["-1 0 MIN", "-1 NUMEQUAL", "P2SH,STRICTENC"], ["0 -2147483647 MIN", "-2147483647 NUMEQUAL", "P2SH,STRICTENC"], ["2147483647 0 MAX", "2147483647 NUMEQUAL", "P2SH,STRICTENC"], ["0 100 MAX", "100 NUMEQUAL", "P2SH,STRICTENC"], ["-100 0 MAX", "0 NUMEQUAL", "P2SH,STRICTENC"], ["0 -2147483647 MAX", "0 NUMEQUAL", "P2SH,STRICTENC"], ["0 0 1", "WITHIN", "P2SH,STRICTENC"], ["1 0 1", "WITHIN NOT", "P2SH,STRICTENC"], ["0 -2147483647 2147483647", "WITHIN", "P2SH,STRICTENC"], ["-1 -100 100", "WITHIN", "P2SH,STRICTENC"], ["11 -100 100", "WITHIN", "P2SH,STRICTENC"], ["-2147483647 -100 100", "WITHIN NOT", "P2SH,STRICTENC"], ["2147483647 -100 100", "WITHIN NOT", "P2SH,STRICTENC"], ["2147483647 2147483647 SUB", "0 EQUAL", "P2SH,STRICTENC"], ["2147483647 DUP ADD", "4294967294 EQUAL", "P2SH,STRICTENC", ">32 bit EQUAL is valid"], ["2147483647 NEGATE DUP ADD", "-4294967294 EQUAL", "P2SH,STRICTENC"], ["''", "RIPEMD160 0x14 0x9c1185a5c5e9fc54612808977ee8f548b2258d31 EQUAL", "P2SH,STRICTENC"], ["'a'", "RIPEMD160 0x14 0x0bdc9d2d256b3ee9daae347be6f4dc835a467ffe EQUAL", "P2SH,STRICTENC"], ["'abcdefghijklmnopqrstuvwxyz'", "RIPEMD160 0x14 0xf71c27109c692c1b56bbdceb5b9d2865b3708dbc EQUAL", "P2SH,STRICTENC"], ["''", "SHA1 0x14 0xda39a3ee5e6b4b0d3255bfef95601890afd80709 EQUAL", "P2SH,STRICTENC"], ["'a'", "SHA1 0x14 0x86f7e437faa5a7fce15d1ddcb9eaeaea377667b8 EQUAL", "P2SH,STRICTENC"], ["'abcdefghijklmnopqrstuvwxyz'", "SHA1 0x14 0x32d10c7b8cf96570ca04ce37f2a19d84240d3a89 EQUAL", "P2SH,STRICTENC"], ["''", "SHA256 0x20 0xe3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 EQUAL", "P2SH,STRICTENC"], ["'a'", "SHA256 0x20 0xca978112ca1bbdcafac231b39a23dc4da786eff8147c4e72b9807785afee48bb EQUAL", "P2SH,STRICTENC"], ["'abcdefghijklmnopqrstuvwxyz'", "SHA256 0x20 0x71c480df93d6ae2f1efad1447c66c9525e316218cf51fc8d9ed832f2daf18b73 EQUAL", "P2SH,STRICTENC"], ["''", "DUP HASH160 SWAP SHA256 RIPEMD160 EQUAL", "P2SH,STRICTENC"], ["''", "DUP HASH256 SWAP SHA256 SHA256 EQUAL", "P2SH,STRICTENC"], ["''", "NOP HASH160 0x14 0xb472a266d0bd89c13706a4132ccfb16f7c3b9fcb EQUAL", "P2SH,STRICTENC"], ["'a'", "HASH160 NOP 0x14 0x994355199e516ff76c4fa4aab39337b9d84cf12b EQUAL", "P2SH,STRICTENC"], ["'abcdefghijklmnopqrstuvwxyz'", "HASH160 0x4c 0x14 0xc286a1af0947f58d1ad787385b1c2c4a976f9e71 EQUAL", "P2SH,STRICTENC"], ["''", "HASH256 0x20 0x5df6e0e2761359d30a8275058e299fcc0381534545f55cf43e41983f5d4c9456 EQUAL", "P2SH,STRICTENC"], ["'a'", "HASH256 0x20 0xbf5d3affb73efd2ec6c36ad3112dd933efed63c4e1cbffcfa88e2759c144f2d8 EQUAL", "P2SH,STRICTENC"], ["'abcdefghijklmnopqrstuvwxyz'", "HASH256 0x4c 0x20 0xca139bc10c2f660da42666f72e89a225936fc60f193c161124a672050c434671 EQUAL", "P2SH,STRICTENC"], ["1","NOP1 CHECKLOCKTIMEVERIFY NOP3 NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10 1 EQUAL", "P2SH,STRICTENC"], ["'NOP_1_to_10' NOP1 CHECKLOCKTIMEVERIFY NOP3 NOP4 NOP5 NOP6 NOP7 NOP8 NOP9 NOP10","'NOP_1_to_10' EQUAL", "P2SH,STRICTENC"], ["1", "NOP", "P2SH,STRICTENC,DISCOURAGE_UPGRADABLE_NOPS", "Discourage NOPx flag allows OP_NOP"], ["0", "IF NOP10 ENDIF 1", "P2SH,STRICTENC,DISCOURAGE_UPGRADABLE_NOPS", "Discouraged NOPs are allowed if not executed"], ["0", "IF 0xba ELSE 1 ENDIF", "P2SH,STRICTENC", "opcodes above NOP10 invalid if executed"], ["0", "IF 0xbb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xbc ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xbd ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xbe ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xbf ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc1 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc2 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc3 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc4 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc5 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc6 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc7 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc8 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xc9 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xca ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xcb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xcc ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xcd ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xce ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xcf ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd1 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd2 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd3 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd4 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd5 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd6 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd7 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd8 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xd9 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xda ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xdb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xdc ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xdd ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xde ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xdf ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe1 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe2 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe3 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe4 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe5 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe6 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe7 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe8 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xe9 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xea ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xeb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xec ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xed ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xee ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xef ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf0 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf1 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf2 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf3 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf4 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf5 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf6 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf7 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf8 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xf9 ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xfa ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xfb ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xfc ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xfd ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xfe ELSE 1 ENDIF", "P2SH,STRICTENC"], ["0", "IF 0xff ELSE 1 ENDIF", "P2SH,STRICTENC"], ["NOP", "'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb'", "P2SH,STRICTENC", "520 byte push"], ["1", "0x616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161", "P2SH,STRICTENC", "201 opcodes executed. 0x61 is NOP"], ["1 2 3 4 5 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f", "1 2 3 4 5 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f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bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb' 0x6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f6f 2DUP 0x616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161616161", "P2SH,STRICTENC", "Max-size (10,000-byte), max-push(520 bytes), max-opcodes(201), max stack size(1,000 items). 0x6f is 3DUP, 0x61 is NOP"], ["0", "IF 0x5050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050505050 ENDIF 1", "P2SH,STRICTENC", ">201 opcodes, but RESERVED (0x50) doesn't count towards opcode limit."], ["NOP","1", "P2SH,STRICTENC"], ["1", "0x01 0x01 EQUAL", "P2SH,STRICTENC", "The following is useful for checking implementations of BN_bn2mpi"], ["127", "0x01 0x7F EQUAL", "P2SH,STRICTENC"], ["128", "0x02 0x8000 EQUAL", "P2SH,STRICTENC", "Leave room for the sign bit"], ["32767", "0x02 0xFF7F EQUAL", "P2SH,STRICTENC"], ["32768", "0x03 0x008000 EQUAL", "P2SH,STRICTENC"], ["8388607", "0x03 0xFFFF7F EQUAL", "P2SH,STRICTENC"], ["8388608", "0x04 0x00008000 EQUAL", "P2SH,STRICTENC"], ["2147483647", "0x04 0xFFFFFF7F EQUAL", "P2SH,STRICTENC"], ["2147483648", "0x05 0x0000008000 EQUAL", "P2SH,STRICTENC"], ["549755813887", "0x05 0xFFFFFFFF7F EQUAL", "P2SH,STRICTENC"], ["549755813888", "0x06 0xFFFFFFFF7F EQUAL", "P2SH,STRICTENC"], ["9223372036854775807", "0x08 0xFFFFFFFFFFFFFF7F EQUAL", "P2SH,STRICTENC"], ["-1", "0x01 0x81 EQUAL", "P2SH,STRICTENC", "Numbers are little-endian with the MSB being a sign bit"], ["-127", "0x01 0xFF EQUAL", "P2SH,STRICTENC"], ["-128", "0x02 0x8080 EQUAL", "P2SH,STRICTENC"], ["-32767", "0x02 0xFFFF EQUAL", "P2SH,STRICTENC"], ["-32768", "0x03 0x008080 EQUAL", "P2SH,STRICTENC"], ["-8388607", "0x03 0xFFFFFF EQUAL", "P2SH,STRICTENC"], ["-8388608", "0x04 0x00008080 EQUAL", "P2SH,STRICTENC"], ["-2147483647", "0x04 0xFFFFFFFF EQUAL", "P2SH,STRICTENC"], ["-2147483648", "0x05 0x0000008080 EQUAL", "P2SH,STRICTENC"], ["-4294967295", "0x05 0xFFFFFFFF80 EQUAL", "P2SH,STRICTENC"], ["-549755813887", "0x05 0xFFFFFFFFFF EQUAL", "P2SH,STRICTENC"], ["-549755813888", "0x06 0x000000008080 EQUAL", "P2SH,STRICTENC"], ["-9223372036854775807", "0x08 0xFFFFFFFFFFFFFFFF EQUAL", "P2SH,STRICTENC"], ["2147483647", "1ADD 2147483648 EQUAL", "P2SH,STRICTENC", "We can do math on 4-byte integers, and compare 5-byte ones"], ["2147483647", "1ADD 1", "P2SH,STRICTENC"], ["-2147483647", "1ADD 1", "P2SH,STRICTENC"], ["1", "0x02 0x0100 EQUAL NOT", "P2SH,STRICTENC", "Not the same byte array..."], ["1", "0x02 0x0100 NUMEQUAL", "P2SH,STRICTENC", "... but they are numerically equal"], ["11", "0x4c 0x03 0x0b0000 NUMEQUAL", "P2SH,STRICTENC"], ["0", "0x01 0x80 EQUAL NOT", "P2SH,STRICTENC"], ["0", "0x01 0x80 NUMEQUAL", "P2SH,STRICTENC", "Zero numerically equals negative zero"], ["0", "0x02 0x0080 NUMEQUAL", "P2SH,STRICTENC"], ["0x03 0x000080", "0x04 0x00000080 NUMEQUAL", "P2SH,STRICTENC"], ["0x03 0x100080", "0x04 0x10000080 NUMEQUAL", "P2SH,STRICTENC"], ["0x03 0x100000", "0x04 0x10000000 NUMEQUAL", "P2SH,STRICTENC"], ["NOP", "NOP 1", "P2SH,STRICTENC", "The following tests check the if(stack.size() < N) tests in each opcode"], ["1", "IF 1 ENDIF", "P2SH,STRICTENC", "They are here to catch copy-and-paste errors"], ["0", "NOTIF 1 ENDIF", "P2SH,STRICTENC", "Most of them are duplicated elsewhere,"], ["1", "VERIFY 1", "P2SH,STRICTENC", "but, hey, more is always better, right?"], ["0", "TOALTSTACK 1", "P2SH,STRICTENC"], ["1", "TOALTSTACK FROMALTSTACK", "P2SH,STRICTENC"], ["0 0", "2DROP 1", "P2SH,STRICTENC"], ["0 1", "2DUP", "P2SH,STRICTENC"], ["0 0 1", "3DUP", "P2SH,STRICTENC"], ["0 1 0 0", "2OVER", "P2SH,STRICTENC"], ["0 1 0 0 0 0", "2ROT", "P2SH,STRICTENC"], ["0 1 0 0", "2SWAP", "P2SH,STRICTENC"], ["1", "IFDUP", "P2SH,STRICTENC"], ["NOP", "DEPTH 1", "P2SH,STRICTENC"], ["0", "DROP 1", "P2SH,STRICTENC"], ["1", "DUP", "P2SH,STRICTENC"], ["0 1", "NIP", "P2SH,STRICTENC"], ["1 0", "OVER", "P2SH,STRICTENC"], ["1 0 0 0 3", "PICK", "P2SH,STRICTENC"], ["1 0", "PICK", "P2SH,STRICTENC"], ["1 0 0 0 3", "ROLL", "P2SH,STRICTENC"], ["1 0", "ROLL", "P2SH,STRICTENC"], ["1 0 0", "ROT", "P2SH,STRICTENC"], ["1 0", "SWAP", "P2SH,STRICTENC"], ["0 1", "TUCK", "P2SH,STRICTENC"], ["1", "SIZE", "P2SH,STRICTENC"], ["0 0", "EQUAL", "P2SH,STRICTENC"], ["0 0", "EQUALVERIFY 1", "P2SH,STRICTENC"], ["0 0 1", "EQUAL EQUAL", "P2SH,STRICTENC", "OP_0 and bools must have identical byte representations"], ["0", "1ADD", "P2SH,STRICTENC"], ["2", "1SUB", "P2SH,STRICTENC"], ["-1", "NEGATE", "P2SH,STRICTENC"], ["-1", "ABS", "P2SH,STRICTENC"], ["0", "NOT", "P2SH,STRICTENC"], ["-1", "0NOTEQUAL", "P2SH,STRICTENC"], ["1 0", "ADD", "P2SH,STRICTENC"], ["1 0", "SUB", "P2SH,STRICTENC"], ["-1 -1", "BOOLAND", "P2SH,STRICTENC"], ["-1 0", "BOOLOR", "P2SH,STRICTENC"], ["0 0", "NUMEQUAL", "P2SH,STRICTENC"], ["0 0", "NUMEQUALVERIFY 1", "P2SH,STRICTENC"], ["-1 0", "NUMNOTEQUAL", "P2SH,STRICTENC"], ["-1 0", "LESSTHAN", "P2SH,STRICTENC"], ["1 0", "GREATERTHAN", "P2SH,STRICTENC"], ["0 0", "LESSTHANOREQUAL", "P2SH,STRICTENC"], ["0 0", "GREATERTHANOREQUAL", "P2SH,STRICTENC"], ["-1 0", "MIN", "P2SH,STRICTENC"], ["1 0", "MAX", "P2SH,STRICTENC"], ["-1 -1 0", "WITHIN", "P2SH,STRICTENC"], ["0", "RIPEMD160", "P2SH,STRICTENC"], ["0", "SHA1", "P2SH,STRICTENC"], ["0", "SHA256", "P2SH,STRICTENC"], ["0", "HASH160", "P2SH,STRICTENC"], ["0", "HASH256", "P2SH,STRICTENC"], ["NOP", "CODESEPARATOR 1", "P2SH,STRICTENC"], ["NOP", "NOP1 1", "P2SH,STRICTENC"], ["NOP", "CHECKLOCKTIMEVERIFY 1", "P2SH,STRICTENC"], ["NOP", "NOP3 1", "P2SH,STRICTENC"], ["NOP", "NOP4 1", "P2SH,STRICTENC"], ["NOP", "NOP5 1", "P2SH,STRICTENC"], ["NOP", "NOP6 1", "P2SH,STRICTENC"], ["NOP", "NOP7 1", "P2SH,STRICTENC"], ["NOP", "NOP8 1", "P2SH,STRICTENC"], ["NOP", "NOP9 1", "P2SH,STRICTENC"], ["NOP", "NOP10 1", "P2SH,STRICTENC"], ["", "0 0 0 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC", "CHECKMULTISIG is allowed to have zero keys and/or sigs"], ["", "0 0 0 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 0 1 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC", "Zero sigs means no sigs are checked"], ["", "0 0 0 1 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 0 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC", "CHECKMULTISIG is allowed to have zero keys and/or sigs"], ["", "0 0 0 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 0 1 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC", "Zero sigs means no sigs are checked"], ["", "0 0 0 1 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 2 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC", "Test from up to 20 pubkeys, all not checked"], ["", "0 0 'a' 'b' 'c' 3 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 4 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 5 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 6 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 7 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 8 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 9 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 10 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 11 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 12 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 13 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 14 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 15 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 16 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 17 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 18 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 19 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG VERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 1 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 2 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 3 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 4 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 5 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 6 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 7 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 8 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 9 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 10 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 11 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 12 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 13 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 14 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 15 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 16 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 17 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 18 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 19 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY DEPTH 0 EQUAL", "P2SH,STRICTENC"], ["", "0 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG 0 0 CHECKMULTISIG", "P2SH,STRICTENC", "nOpCount is incremented by the number of keys evaluated in addition to the usual one op per op. In this case we have zero keys, so we can execute 201 CHECKMULTISIGS"], ["1", "0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY 0 0 0 CHECKMULTISIGVERIFY", "P2SH,STRICTENC"], ["", "NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIG", "P2SH,STRICTENC", "Even though there are no signatures being checked nOpCount is incremented by the number of keys."], ["1", "NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP NOP 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY 0 0 'a' 'b' 'c' 'd' 'e' 'f' 'g' 'h' 'i' 'j' 'k' 'l' 'm' 'n' 'o' 'p' 'q' 'r' 's' 't' 20 CHECKMULTISIGVERIFY", "P2SH,STRICTENC"], ["0 0x01 1", "HASH160 0x14 0xda1745e9b549bd0bfa1a569971c77eba30cd5a4b EQUAL", "P2SH,STRICTENC", "Very basic P2SH"], ["0x4c 0 0x01 1", "HASH160 0x14 0xda1745e9b549bd0bfa1a569971c77eba30cd5a4b EQUAL", "P2SH,STRICTENC"], ["0x40 0x42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242", "0x4d 0x4000 0x42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242 EQUAL", "P2SH,STRICTENC", "Basic PUSH signedness check"], ["0x4c 0x40 0x42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242", "0x4d 0x4000 0x42424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242424242 EQUAL", "P2SH,STRICTENC", "Basic PUSHDATA1 signedness check"], ["all PUSHDATA forms are equivalent"], ["0x4c 0x4b 0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", "0x4b 0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 EQUAL", "", "PUSHDATA1 of 75 bytes equals direct push of it"], ["0x4d 0xFF00 0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111", "0x4c 0xFF 0x111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 EQUAL", "", "PUSHDATA2 of 255 bytes equals PUSHDATA1 of it"], ["0x00", "SIZE 0 EQUAL", "P2SH,STRICTENC", "Basic OP_0 execution"], ["Numeric pushes"], ["0x01 0x81", "0x4f EQUAL", "", "OP1_NEGATE pushes 0x81"], ["0x01 0x01", "0x51 EQUAL", "", "OP_1 pushes 0x01"], ["0x01 0x02", "0x52 EQUAL", "", "OP_2 pushes 0x02"], ["0x01 0x03", "0x53 EQUAL", "", "OP_3 pushes 0x03"], ["0x01 0x04", "0x54 EQUAL", "", "OP_4 pushes 0x04"], ["0x01 0x05", "0x55 EQUAL", "", "OP_5 pushes 0x05"], ["0x01 0x06", "0x56 EQUAL", "", "OP_6 pushes 0x06"], ["0x01 0x07", "0x57 EQUAL", "", "OP_7 pushes 0x07"], ["0x01 0x08", "0x58 EQUAL", "", "OP_8 pushes 0x08"], ["0x01 0x09", "0x59 EQUAL", "", "OP_9 pushes 0x09"], ["0x01 0x0a", "0x5a EQUAL", "", "OP_10 pushes 0x0a"], ["0x01 0x0b", "0x5b EQUAL", "", "OP_11 pushes 0x0b"], ["0x01 0x0c", "0x5c EQUAL", "", "OP_12 pushes 0x0c"], ["0x01 0x0d", "0x5d EQUAL", "", "OP_13 pushes 0x0d"], ["0x01 0x0e", "0x5e EQUAL", "", "OP_14 pushes 0x0e"], ["0x01 0x0f", "0x5f EQUAL", "", "OP_15 pushes 0x0f"], ["0x01 0x10", "0x60 EQUAL", "", "OP_16 pushes 0x10"], ["Equivalency of different numeric encodings"], ["0x02 0x8000", "128 NUMEQUAL", "", "0x8000 equals 128"], ["0x01 0x00", "0 NUMEQUAL", "", "0x00 numequals 0"], ["0x01 0x80", "0 NUMEQUAL", "", "0x80 (negative zero) numequals 0"], ["0x02 0x0080", "0 NUMEQUAL", "", "0x0080 numequals 0"], ["0x02 0x0500", "5 NUMEQUAL", "", "0x0500 numequals 5"], ["0x03 0xff7f80", "0x02 0xffff NUMEQUAL", "", ""], ["0x03 0xff7f00", "0x02 0xff7f NUMEQUAL", "", ""], ["0x04 0xffff7f80", "0x03 0xffffff NUMEQUAL", "", ""], ["0x04 0xffff7f00", "0x03 0xffff7f NUMEQUAL", "", ""], ["Unevaluated non-minimal pushes are ignored"], ["0 IF 0x4c 0x00 ENDIF 1", "", "MINIMALDATA", "non-minimal PUSHDATA1 ignored"], ["0 IF 0x4d 0x0000 ENDIF 1", "", "MINIMALDATA", "non-minimal PUSHDATA2 ignored"], ["0 IF 0x4c 0x00000000 ENDIF 1", "", "MINIMALDATA", "non-minimal PUSHDATA4 ignored"], ["0 IF 0x01 0x81 ENDIF 1", "", "MINIMALDATA", "1NEGATE equiv"], ["0 IF 0x01 0x01 ENDIF 1", "", "MINIMALDATA", "OP_1 equiv"], ["0 IF 0x01 0x02 ENDIF 1", "", "MINIMALDATA", "OP_2 equiv"], ["0 IF 0x01 0x03 ENDIF 1", "", "MINIMALDATA", "OP_3 equiv"], ["0 IF 0x01 0x04 ENDIF 1", "", "MINIMALDATA", "OP_4 equiv"], ["0 IF 0x01 0x05 ENDIF 1", "", "MINIMALDATA", "OP_5 equiv"], ["0 IF 0x01 0x06 ENDIF 1", "", "MINIMALDATA", "OP_6 equiv"], ["0 IF 0x01 0x07 ENDIF 1", "", "MINIMALDATA", "OP_7 equiv"], ["0 IF 0x01 0x08 ENDIF 1", "", "MINIMALDATA", "OP_8 equiv"], ["0 IF 0x01 0x09 ENDIF 1", "", "MINIMALDATA", "OP_9 equiv"], ["0 IF 0x01 0x0a ENDIF 1", "", "MINIMALDATA", "OP_10 equiv"], ["0 IF 0x01 0x0b ENDIF 1", "", "MINIMALDATA", "OP_11 equiv"], ["0 IF 0x01 0x0c ENDIF 1", "", "MINIMALDATA", "OP_12 equiv"], ["0 IF 0x01 0x0d ENDIF 1", "", "MINIMALDATA", "OP_13 equiv"], ["0 IF 0x01 0x0e ENDIF 1", "", "MINIMALDATA", "OP_14 equiv"], ["0 IF 0x01 0x0f ENDIF 1", "", "MINIMALDATA", "OP_15 equiv"], ["0 IF 0x01 0x10 ENDIF 1", "", "MINIMALDATA", "OP_16 equiv"], ["Numeric minimaldata rules are only applied when a stack item is numerically evaluated; the push itself is allowed"], ["0x01 0x00", "1", "MINIMALDATA"], ["0x01 0x80", "1", "MINIMALDATA"], ["0x02 0x0180", "1", "MINIMALDATA"], ["0x02 0x0100", "1", "MINIMALDATA"], ["0x02 0x0200", "1", "MINIMALDATA"], ["0x02 0x0300", "1", "MINIMALDATA"], ["0x02 0x0400", "1", "MINIMALDATA"], ["0x02 0x0500", "1", "MINIMALDATA"], ["0x02 0x0600", "1", "MINIMALDATA"], ["0x02 0x0700", "1", "MINIMALDATA"], ["0x02 0x0800", "1", "MINIMALDATA"], ["0x02 0x0900", "1", "MINIMALDATA"], ["0x02 0x0a00", "1", "MINIMALDATA"], ["0x02 0x0b00", "1", "MINIMALDATA"], ["0x02 0x0c00", "1", "MINIMALDATA"], ["0x02 0x0d00", "1", "MINIMALDATA"], ["0x02 0x0e00", "1", "MINIMALDATA"], ["0x02 0x0f00", "1", "MINIMALDATA"], ["0x02 0x1000", "1", "MINIMALDATA"], ["Valid version of the 'Test every numeric-accepting opcode for correct handling of the numeric minimal encoding rule' script_invalid test"], ["1 0x02 0x0000", "PICK DROP", ""], ["1 0x02 0x0000", "ROLL DROP 1", ""], ["0x02 0x0000", "1ADD DROP 1", ""], ["0x02 0x0000", "1SUB DROP 1", ""], ["0x02 0x0000", "NEGATE DROP 1", ""], ["0x02 0x0000", "ABS DROP 1", ""], ["0x02 0x0000", "NOT DROP 1", ""], ["0x02 0x0000", "0NOTEQUAL DROP 1", ""], ["0 0x02 0x0000", "ADD DROP 1", ""], ["0x02 0x0000 0", "ADD DROP 1", ""], ["0 0x02 0x0000", "SUB DROP 1", ""], ["0x02 0x0000 0", "SUB DROP 1", ""], ["0 0x02 0x0000", "BOOLAND DROP 1", ""], ["0x02 0x0000 0", "BOOLAND DROP 1", ""], ["0 0x02 0x0000", "BOOLOR DROP 1", ""], ["0x02 0x0000 0", "BOOLOR DROP 1", ""], ["0 0x02 0x0000", "NUMEQUAL DROP 1", ""], ["0x02 0x0000 1", "NUMEQUAL DROP 1", ""], ["0 0x02 0x0000", "NUMEQUALVERIFY 1", ""], ["0x02 0x0000 0", "NUMEQUALVERIFY 1", ""], ["0 0x02 0x0000", "NUMNOTEQUAL DROP 1", ""], ["0x02 0x0000 0", "NUMNOTEQUAL DROP 1", ""], ["0 0x02 0x0000", "LESSTHAN DROP 1", ""], ["0x02 0x0000 0", "LESSTHAN DROP 1", ""], ["0 0x02 0x0000", "GREATERTHAN DROP 1", ""], ["0x02 0x0000 0", "GREATERTHAN DROP 1", ""], ["0 0x02 0x0000", "LESSTHANOREQUAL DROP 1", ""], ["0x02 0x0000 0", "LESSTHANOREQUAL DROP 1", ""], ["0 0x02 0x0000", "GREATERTHANOREQUAL DROP 1", ""], ["0x02 0x0000 0", "GREATERTHANOREQUAL DROP 1", ""], ["0 0x02 0x0000", "MIN DROP 1", ""], ["0x02 0x0000 0", "MIN DROP 1", ""], ["0 0x02 0x0000", "MAX DROP 1", ""], ["0x02 0x0000 0", "MAX DROP 1", ""], ["0x02 0x0000 0 0", "WITHIN DROP 1", ""], ["0 0x02 0x0000 0", "WITHIN DROP 1", ""], ["0 0 0x02 0x0000", "WITHIN DROP 1", ""], ["0 0 0x02 0x0000", "CHECKMULTISIG DROP 1", ""], ["0 0x02 0x0000 0", "CHECKMULTISIG DROP 1", ""], ["0 0x02 0x0000 0 1", "CHECKMULTISIG DROP 1", ""], ["0 0 0x02 0x0000", "CHECKMULTISIGVERIFY 1", ""], ["0 0x02 0x0000 0", "CHECKMULTISIGVERIFY 1", ""], ["While not really correctly DER encoded, the empty signature is allowed by"], ["STRICTENC to provide a compact way to provide a delibrately invalid signature."], ["0", "0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 CHECKSIG NOT", "STRICTENC"], ["0 0", "1 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 1 CHECKMULTISIG NOT", "STRICTENC"], ["CHECKMULTISIG evaluation order tests. CHECKMULTISIG evaluates signatures and"], ["pubkeys in a specific order, and will exit early if the number of signatures"], ["left to check is greater than the number of keys left. As STRICTENC fails the"], ["script when it reaches an invalidly encoded signature or pubkey, we can use it"], ["to test the exact order in which signatures and pubkeys are evaluated by"], ["distinguishing CHECKMULTISIG returning false on the stack and the script as a"], ["whole failing."], ["See also the corresponding inverted versions of these tests in script_invalid.json"], [ "0 0x47 0x3044022044dc17b0887c161bb67ba9635bf758735bdde503e4b0a0987f587f14a4e1143d022009a215772d49a85dae40d8ca03955af26ad3978a0ff965faa12915e9586249a501 0x47 0x3044022044dc17b0887c161bb67ba9635bf758735bdde503e4b0a0987f587f14a4e1143d022009a215772d49a85dae40d8ca03955af26ad3978a0ff965faa12915e9586249a501", "2 0 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 2 CHECKMULTISIG NOT", "STRICTENC", "2-of-2 CHECKMULTISIG NOT with the second pubkey invalid, and both signatures validly encoded. Valid pubkey fails, and CHECKMULTISIG exits early, prior to evaluation of second invalid pubkey." ], [ "0 0 0x47 0x3044022044dc17b0887c161bb67ba9635bf758735bdde503e4b0a0987f587f14a4e1143d022009a215772d49a85dae40d8ca03955af26ad3978a0ff965faa12915e9586249a501", "2 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 0x21 0x02865c40293a680cb9c020e7b1e106d8c1916d3cef99aa431a56d253e69256dac0 2 CHECKMULTISIG NOT", "STRICTENC", "2-of-2 CHECKMULTISIG NOT with both pubkeys valid, but second signature invalid. Valid pubkey fails, and CHECKMULTISIG exits early, prior to evaluation of second invalid signature." ], ["Increase test coverage for DERSIG"], ["0x4a 0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "0 CHECKSIG NOT", "", "Overly long signature is correctly encoded"], ["0x25 0x30220220000000000000000000000000000000000000000000000000000000000000000000", "0 CHECKSIG NOT", "", "Missing S is correctly encoded"], ["0x27 0x3024021077777777777777777777777777777777020a7777777777777777777777777777777701", "0 CHECKSIG NOT", "", "S with invalid S length is correctly encoded"], ["0x27 0x302403107777777777777777777777777777777702107777777777777777777777777777777701", "0 CHECKSIG NOT", "", "Non-integer R is correctly encoded"], ["0x27 0x302402107777777777777777777777777777777703107777777777777777777777777777777701", "0 CHECKSIG NOT", "", "Non-integer S is correctly encoded"], ["0x17 0x3014020002107777777777777777777777777777777701", "0 CHECKSIG NOT", "", "Zero-length R is correctly encoded"], ["0x17 0x3014021077777777777777777777777777777777020001", "0 CHECKSIG NOT", "", "Zero-length S is correctly encoded for DERSIG"], ["0x27 0x302402107777777777777777777777777777777702108777777777777777777777777777777701", "0 CHECKSIG NOT", "", "Negative S is correctly encoded"], ["Automatically generated test cases"], [ "0x47 0x304402200a5c6163f07b8d3b013c4d1d6dba25e780b39658d79ba37af7057a3b7f15ffa102201fd9b4eaa9943f734928b99a83592c2e7bf342ea2680f6a2bb705167966b742001", "0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG", "", "P2PK" ], [ "0x47 0x304402206e05a6fe23c59196ffe176c9ddc31e73a9885638f9d1328d47c0c703863b8876022076feb53811aa5b04e0e79f938eb19906cc5e67548bc555a8e8b8b0fc603d840c01 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508", "DUP HASH160 0x14 0x1018853670f9f3b0582c5b9ee8ce93764ac32b93 EQUALVERIFY CHECKSIG", "", "P2PKH" ], [ "0x47 0x304402204710a85181663b32d25c70ec2bbd14adff5ddfff6cb50d09e155ef5f541fc86c0220056b0cc949be9386ecc5f6c2ac0493269031dbb185781db90171b54ac127790281", "0x41 0x048282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f5150811f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf CHECKSIG", "", "P2PK anyonecanpay" ], [ "0x47 0x3044022003fef42ed6c7be8917441218f525a60e2431be978e28b7aca4d7a532cc413ae8022067a1f82c74e8d69291b90d148778405c6257bbcfc2353cc38a3e1f22bf44254601 0x23 0x210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798ac", "HASH160 0x14 0x23b0ad3477f2178bc0b3eed26e4e6316f4e83aa1 EQUAL", "P2SH", "P2SH(P2PK)" ], [ "0x47 0x304402204e2eb034be7b089534ac9e798cf6a2c79f38bcb34d1b179efd6f2de0841735db022071461beb056b5a7be1819da6a3e3ce3662831ecc298419ca101eb6887b5dd6a401 0x19 0x76a9147cf9c846cd4882efec4bf07e44ebdad495c94f4b88ac", "HASH160 0x14 0x2df519943d5acc0ef5222091f9dfe3543f489a82 EQUAL", "", "P2SH(P2PKH), bad sig but no VERIFY_P2SH" ], [ "0 0x47 0x3044022051254b9fb476a52d85530792b578f86fea70ec1ffb4393e661bcccb23d8d63d3022076505f94a403c86097841944e044c70c2045ce90e36de51f7e9d3828db98a07501 0x47 0x304402200a358f750934b3feb822f1966bfcd8bbec9eeaa3a8ca941e11ee5960e181fa01022050bf6b5a8e7750f70354ae041cb68a7bade67ec6c3ab19eb359638974410626e01 0x47 0x304402200955d031fff71d8653221e85e36c3c85533d2312fc3045314b19650b7ae2f81002202a6bb8505e36201909d0921f01abff390ae6b7ff97bbf959f98aedeb0a56730901", "3 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 3 CHECKMULTISIG", "", "3-of-3" ], [ "0 0x47 0x304402205b7d2c2f177ae76cfbbf14d589c113b0b35db753d305d5562dd0b61cbf366cfb02202e56f93c4f08a27f986cd424ffc48a462c3202c4902104d4d0ff98ed28f4bf8001 0x47 0x30440220563e5b3b1fc11662a84bc5ea2a32cc3819703254060ba30d639a1aaf2d5068ad0220601c1f47ddc76d93284dd9ed68f7c9974c4a0ea7cbe8a247d6bc3878567a5fca01 0x4c69 0x52210279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f8179821038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f515082103363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff464053ae", "HASH160 0x14 0xc9e4a896d149702d0d1695434feddd52e24ad78d EQUAL", "P2SH", "P2SH(2-of-3)" ], [ "0x47 0x304402200060558477337b9022e70534f1fea71a318caf836812465a2509931c5e7c4987022078ec32bd50ac9e03a349ba953dfd9fe1c8d2dd8bdb1d38ddca844d3d5c78c11801", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG", "", "P2PK with too much R padding but no DERSIG" ], [ "0x48 0x304502202de8c03fc525285c9c535631019a5f2af7c6454fa9eb392a3756a4917c420edd02210046130bf2baf7cfc065067c8b9e33a066d9c15edcea9feb0ca2d233e3597925b401", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG", "", "P2PK with too much S padding but no DERSIG" ], [ "0x47 0x30440220d7a0417c3f6d1a15094d1cf2a3378ca0503eb8a57630953a9e2987e21ddd0a6502207a6266d686c99090920249991d3d42065b6d43eb70187b219c0db82e4f94d1a201", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG", "", "P2PK with too little R padding but no DERSIG" ], [ "0x47 0x30440220005ece1335e7f757a1a1f476a7fb5bd90964e8a022489f890614a04acfb734c002206c12b8294a6513c7710e8c82d3c23d75cdbfe83200eb7efb495701958501a5d601", "0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 CHECKSIG NOT", "", "P2PK NOT with bad sig with too much R padding but no DERSIG" ], [ "0x47 0x30440220d7a0417c3f6d1a15094d1cf2a3378ca0503eb8a57630953a9e2987e21ddd0a6502207a6266d686c99090920249991d3d42065b6d43eb70187b219c0db82e4f94d1a201", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG", "", "BIP66 example 1, without DERSIG" ], [ "0", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG NOT", "", "BIP66 example 4, without DERSIG" ], [ "0", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG NOT", "DERSIG", "BIP66 example 4, with DERSIG" ], [ "1", "0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 CHECKSIG NOT", "", "BIP66 example 6, without DERSIG" ], [ "0 0x47 0x30440220cae00b1444babfbf6071b0ba8707f6bd373da3df494d6e74119b0430c5db810502205d5231b8c5939c8ff0c82242656d6e06edb073d42af336c99fe8837c36ea39d501 0x47 0x3044022027c2714269ca5aeecc4d70edc88ba5ee0e3da4986e9216028f489ab4f1b8efce022022bd545b4951215267e4c5ceabd4c5350331b2e4a0b6494c56f361fa5a57a1a201", "2 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 2 CHECKMULTISIG", "", "BIP66 example 7, without DERSIG" ], [ "0 0 0x47 0x30440220da6f441dc3b4b2c84cfa8db0cd5b34ed92c9e01686de5a800d40498b70c0dcac02207c2cf91b0c32b860c4cd4994be36cfb84caf8bb7c3a8e4d96a31b2022c5299c501", "2 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 2 CHECKMULTISIG NOT", "", "BIP66 example 10, without DERSIG" ], [ "0 0x47 0x30440220b119d67d389315308d1745f734a51ff3ec72e06081e84e236fdf9dc2f5d2a64802204b04e3bc38674c4422ea317231d642b56dc09d214a1ecbbf16ecca01ed996e2201 0", "2 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 2 CHECKMULTISIG NOT", "", "BIP66 example 12, without DERSIG" ], [ "0 0x47 0x30440220b119d67d389315308d1745f734a51ff3ec72e06081e84e236fdf9dc2f5d2a64802204b04e3bc38674c4422ea317231d642b56dc09d214a1ecbbf16ecca01ed996e2201 0", "2 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 2 CHECKMULTISIG NOT", "DERSIG", "BIP66 example 12, with DERSIG" ], [ "0x48 0x304402203e4516da7253cf068effec6b95c41221c0cf3a8e6ccb8cbf1725b562e9afde2c022054e1c258c2981cdfba5df1f46661fb6541c44f77ca0092f3600331abfffb12510101", "0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 CHECKSIG", "", "P2PK with multi-byte hashtype, without DERSIG" ], [ "0x48 0x304502203e4516da7253cf068effec6b95c41221c0cf3a8e6ccb8cbf1725b562e9afde2c022100ab1e3da73d67e32045a20e0b999e049978ea8d6ee5480d485fcf2ce0d03b2ef001", "0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 CHECKSIG", "", "P2PK with high S but no LOW_S" ], [ "0x47 0x3044022057292e2d4dfe775becdd0a9e6547997c728cdf35390f6a017da56d654d374e4902206b643be2fc53763b4e284845bfea2c597d2dc7759941dce937636c9d341b71ed01", "0x41 0x0679be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG", "", "P2PK with hybrid pubkey but no STRICTENC" ], [ "0x47 0x30440220035d554e3153c04950c9993f41c496607a8e24093db0595be7bf875cf64fcf1f02204731c8c4e5daf15e706cec19cdd8f2c5b1d05490e11dab8465ed426569b6e92101", "0x41 0x0679be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG NOT", "", "P2PK NOT with invalid hybrid pubkey but no STRICTENC" ], [ "0 0x47 0x304402202e79441ad1baf5a07fb86bae3753184f6717d9692680947ea8b6e8b777c69af1022079a262e13d868bb5a0964fefe3ba26942e1b0669af1afb55ef3344bc9d4fc4c401", "1 0x41 0x0679be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 2 CHECKMULTISIG", "", "1-of-2 with the second 1 hybrid pubkey and no STRICTENC" ], [ "0 0x47 0x304402202e79441ad1baf5a07fb86bae3753184f6717d9692680947ea8b6e8b777c69af1022079a262e13d868bb5a0964fefe3ba26942e1b0669af1afb55ef3344bc9d4fc4c401", "1 0x41 0x0679be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 2 CHECKMULTISIG", "STRICTENC", "1-of-2 with the second 1 hybrid pubkey" ], [ "0x47 0x304402206177d513ec2cda444c021a1f4f656fc4c72ba108ae063e157eb86dc3575784940220666fc66702815d0e5413bb9b1df22aed44f5f1efb8b99d41dd5dc9a5be6d205205", "0x41 0x048282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f5150811f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf CHECKSIG", "", "P2PK with undefined hashtype but no STRICTENC" ], [ "0x47 0x304402207409b5b320296e5e2136a7b281a7f803028ca4ca44e2b83eebd46932677725de02202d4eea1c8d3c98e6f42614f54764e6e5e6542e213eb4d079737e9a8b6e9812ec05", "0x41 0x048282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f5150811f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf CHECKSIG NOT", "", "P2PK NOT with invalid sig and undefined hashtype but no STRICTENC" ], [ "1 0x47 0x3044022051254b9fb476a52d85530792b578f86fea70ec1ffb4393e661bcccb23d8d63d3022076505f94a403c86097841944e044c70c2045ce90e36de51f7e9d3828db98a07501 0x47 0x304402200a358f750934b3feb822f1966bfcd8bbec9eeaa3a8ca941e11ee5960e181fa01022050bf6b5a8e7750f70354ae041cb68a7bade67ec6c3ab19eb359638974410626e01 0x47 0x304402200955d031fff71d8653221e85e36c3c85533d2312fc3045314b19650b7ae2f81002202a6bb8505e36201909d0921f01abff390ae6b7ff97bbf959f98aedeb0a56730901", "3 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 3 CHECKMULTISIG", "", "3-of-3 with nonzero dummy but no NULLDUMMY" ], [ "1 0x47 0x304402201bb2edab700a5d020236df174fefed78087697143731f659bea59642c759c16d022061f42cdbae5bcd3e8790f20bf76687443436e94a634321c16a72aa54cbc7c2ea01 0x47 0x304402204bb4a64f2a6e5c7fb2f07fef85ee56fde5e6da234c6a984262307a20e99842d702206f8303aaba5e625d223897e2ffd3f88ef1bcffef55f38dc3768e5f2e94c923f901 0x47 0x3044022040c2809b71fffb155ec8b82fe7a27f666bd97f941207be4e14ade85a1249dd4d02204d56c85ec525dd18e29a0533d5ddf61b6b1bb32980c2f63edf951aebf7a27bfe01", "3 0x21 0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x03363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640 3 CHECKMULTISIG NOT", "", "3-of-3 NOT with invalid sig and nonzero dummy but no NULLDUMMY" ], [ "0 0x47 0x304402200abeb4bd07f84222f474aed558cfbdfc0b4e96cde3c2935ba7098b1ff0bd74c302204a04c1ca67b2a20abee210cf9a21023edccbbf8024b988812634233115c6b73901 DUP", "2 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 2 CHECKMULTISIG", "", "2-of-2 with two identical keys and sigs pushed using OP_DUP but no SIGPUSHONLY" ], [ "0 0x47 0x304402200abeb4bd07f84222f474aed558cfbdfc0b4e96cde3c2935ba7098b1ff0bd74c302204a04c1ca67b2a20abee210cf9a21023edccbbf8024b988812634233115c6b73901 0x47 0x304402200abeb4bd07f84222f474aed558cfbdfc0b4e96cde3c2935ba7098b1ff0bd74c302204a04c1ca67b2a20abee210cf9a21023edccbbf8024b988812634233115c6b73901", "2 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 0x21 0x038282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508 2 CHECKMULTISIG", "SIGPUSHONLY", "2-of-2 with two identical keys and sigs pushed" ], [ "11 0x47 0x304402200a5c6163f07b8d3b013c4d1d6dba25e780b39658d79ba37af7057a3b7f15ffa102201fd9b4eaa9943f734928b99a83592c2e7bf342ea2680f6a2bb705167966b742001", "0x41 0x0479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8 CHECKSIG", "P2SH", "P2PK with unnecessary input but no CLEANSTACK" ], [ "11 0x47 0x304402202f7505132be14872581f35d74b759212d9da40482653f1ffa3116c3294a4a51702206adbf347a2240ca41c66522b1a22a41693610b76a8e7770645dc721d1635854f01 0x43 0x410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8ac", "HASH160 0x14 0x31edc23bdafda4639e669f89ad6b2318dd79d032 EQUAL", "P2SH", "P2SH with unnecessary input but no CLEANSTACK" ], [ "0x47 0x304402202f7505132be14872581f35d74b759212d9da40482653f1ffa3116c3294a4a51702206adbf347a2240ca41c66522b1a22a41693610b76a8e7770645dc721d1635854f01 0x43 0x410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8ac", "HASH160 0x14 0x31edc23bdafda4639e669f89ad6b2318dd79d032 EQUAL", "CLEANSTACK,P2SH", "P2SH with CLEANSTACK" ], ["The End"] ] python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/signmessage.json000066400000000000000000001426441430270607500277720ustar00rootroot00000000000000[ { "address": "1K5Z1nxN4mjUgCLpSXMRkeZxuAMpbn2CQB", "wif": "KwfJTiKdcjNMjBu4ksgGd21EZXz6JomoZNbirP3nfd3K9ZMXMEUi", "signature": "H8PgOb/liZzt3QQHJn9kLBqH7E/i+SC6JTwYGtdNdOjnXzFqXnHMZqP7oZ1wb1QiQ3H/kF8xC9Yx7pK9ddlx8TA=" }, { "address": "1CzDCcHkJq2cH9bMWwQgaJsgSxPL8cw3ex", "wif": "L38oXgJ9vuatxjZzU99tBn9ggwyL2mJa1iGxBw34m5tgvxkbimAJ", "signature": "H8p9zchgGjDqXjL/RRRFCxdmrszMBhOM5H3/7guzGPrpPpK98PSFxPPC+bbB9qKFxIcRqEwmTs0CyOh2L+NtqlA=" }, { "address": "1CaKn6rs61k5C62kwdqzHvDiJa4aijiiSZ", "wif": "Kyri8mmjXpzwBNz8HsUV949gNt6BXD5NNkYCBprMUJTTyi8MgCyH", "signature": "H2CmJhzcOW9KOBVWT4xhiyGpXz7fvjgjsf4IdXMNdif761byosI2Qtk8firpHF0euOEGpE6DyogbWzhPNKuO6kw=" }, { "address": "1LoGaos8SGCFVx9vMQP2kMnJuYN5gxpogF", "wif": "L4abGhH51nRffuHr6zsH9NXyKtpX3YB52bUiF95n2WZdLVNAA278", "signature": "H1n6031DKK+4HdoyNNk6U5bgqd/vk/as2SfR9WyHcyI/J86xQrnHTuqw9hJ5BuF1sAq17euETP3By/FA7IJsANM=" }, { "address": "1CHrifiFz2sGeBKM6P98yQuPboUWrpH75B", "wif": "L3434z4bHCX1Z3Z9jsEyZoaex19CZh97xhUfbrvwBYpw6sCSCAvX", "signature": "H4fNh9cxEL7oyv0Sxc/qj65EBfyulYgfhu31dMHqMJEFEr///pYndzrVGE5Ncf4hAi/kNY/gj+CT/E3GDaKtlhQ=" }, { "address": "13KyVsmGYSopgmsK1rzWah73HVUSPfQZAZ", "wif": "L1trSS5d8Vk6koakoab2M1ZE9CfKyKMzQTLLXacR8Ez9hRUbX7pL", "signature": "HzOwq2BnqAEsMzusoXjPATGMOX7hTKR63wc1LHU69GYi3PtsYt26O5s4i0K/ro6y4F/62Lb93n5qsxUQ2ZDXklo=" }, { "address": "148xViYbEoBG5QjxWT2sUG4nehVhvng5Fq", "wif": "L1oLA8E5Narp9NDWtv2SQ1z32iL9gfy7nx9q38vbd324JbrUdHyW", "signature": "IGFQhE+R0buv+a8QAiK7dfZ7oMlZVFJAkRpm572Ir53fWGT510QxGp5uHyc0x3Pcrn6FMSndml5jOU+exVfST6c=" }, { "address": "1KMHXVGbtwAJKbWcqyk6amSBBXXvHdcJmv", "wif": "KzuoZykvmrjs2nkgVCdC869bJ6b33kasqSc2XzVL2XFnY5JJcbL7", "signature": "IDAweD2d6rN7d3ALWkf/pfyAHgxm955Uj8yAZaLDb5un5WDcdnu/Xy7YsY65h8Os8TFmJNN+nkPkxKapjr0fUaY=" }, { "address": "1KL8oHatYi8gT2sXR8z7hD64Na1TNM3T5H", "wif": "L4ZEN4VFWDLFDoruqJYYNMzfqYo8Y6ZcwG3JEX2o54Rtt1sD58ti", "signature": "H+MfZsyz63oBkVl0VyrE2e3I8i//v8VqMzN6KvOnHjcnyr2vzX6VPVAZfvPxnqKlGsqSZ964sk78HYBByecFqZ0=" }, { "address": "122A264VaC4iBS8oKasjmFsRuNUXmoiJDN", "wif": "Kwhh9C4Fq7bKS3SL9DMtRkk7DuBGkjjSt3dFYFc92SD8Wt2eqX82", "signature": "IBEyPRsRkqzVMcH7aXKLdEButyJRDM4f3VB5Z8eevmTZgyDGmTXkK+V6aZNPWiDmhANSzU4J700xaw1DV4bPBX8=" }, { "address": "1gZubzqPigT2W1NEHhTQ6vRc9m9UUQiRN", "wif": "L3hEeVxBHa6VQwVcdxLPpWPaqHr3krDU88QqRUEVZbRCHE5H3eAt", "signature": "H9ZBAPbPUEVnyflsNjCzYg2XYiqypngwHLzi3EE1ErnlWofCy71cFFyxy8aERAzrqkDRzdmVTh+AxvWaJfPxpPc=" }, { "address": "1JyAmHFZRYughnxcyySEKESDxDHPCBbGtD", "wif": "L1KiFe2UCpt7SZik6h4Y6ojNgyZYiGPaXgQbNTCAR5uAhvEMoCWY", "signature": "IOSbmEDXRNUeftut3RCTHM5yHMTMVArVICXWQg21AHKfBkPjSp4se7JkSYZ3E2CvtckMRUZTn0IF+ZJVwevpQKo=" }, { "address": "1KRLy3r2ukguk9qdtC7YC69eBMb515dyMp", "wif": "L1mtAJyN4z5FWsazodkFeXpMFQzniYoMy4srniZgcmZVDXwV5E8w", "signature": "H8ed1b9hzu3KnqHhgDqsNyb70lsrujLcW31llmVIKaIUPb1odcVl860gwF5z93YQnwqyRezabnRFJJGFRPDTDhc=" }, { "address": "1GPXPQ5WZuVUtREKavM83NCTuVubd73MYC", "wif": "L5FmANAjEwj7pooNDrRw1bQFw1MvBH1gYCSCPCGgKCfA1VtvKEoF", "signature": "IB+ktPQT3jwHFniWn1lfrF+vDAQpP4E9aThlLniK9uxTKlySNA9ArOB/7QI0Fq16NN7jkFL8LhEw2u8iUDeSdj0=" }, { "address": "187iiiy3P9EiEEo5xFQQmeXnc4Mh93oWqj", "wif": "L2egcHyb5jzppeGWYPhKXeYj3BNRtBej7FmqQi3hgijdNTsjPcbw", "signature": "ICnsyyD4NdaEbCzFJ6+a+iqYDyi2TZsFU5fs4BVxYwXPCf+Fs/bXfJkgewneXubkOKOweGQta1dGH6PTv4X711I=" }, { "address": "1KYF4kyD75Hqr4bszgT7M2b3dffnpjfNKk", "wif": "L2kZjNrfJPv1tj8bVUFLkKBVWSWj5M5cSHWhhM8tTTaxefE1ZpPL", "signature": "H+7FBxzH+KT1Y4kbzGyO8/uVTpySdrEf5lSMkLy+Nlr3HK5ySF3bRX8GWN68nABsf3JvGbF7HGNeG5tnF1o0VAY=" }, { "address": "1CMrqDTQu6WUrFjJFPHLEESTwLsZ5uDYCM", "wif": "KyTNcK1xm26b1tcGnC1nAZJHGro54WuatdEjxSGDs5s6BKgL5sht", "signature": "IHKfBFZiHTmIlsrzxc3Wj8AvkpnQMKpg7mefJjxkT0qiYTNkbXqyyoWEvB6N4f56M9Ar+mw0nhK9J4CjC0wdCVs=" }, { "address": "1PDFHCWhgfrx3ZU1UWimUTpnyRjhjbhxkX", "wif": "L2H82fpnWjpQUr3s5CJ92rDfj8P3JFKgLywxbdKGjVSNcbk3gMfA", "signature": "ILT3UNo/GS9MsOcbie5vVSUQUXnWKfCLioc6DxbbYPVxVvfuaWoJqnzTBVqXmyfrV942yjMEFoYjZ1U6SaeH+M4=" }, { "address": "1MG5ETsNTUhvg6av8A8jddJJ4gRk6YKnWH", "wif": "Kx4GGUhbZK1fDunwjsfTSJpq37yoEwb6h6e7k2RxeYLBPnd8KJtC", "signature": "IDz+MJgPs7da/lBskPUibOfd0Ht0u5VGYAVeOQvygnv93JrG5REUHY5WdK5CCOKA0S7qW9zsLVAcrHSzHyqac34=" }, { "address": "181pMcFzbLTcmUP8z1XSmUcNZWKsPBBxpi", "wif": "L1Pf9nn3SYw7YfWgWygNDD6eMd3DKM1BbZKiLKAHmyGfh7Doibtb", "signature": "H7/BVLl33yfaldy/dOM4at3y+tjnGITH/aJHr1s6tN5BSbXue9cmSe6OVWv7jbwnFa0DrlNLY9gOZzJuY5bDsQI=" }, { "address": "1MN4DL4mQWxsk3mfUYZ8ic5uHEUAemWSjb", "wif": "L2MUxGLQrXJaTSS9ou2PSEcWrjtDQE4BQTF6EL7fKwQM5VwJzcCR", "signature": "Hz2nR9Uv1yfpxl8eVZhhqOOmJvODcCG14K/2rgNyHkop8dDpJi2HHwGb4YII0LeNBv/LK9O+J12aNOcyMzKMD2M=" }, { "address": "18XZkC4CkL6bwLHy3zhzLyPB4xh7f4h23D", "wif": "Kxwq4ssi3vmmgWPoRafS6UYD3QSnMT4SRtiCaWSNWKM6ZBiEqvc4", "signature": "H+MQJjqlSgG+mAgI/8JX+VE40E5t1w5YSGBiMbUigphjz1zQOHjK7HW5yKHwsO3byB0O1dQAicPNtITq8J14K4U=" }, { "address": "1AyXZ9RYp9pE1qsR1rqivB3edJXP8GWyiP", "wif": "L2ms2rjGrRttzSdqynwgSDV76ED3WmPFM2YYqHGzHNaZiVQzsCg5", "signature": "H0LCyCPf+NlA4LL850YIHIVpqhN/ImUFy9oZIAR+H9Op4CNUVu87Ee0fbSoikpmcGELWIaFM0WoUyGk8Vi7uNrY=" }, { "address": "1DB7NMtNRtP3QdAtNaUjwM86HvnfCC5AzZ", "wif": "L5kcHFsH2jNGoU6J4BqNy8g8Dao85VjhYa8ccxA3stSJqpdVYMzu", "signature": "IKPAmB40MTsgd4npAEAO7AskWDH7K6hqRPI/z5tG5VS53ESBqnprF/kHmPPot8uRPNoXHkFuYxQZOyMXX7lJEmM=" }, { "address": "15BJrja5LsFAchqUg6rTnQMLnihiMLxhJo", "wif": "L4YMEXuLecrzrfuypwtVdaChhmCj64X2MkETUAPg6DtRiuVGFjja", "signature": "H21Xzc40Kr45kx5oiiC3qgSr973Vtn+mvIscnPObxtmrDtSICoF0QbiTVUE0CZu/x19WOA4omjb7EBMZ44V6ovY=" }, { "address": "1A7Tfi8FVpfDKJZWBrsBWjze3nnCV4ZfXL", "wif": "L1Fd1jF6u1vbPeNcTxVn1KTab4smbqFj6gVZ6jtXAbrvdzcytvHB", "signature": "HxO5kpb4UlAhii8eVHxuw2/aSiqR+KxVG/WZH5Qy2epRHrOIsI5DJmJ1Yd04PK4ishnLFXlc1MqlIIImgQWogJo=" }, { "address": "1DHwsc3aHztCyqaPG2EQ7Jf91CAqxGGYkM", "wif": "L2E55PLU9t4bcgVYm7LwCR7E2YFEdtJo7C1EJjzsdiRGz6geXy2X", "signature": "INcHA2+Wvpi2RM800ykYI5+CphMqC9eXYdtMeidQTWwAM9tuKG5/zPzM4dGYlWNF1r+aoISFv+yFUkthUbnoH7o=" }, { "address": "1LjwcSHxLfZGh84Scuazu7iumbUq9dQ2eq", "wif": "L2x6KEbRpmQLoCxaCPCYtwc9fjjxSr25hQmH5hHgnG7eUahRoKs3", "signature": "H9EG7E88+jhJgO2/bfYBNf8da9J8tUs7ziV3XwojZ4msTppUA+ldVIKjdP6fhucji29LUHbAWrbpYPjEenrz6ow=" }, { "address": "18bAFKGHtzE3ZB4zR4XX1c9X114jchhHDw", "wif": "L2Qe8XEhc8CNbckzB7F3RMXemh9ntDQyVC1wR1Z3LPxTDRmVj9ER", "signature": "HwJXfWR2WqUqqtrkIpJRQK2OwStkfLvBAq4gDM9fdiwpm3rcPPS7pgIhhONr6oE+Ea1FdWB8D7Ui4st/PFgxZxc=" }, { "address": "15LzGqNqeJ1doaQ8j9SdJ5D9UtekGgvVnD", "wif": "L1Pypc7vL1kifCzY12KzhvcpqxUwNC1LUA8ui7tFuE9Wyhun7hw3", "signature": "H9ORqWL1Jpl682gVwZ7rNXvKiwzXX4/b6+cu7L3vtliwKaxLkgO2xyHs87SBah33Vog0kJZaK76jA4Kr7eNqR7E=" }, { "address": "1B1KnUWgErwNPy5ddyTFHUimzKSFPp847h", "wif": "KxTCujUdoKXVe9HGPR5id85YYf8HnaRxYc66JVA51G4uoSDgxY8b", "signature": "IOFXUdyOgYLMFfOBLlzSQL1/JLQ89Sb8eOAH0pZCvJ3m3CuLsbtd5YvmA1J8u1fCjrp9dkK/VjjsgrB1zuaahco=" }, { "address": "15ymYptFaP9TvkS7AJY8LBUD4X8215Aeyq", "wif": "L25fWioivsYomokpcyhBoNGrSKoCw6J6wGvpanr2tizMPtB8Wbze", "signature": "IEXYj7Be6qpmhNBqLf/hauqT3M4Xq2h0XeaBPhlJFBX2EPdR/s9qPTJ8lnPHCOzAPJXcSWK2ZqSCjCr9lTBJAhM=" }, { "address": "172pMom9HYExjrFwaDLXpMUePqG8koLQcc", "wif": "L4FYTnstvkrUBfC3dRqNzra3zU6RUFXR7AGCFF3ifKuQ1ggKrmTs", "signature": "H8eiIuaUp7Rr6frtypvjVtsSAyvCGSg0VbymjkYHBMIvj+rcHR8KCCwIZ/v8XQDGMjz7t9o5BiEJLjD2gtDd3qE=" }, { "address": "1pzJeXN3h8kJ67kfF8nkKbcEDatX2bwVQ", "wif": "L2zY8FHZFgmRKULk9YzaLBb8XTdjfYtLtX1AufjkZaZTpjUU4xAS", "signature": "IOYT2uNuPUGt6SzHG6m/2aGswjcR/A9NX08x2Pjq5PY//Dwj4PStj/4ExQCPUdZPd5TgD2JSzQYjAa0qJOvzO7U=" }, { "address": "1GqaGRFZi5gTxK2BHNTEDKs1GxnPL2r55Z", "wif": "Kz2V929m1nnhmTa8HLKZDE8Letq2Z5J7jXCKs7d5ccRga79nzcoB", "signature": "H3BoJag7tI17tqi7gGXe6ki+cM4YyWq8m5HVmcHXwkziGCJ2a+qhl5wVigYhUwWkNtQU5+fjz5tzlEoJD/UjccY=" }, { "address": "143F3q22Cpdx7cPMsbaqkyLYyHf8aJadLr", "wif": "KzSoJeJXBTwsdZZiKuiGVboWa5HyFD8eekNEq23iTGg6oQEDZYvu", "signature": "IAvp0Nl9FVODboh4mwyvGwLQtSxKKb+XXG6xt10h0AJHV3bD4AIzKjPCzmt4uDykg9hxJchnbtoJA/gw1zJyLq0=" }, { "address": "12tkcUE2kvBayoSjeuU2naodL7byN3Zah3", "wif": "KwwZGgUaHTZMcwiB8G8vCoKqfDRShoffxEJoziwzQUcSFuKVUzEk", "signature": "HyqO1n06z2DQfoD9ulhjVe+M0Isk6hWr9IYvgQTK+IOfUENjxbR+y3FBcxFOFvppQ8Ff/IzZ0e5anX3BIrmRHeo=" }, { "address": "12KPhtXmbSm6zJypCMQ6W4iX547cyQWrVv", "wif": "L58mKsU6g8kK5frb1zxkqZnJc4uMC7BoPY87AXubScJVU1RCB3xk", "signature": "ICPqjIvbFxi5HWzWVkvzIfACzRqIL4IXyNBYjC15f3gOQsyp5UxWPshGIHcVbHV1oRsJt6usc//2okQJ/OcFx30=" }, { "address": "1MW1eYaV15DPQjUXzHUBDzQarPRxT8vzct", "wif": "L43Zw8EYTaDYMmQbTU4oqTPqyDk5ywtHSMPWwUJz6xKiXGr6tfHd", "signature": "IFBIz9Ba3JcgBga1K5dJMp4HAgOQg0HJIfzdUTDkeRsbf/+afc3C8p37eHUjgTWQTtRRjQ3bAzgH5QRLuNfhZBA=" }, { "address": "1EeNpNQZDuHXasaKH78UdVWvi3C2vkXSJe", "wif": "KwGV2LuFzAD9HEnv71tHrse6oVFxQ9PUYHLb2rLfG3pD45fdMC9j", "signature": "H8kJAwrvo5ngwG0u0XGTrHOPM9u9QOI5QGTZwRKngUCbS2jw5v6KpBaLoEdb05BWdgZBgQ8ETP/qZdeIenXcOc0=" }, { "address": "18uGpu2XHtpaKbV398cA5z3ztQR7VJPmwi", "wif": "KzUNtCXbP6sJPRGpLVUZvjAscSdfWj7eEZCrMasydTvsH2UMYmdh", "signature": "H+3BME1BJ0fXlK65/PZS9ttp/uYxyS7dSQiD68eOVzHufjsbcU9l1nKivRpnPRcElXJnN/LMSPIM9YgVmzA/Mxs=" }, { "address": "17isxDy9b3ruvwzyPfJ8eAq3rAAXzRVCkH", "wif": "L18vqXW83WLDdD1HBncdvoK4rjXTwLaHTb5w5gcxzGpXXuLN3fRo", "signature": "H+humGt3Un1m68TtIoWZLvIWnWx6hb1cQslMzAg0ZghGCDvrN2N/3VmshUxZLaC9nwFUogWUL/gfkKWb1XpgtUo=" }, { "address": "123Dwfp6RDMuqk4PNuQZ1FLhACnNgNe4FY", "wif": "KwkrkDQQSAx85neUp29aHyfM3S9LVT3g6D8tZuFQ5FTX9dvBNURP", "signature": "H0OSxW7HEcqLya7LKWAWQir0FZDH9WCwJcbuMrEUkbxLJs+KXmb2NKipjTFxEni5ovi1q6VfrCZbw7U1WbVU/lQ=" }, { "address": "13rt73QHSjHDRHLFJ2QLNDC9MvL8tDg8dK", "wif": "KzzQA1fHTjVwHXWjjUwgaPLvZSS9NUHHSHwwvB26BJtrGUdTjLJ8", "signature": "IBAvh4HyS72mTOi9jaB2z/rFgiuU/G8aW3HbVqhYhdKPSw73bhlL50E4Kz7EU27FUZ0B5j93Om7wNRBEXD8p/eo=" }, { "address": "1Hz3b39PfCMnEUiDh1TdRzAEhShaweAQps", "wif": "Kxaz6CV1vk9P3H86XH3ne1eucdHCzLG2bmrKVSpyBGftDwceMs16", "signature": "IGtqzxiqbzujQQSurkbuT9fkPUblzMt43uwWz1+Koq1w8izU3y2sWtrYFWwXCP/DUdM8xt15ahXMdu9JYh34wo8=" }, { "address": "19wXdV8ceRQVfB2LyTaGqd5NrKhbkMPSWp", "wif": "KyJQ6zs2bVSBF4jGm6sP5WkTFc4HTFx1gp3J84bxwMvdv9CmtU5x", "signature": "HyxjlzS8Se/VLRVLjjp0g+eorFPhF7XDlRBVq2uL1cea66hH5TS5K2toUBxhh57NsmN65cSHKVAvUMocsDXwx1c=" }, { "address": "13Vp66YYuiMvSALRQwXVXWPVsY58SGHWwm", "wif": "L19dLxXSaXrfRDEuE7TvBoTdSnCEgg7ngfv6nQzJwRtcKFCF9hMA", "signature": "H/0jnELT8Y7awiiy7auv3MYzmvdZW/WY6Me7DA1K3vZW4P/nNPEvl8e+VbcamwOumRWyHsJFfCe+uzpExNQ3Gvs=" }, { "address": "1Dh4SH1wqezkvWr6H7w3g8eCEMAqFfxQVp", "wif": "L1ScH9BHd8FuKTP9qYtqmgMw1ejbVUZgCzrFK8FXwdbubzr3ewgR", "signature": "H8+FVphkG5UykflJdRQECvjyjm4oKVT9PxZd6guGBeT3trV3a90nnDtBy9Xeb9qsabwOvh4vdRfO45EXr695s1g=" }, { "address": "1LjrTEqRbTsHFQfrLsB9wZBoH9RqZSyKj2", "wif": "L21cHbM8Ef2GxhjdXNB5Z37fPVdDYZ46HtxLj6gTBQ1oXLfXnSZF", "signature": "HxDQz5Kc9yO9k29rCBVL9tBAmRSrf31vyT6v77xVfYXe2GxxE/QMVcdGUTUgcF4PWkvLOhC93d50Wm+ddv4+3XU=" }, { "address": "1MGCkQ8sn9SyfL5HknjSZCFaLvExMpCAMh", "wif": "L4YurUpTav4iqSqoqWmg9XAg2V9EjecXm4cHXKeJXz46agtBpqNx", "signature": "IBQgu8Ap+KY7v88KOzCWiB9ttMH2/nZmAMOcFTfh2lw0nQ+hqBq5GRyIqMb44kcM+eTUzIl1DEjQStjMNK4HTc0=" }, { "address": "1GfJB8239xR8F35TmdjrGo2SY8MAupJrLn", "wif": "L4hH3E2BQ49MhqFNo6CiM2KpAMUboirBZbiFgSYUpx5b1DdUju6X", "signature": "IOpdiP0EtHOCKZn+7ZlFTT7MiDQLeWzspeNchC4bGP6FtH/eqQT5eHBVQPg9/OLY58B7Z+Ir0CVMIaAfIRNOC40=" }, { "address": "17n7Q4YhL5vKvaTkSNxiwegoaCuCXnZqht", "wif": "L1ahxHckVaj39EThcPVfNHwKW2sVTziW9U6Q1dKkVaToqXTqXyrU", "signature": "IJeNGUDdVLP0//+189da5cQd4I9VEwPD8hwOC3O2XzNfCkD1JrYw3pKXnQ6ScMak45+Yzt85FJzXqCxtwFCQ6y4=" }, { "address": "15fZ9cGM9h3jYy6mCiYstbRAt2m9xdoi4N", "wif": "KzgHq24oXvw9eh2qkyTnSCnG1t4hbJM7biF4kztFd3ZVoX3gDT7k", "signature": "IKYLZrCU52KxZ5nSqdu2Y4aO4EDgcE12bAUFE6F7AY6oKuqvEYXr16/3GBX1uSltHpbkdfeuC8x6L+6hszQNYbU=" }, { "address": "143uCjGTcFS7ZcqqvG5Qkp87KgHWp5dmb9", "wif": "L23q8LughXAHZ19QrXPtyfgMHd3nnPqnobUCbZZRvCTCBnmUnf3B", "signature": "IJG5j5kL24+GR70kAeiPuEOTA5bgS/5QStWr8d4eSJSwErdFV2/KhffLoCVX307Z7e49/5vfvU9wnOEvrHh75V4=" }, { "address": "1EyqKMSMzSxxZfL8Xxh75apwtf9uE8ZPvY", "wif": "L1EufMThGK16SEMVnU3xvendi3GgJbgiqJJ9my6dbhPrMo3CLyFA", "signature": "IGR3J5EG4wfqvp6OfxpGgI+IW4vaOEk7jY//i//bkb/N2g0OtVQ1CzJMTpcWex4JJh+Sf1RR6fDdwr53oeU2Svk=" }, { "address": "1HhnnRbF5HdP9qMCxYUXyZYiFmSyn9km2X", "wif": "L4q9sERTjVXnwGc3jjKnuUzSdJC2DqJkKVkiM9NxcCZTb8vDQgk6", "signature": "ILqgn2VpGEvuoAr9lMGZnUfbOUIqYyr+aDQF6sDSfKWdYGMjkw8xkdzv2+K3JH0sizwb7Wk9p/iT60RKxk2XYfk=" }, { "address": "1GX3xLrSWcpi7DystcLhmsLLQw4UVbRM45", "wif": "L2u1XzFbsYwP8zTHJr4CtAVtFXekR3GrnEduCqBSYqx2ZjY5he7L", "signature": "H5zAuY4zyzWqGzMurQ8S6IuAOpo9klKI3qrWduku/DjBVxSZy292N5Vi41KlN3rPWiuWfcuK/W5PbWqE++xHjK8=" }, { "address": "1AoXa1rqxGKtPCLm4uYwLoRB8Jno1yPHvK", "wif": "L5bFGv4UYzyXoT5C8JH2dSt3439McApNH4mpc5yhhvCRZSZEwxDM", "signature": "H9ucP/r3fiuADX5GMcrHbucsei3mg0pD1UZMJxxX6u/TxEkK5fSB+ZQpXRYch5Fj8d6FZIus2B8FRvb1WkzvMII=" }, { "address": "14Nwure8VUK335BhdVPDaPsnbo4cqPNFsA", "wif": "L2utcSqwskdaKHz6xTsvpNAgMVzUbKvtScwzepDrXok38wt1isGC", "signature": "H349anynU/ZC+pclPK0WSZY22x/eVqHqD/6SAZKehDQVAn4gJ9b9LCJvBh71gmNiN43KXpUXlP3+3AkPC9rE0A4=" }, { "address": "1Mcwkd9TMw1928J2f32eMFhZJdYNg3DJ1L", "wif": "L249xHtXB1FTBQYcHk3jjcVHvcDiBUZeyRNYbHbSUHTQpCmE5T3c", "signature": "H8GkSuH6ySFFiYdE3SH3yxCiooWUfzWBhDMS6Y6US/MYnF2Fq5JH36GSUDCR6DthzqVhA4IzmOFTRJLXoDVVgM8=" }, { "address": "1313rtkE9YCrRPft6t1cEn7BQLqrGis98d", "wif": "KyoFbyB8GdxwfVje91ozpwkBhtL6ZqFhEwpJByRk3hGqW3T13DxQ", "signature": "IMo96LM7pLci5/FNJd3F8FxEAhaNQhr7xY40GJObdTikYvpWrAYYDVJOG8H7GelDCZ4J8TpkNEMwLC0R/Vb6KwU=" }, { "address": "1AwDAXUxiQLAWXwS4fXCFWUKFCnnS12hkh", "wif": "KyE9ZETbmgPwqiAWzWvpdPvhXjFQY2kmX78n2T6JGheXUNyrpALg", "signature": "H1/lcb4P4/OtzN65XkDoQgB3IE+Il2o3R/Xrwcwq98Y3oIAD8jsx02NXUqyftO5fyqew0bmAb2Okx4JczwREzOM=" }, { "address": "14P2YaD3ZR6uh6Z7FRfeis5k4M1Ju9KtKc", "wif": "KzYQurK4HrzvKh7etMjpZeCGAheDmyxSZqZLwfgNgs79SUw2HhVH", "signature": "ICvCrCGRoDg4dxNw1+BdKI7APNa57sRluimtKYI2i4LubQulIW4Q+wsQLr/qdIB3ODRPkvt5YBJl+IO2Xumqkrk=" }, { "address": "12h4uaKw5avZMCSgZspNfMJQNw2BLZDC4d", "wif": "KzLPw5tSweTeyipmMn9EumUSZqBvBBovokJNupou3FV1BZUBn1sW", "signature": "IGkxiYqR6GLArABfy+H/vKVCXrD9Ipsnas1TM6qLKdlRBJD5MnRbBjQ8a34QEhtPJKOZhCtHEEl/3ZcRhF68Urc=" }, { "address": "1EUTJBJ1hRk9zsy5Bjrbgdi6hCn8Vsymsv", "wif": "L42pHLwDTxVoxdE5Wwfp14Za9v4kx9RXAXPwHriQtBcXRfrxwiEc", "signature": "IIs7QwA4Kp+Vmk6Slm1gT5gM0Fp+Ud1gSBsq3PU6HKpFOxhdXI4r2ajc4whsF3DPqiZsW4cprt2TjG7qMGD6qsc=" }, { "address": "1CkfqE817cy32ZCNUm61iihrS9GUeSKaW7", "wif": "L5dq7x6uSmHG2JeRznCcDqj95qftQaDM1ZHSXB17iyGwJjLNY1yo", "signature": "HyRQHFYjYfJf1xv2QFfDBih6Rr8QksMrnCgcuetinSiTVh0b2C+dbkt01hloFrDgxBgrH/HhIlnyBz2RIqi1OLo=" }, { "address": "12eEcHXeXtmZ7GmP2entf3vVaibj1TLDCD", "wif": "KzyziFNa2m2WC84NDBG2ix3rQXYcKHndvCjTkmJQWuoadpQxmdmu", "signature": "IGPAhXmmtHpuZEf2b/WeKQy9mto+JEXSj9sTq96QyGaCkufnIKyVClnxuO6P+5339BqhdB6IPQUYaaHoJNgs/1s=" }, { "address": "184baxHMv9dP8izfuziCCAHrgNsRrLzN5n", "wif": "KwLDpsUW8LWsvLV1TbMkP6zfikWZ97qD8ef234mMe3ex1SXj4HcP", "signature": "IEhwg+hTX1Y9o42O4PGENtq2ztGpuqhzOF0VErCRM5+jr7lNbwVzI8fEzVde7A/dCD5GuGkIz82jbEhW50GljrI=" }, { "address": "1FWS3ujasK5oW4THiAoAtUKjaoyPJzTDco", "wif": "L5irTrWG25mbMjRDvCnbiB22kGDqR8E3rUPg1xRZ3haVz35Q1fHp", "signature": "H5UHyCchg+CuqeXc9URsvbSCI8ACeNl8Q4OQy8YKpd+rL5b99JBWyZfqjkxolT4UcDSfdYaKvY2yeyGtwF7rTkg=" }, { "address": "159BYwD5mS9eTNGueE1Ag24GVbiAi92JVy", "wif": "L4WNzfReeAgaEUAkyyrFxVJUB214QWzbKDd8hDXRUwNvPzZWoxVp", "signature": "H9pjQfBIJm6FPlKxW65O0XYkGUUVCwWOa+4r8eHDTtc4YKpDy3qUKzpe2pHtRwhGtdd1s7kvjceS88uravZtW7A=" }, { "address": "163c6wB5tvpigRTaHPcgnc7VkEVAVnPCcr", "wif": "L1jsWBe8gRjWE6drMUbTZkiW4eRua6keuJm3AzouF11siedmtYph", "signature": "IFI6skiJzxQ6EjzDnossNJBNnFmd1EsVwJ0fZw0RSGkMGTXFZE0+Ie5VVcYm8VTaX2lxkPK60JJMAJUs0XDfEcE=" }, { "address": "17PBYqGHcUCshcwxUA74krGFxPSZVJGpwU", "wif": "KzjUW1UuDSdnsD1RAi1rV2m532qvP9JEnj8NrXbK3nwwag2T4tVr", "signature": "H7jU+nembbTdpfz48ZlCAyIcP6Akm4Kt1kvA9t7o6DIJ3FfkffCalSeiNlYqCWTzjg5nQQ17Y6lrMIJ7P4skW1c=" }, { "address": "16XBxqa3kReetARy9zr4HxiiMEJxeE7SU2", "wif": "KyFQR2j7EtJUPmucd19YJTidAAKFJve8f2Kpgpvc1S3FeFbT1dHs", "signature": "IPOHN2BJ3/aTdpv9pUKh8PHzLc5N6yN56xKJUrrcJQMTbi6tEYeI+svC62P6X8pwKodBu5AVhjrGUlsqaNVjT3Q=" }, { "address": "1Et2zPv51myLEijiicfEz5P8j2mS7JoaCw", "wif": "L2pCvLoNSVzmZpHVQtrmAGtd1mKzUBYCb5e5Fpqfixs4eh2N4Qmt", "signature": "IJeaE6Rg41PgxWTdNDcEvWFEYDjHoRRL6EI9m34kMiMSnJuKepGmyp2kRpPqLkoVUrXHpSe7nOh6WcKn72gEmQA=" }, { "address": "1LdFKHGMzyeKk7tadZ5kTYdYDDHaHeiRzE", "wif": "L5ivuZ77LMKmB6qeJTvdt1TSTE3HhfZHRiRGJCXXzK2UqxbqnPpV", "signature": "IBT+f2JQKrxHx4azXFff6KbbtqIXQvoUBFjoIsnYYVkb2UOwykQtO8qGWrK9Io+d20l8XKzwahL7ZFZ+p5gQ+uE=" }, { "address": "1Hp3WYiPNxRHyqgD2kuKrFsAJkpbbRFwCU", "wif": "L4isKMvpjCt9DsUvhD8sRLQvAN6J8rn1hCPgLVRRGJtCRp532Jd2", "signature": "H2vC2xsdEeStM0KRlc11OMpY5GrnV4ij5P9mc9tT5w/mJdEzJClyyDMaIVN7mzVobbRAd1K42ppmJ9esPl0UlOg=" }, { "address": "1DXNaNXuT2QTsB82JFsDzV6RAHeckPsHJz", "wif": "L5ZjyNcHyMxBRptBGqJ8J4NY7cwM7sCh2wSF83nEazXCqYcTep3Q", "signature": "Hz5Z5Rw9xLHA6bxaQWbAi8zg2FsCCtVWWbGf3XKrsP5L36vMvGak7Bv+55XiPszlTirgC5U92o+Fgg1y5VIh95k=" }, { "address": "1BxCxQfdb1H9nwjJPNoyBVgvNAX3aqH9eK", "wif": "L3nPAoVpYpWPdDbGLQ57KhG6Jqrs73cUbqaY16bmgvAu5HfdKhvL", "signature": "IFgCZY7Zzsm9kqL9Y3kHAEI6o7gV9gnEKr7MlB82b1dFPVErqo3WtWsz9EPrdIcGJ1sZyBR0hjXLo3aKsRC1ZD8=" }, { "address": "1GXD1hfUCRQtN9RuZvovPG41sYZNh93ggN", "wif": "L5nG3nroZqaDycChEfDM4WA6Wa7AYTbvacE2NQjZcNLX92GS9G7z", "signature": "ICOx2DtydZcy/DnrYEanDy+l3tU4sDQVKZ+0LMtLqQtKRgHmxe+qrnnmOfsZsecV9bobpGn1j4GzBd7QgmoKpdY=" }, { "address": "1Cvb9dMuP6zYgPz7f61d6YRUJBpc3vnmpW", "wif": "L113EJ3bK172kW2bDtAP91SVk1DEstGzUU8Ve2WAg9LxWFfy8XCi", "signature": "II93IbR8zfilNx+y4KgpX1pzSWzKCYLSdD268QviPcbY8LPVk6bDl881NhnOmsXaWMTWbn+GMEhUu/fLcxq0uV4=" }, { "address": "145STseLAHiMx3n9Yr7rZV89DrCWJx3jEG", "wif": "KzfR68GsosfhHRoQT3XNn4LPkKCbPLZCQEPYGboyTewQQhZEfAsD", "signature": "IO9t6GLfom6RTi5f9b3wQm5h101mtivGq7w4n4sclJaTQNJ2FRTIRIjJmBs4LZLeffuXo1NXubIO3Kw3p3Oe8VA=" }, { "address": "1FVSNHNwhgqVAwS358CFL4FBP9pQBqRufz", "wif": "L4GfiNRNSjNiigqiFPsP2h5yPCzVwRjKzJj7AP9Wo8zQnXjT1GSi", "signature": "HzWvXFMtCPcBvbRUTk8Ty8qWBPHSLvVX5MgygQT7jPlW1LkKTrpv9UkHIETdT7zcAZLS1AH/omT06GFxbc6eioM=" }, { "address": "15QHUTRdCGNSEgRXtMsdMVGKgPfym5UgAG", "wif": "KyLyfXnPXAvLJ1A1i4PijieKdK5DNBJJgnsoB6qVZpo3PAsVsi2G", "signature": "IH2iUWTGKOcuZMcmCaGZHjwst+ThXXr89/4owiK+r5XxcxDLYJ9kGZURVdCrA4UzDlPW+QRLQPi0fVlh3vK0FBU=" }, { "address": "1EEX6N6WbQHcsCw2fKa45g5K8QJrF44A83", "wif": "L59oyiTmu6GBJat5uVbRX2cmbpV4yJbiqcNpRwS2hotH44o7agQb", "signature": "IM9LibOO1APkZqXjgsnNILrW8kwm4GG4F+0bFWx3ZEYeemeVLlrDEZ8wqrX8Dj00AyXjYY9kWpS5BrU+jto+Vvo=" }, { "address": "1M2yN1dLupuFNfDDzpQV6eK9WPg8WANwSF", "wif": "Kze2QDc5rm3gNb1q7DSGGEUHi3qZUcTrEwdKFxCa6Pi6GCUmiubU", "signature": "IDqiYmnJ8iXN57ZyUoSuCZn3mjM4IqfZUIk7QhhZ2PHES/wVeQg9emJmu664QF53slPsys5BfhkAxP2LEF63KVU=" }, { "address": "1BDuM6EJH6HespbGLLobPf2ev25KKrCm2n", "wif": "L1WTP2a6iarAKE7xRYwpDdXHkSybjfW6jdq5v1HUoZrCKMgrKJQc", "signature": "HybG6Mi2IbTXKuTFhOdI42pm9b5kD9Tsp1C3TjBUXYzOSzr0Q0yOyr01JxUZs+p8ewjr7TQk6SbEvSfeAuuxtFs=" }, { "address": "1GtXw5mybbsvxCGDtqoZTcjdDrbZBCfzT4", "wif": "Kzx6BvqRZYYsKMzo5rbhLqaJo6SmR6E9e8T1yzRWhYaPHDS4jya3", "signature": "IEJIWKNgYsgg/UkkRnmD5gD7Cb5jJdzuYDUZTuFT1nzillvogh71y7h2M7JEOfToD9G0bHH6nlfW7M6ZDUf+n6U=" }, { "address": "169Df5CTDneqekNjjp1H9LVw1csW1UdUNB", "wif": "L5kDLSkJSrVfMVG1dfYiuuhyBug1WoxEyV6YoFaaUza4tTiXizhP", "signature": "II0i6EJOhIKrs75Q6shP/FCBYgQ8MEi/CwKuh3AYWvkkDF/I73wwVWMxgb7WZtZbRAUmQpEgGo5ba7gkIEUOk5g=" }, { "address": "1LRffBFQuiJbekXpJgJESuB2v2fhdpG91w", "wif": "Kwp5L1U8kNkevRfuJKq8DhNHdKdnhHExWoQFBBgAkcUk3ZhtcgPB", "signature": "IN/7MNstRZKQn8ch30Cl3WYwn2oMawqjPN2iJucRcy1+IUt177EpnsBcmu6kcPvBVobaM3g04/A18lPWlAs9qEA=" }, { "address": "15KamntmABnW4aWVo8kLbFz5ER78tN3VMB", "wif": "L5WRW5V8gSMtwDnnwwVKh8mcUjtFHhzxdqkdUJZdhDzcAGVMeW4f", "signature": "H/62OtZcztVO7rj7T+XB2nl84vBz514OU1iTF+T6BV9GFsn7VGbIAZ1bDjPmdDKlpqa3xi5MFI10UZMcaMQDl4c=" }, { "address": "1JcABxW6TXRcgf5BZNV6u2xmw3pq8FNmUL", "wif": "KxNLHVtoxU68ifG6gAriFh7ZSGqDxARMNNfYnffqocobaMM57mJB", "signature": "IKjt4WcAd72DgFSvt9dEF62O1VZna+Z5/JFYTXuOp15ndzCz45qLz8Ph9DATZD44B593cKcjZ8fyIKNTkHzPZpU=" }, { "address": "1GfZJwyAQ6MLfNYpUaU2ajxcMgQwZgdfnJ", "wif": "Kz1akBFdrfEPaDhfqZnNyWD2n3csJmJ3FruDuMQAKyq1uFAknG7x", "signature": "H1xEsIOvJAbPAGQ6NAd6Y92TsMdKUZc195F4M+t8V6TukZePlNPG4s6z09t21hNrVo7sUzADm10wa/u06FCTqEY=" }, { "address": "18gTSRci5jCuV1qkhcrkXE6wQs3mVXsuJF", "wif": "L4wT4erYbNMZHoCadDNcBevxmPTZwmrJTAtxfg9WJmfZzKn2d5YK", "signature": "H3Jh4UH1s4jHHIzSd5U82cIMeRypIHCfhx5cal9ZzTqq2TYz2+y42Rl0trGEfRSargK3QXuR1GutspSspBP77QE=" }, { "address": "18X5V3UBFEU7GyxTBVUDzC9zoKygjyjM5m", "wif": "L1Ls4Bh31kD1wEHYk9uQNudbe74UiBsCv3oepz93KK3ix2iwWQzN", "signature": "HxO5L4rMHfKhKiu2hYI5ICS8SH4Zvdf69TG+TrIHMOuP0OwRnn+Af1ARYQf3C4D8MRsqS2NIPt97JVsFHT0uYoQ=" }, { "address": "1MH3aJKMpDitzmDeMpLRSY1rr6qJwgGhvX", "wif": "L54jDho2TPS3m15Q3cGyC1JLB34374cJJQg9MQi4hix48S2SzMvi", "signature": "H5l0T9ZZ5AENgJaR+OnGAlqYesiyRPV1lS3U9IhyQ6HlSRONfh2ctiVTrxMgAdIeVYk9wYeq+RREBpplqeJMDUs=" }, { "address": "1AKGsp3mUrsHhQfMzaujRwYQBZxjknTmAm", "wif": "L1GGWpu1wDDqL4Jk1nHvUiKGPfgqv3A4yZ6PPSEwqRdrHBtLnBVe", "signature": "H9bb30fUNb5oWzK4cr6J6pJsB+foc1KKKaagigGU2qsB5BlJM0gz0T7E1c1/vpIz3cKHIj0ujYihDpzA0lQY+bA=" }, { "address": "19CG3Q4YwszMaCACVHEreksKybNSD2LpnT", "wif": "L1UfxnohDeahQXB6we23mCrBexuiGuwZcuBpF7NZcaZEAqCHgac5", "signature": "IAz10RluG5W1uxRo4BAEoTSMVAAn4/7yeq6F9hd5zy9MIaESbixAl1dlA2kQeZzaCMPsQu1rfJ0hogXMWjTMiss=" }, { "address": "18gyGD3527g7rMNs9FAq4XQEwGE364FuoX", "wif": "L28wNvfaTxnzEhpMQTbDTfaPVz2nBK3mhsBPY16MoL7LeNXgTbcA", "signature": "HxlQQlCdv9iRDLEagRcrWAZUZ2nt9thsKOaw5fGFok/nCF1VYVfsYVJL9Vjt+Dqtf30H7ZwTb9JBU+uV9kyZi50=" }, { "address": "15WNkcRUMQGqqnniPz5QdCQU4ZkbP85wAM", "wif": "Kzvo4Ro7WGJZecQ7yeRirPLFEJHSejsiku1Kvq7A6ntDjGqW62ZJ", "signature": "IM7/m/eWUtMuwwyEcfY5CAsVgHEOPBsXLmfrV0KY1E1NMT88i6Ra4x3XLdUA3JLGRyWRXe1etOcW07WPaq/2RH4=" }, { "address": "1Nk6kYcc5Jh3nUCEw15uEaTcuCLmTRmNDa", "wif": "L1pHeQhsQvcH2zpQwPMTXhN7D9bNsdeWscWePqFf4vobcqF2HuEX", "signature": "IA5boXMguIrwQZ62vzl1UX9UqVuu1CDwoOdY3z+lv9/5FQyMAyORL34xV6d4QOpDW6exYX1Z6SXJ4ouCzc5JI4s=" }, { "address": "18gYZfkRwbvKmDVRGxdAXRfATDFz7PuA7B", "wif": "KzreACkntbpsZfYfco58ZVnkeRD6eEq9ihYJxqqpZuUgPbtb5oaC", "signature": "INIyfNlUs0D/vFj1twvoWt+xTIPLs1znWEq6TPcoV3EZSX1h/OUbyRAyhTe9cCrk/cxPVu1LBa2+Ow0JBOdxOyc=" }, { "address": "14LZzTu9HZDQ8EboqU7LF5Kqzq76fneLTm", "wif": "L5RHA8w5rHDFAzoPmvrMiuGja8ecMEdCHiYeHW65XaLjjCLaPvYQ", "signature": "IE+sHMB+hWIszRFKJNYM31hTE5kZv6ZJkIYtSFbJytEIuR9ZgkRxyhoeyQSjpgkNiGfV7gJfoeYqnVYzbtBSIYQ=" }, { "address": "1K7WUjovPrHiCV1YDYJ63TutnXc5dZRyZ1", "wif": "L5PxEns2CpgcxxeV8Pu1kmDV2SV7JpL2kccZmgCMshNxhaVbPzK4", "signature": "IE5PMjwHCOcUKtENdXnUO3rcvY560yJTN0mh71vO3uaMWXMShhpH9+LolU+bdQ7Iz9XKuRxs0IasZ9pFvZ7l3Os=" }, { "address": "1LWDXFcJLMb7FS46oJFcaFoh6VLBg1E15V", "wif": "L3qRc2CwHHzY1oL59KkyhzH6Y4SwW7xjZNuvTs1mLbZ5aKzi3UXw", "signature": "ILrc48iQBhlpJsvkWFM1IrxEGp0emkb5DPIonkvG/I2QiN5zWlTlrr0b/Gos1IpeADDfoXZuwmSoH2oTQqeghAw=" }, { "address": "17oLFjRCUe3p6vybT78zAWQANwquM76kme", "wif": "KyfHJ63Eb55x7jzUfUZsqNCiV3j72JRCFiLqkvx7FWnKpnE3vugR", "signature": "IAJ5a0O6BQWI773vRW6pARa5UD2qGTqYdFZNSpGzcDLbXIXjxiJPO+Tc9fF+0vxcsQBk+Mm3dV1Xc6MbjEpAGno=" }, { "address": "15wJkbPmcukGD1r5FaH4SCtuNDbE3gTcXN", "wif": "KxmMLGXged66XBdFVZmjAd7RKGeEu6tzsWzuqAxAtAnJmLfWw5E3", "signature": "IEXoDNPk2ID2WuL6QPl+r7Sh6vLfpVsWGPqMLYgdRB+T++Y5eRphpWE08gf+GHeHpGwxZ35j35ygGINJuPfuxRA=" }, { "address": "1FYRkiQWhNs46YgegM6XDvPfBqcYemGcR5", "wif": "KzLwj9V6QXfVoKFnJAvcs1ywmxR5DPUc41wRtEk3Uoz9siPbG4S9", "signature": "H+8cEdCRCaWyvdWrAvlGgxtVi9ITE8hq7tMMMOeo3+MzhdGiaODCYYN93QbyCUZCPKbWhZwFAut3E+zwfUm74Qs=" }, { "address": "1FykjChZM7CXo5qgcSzhi9EwsfzCGLHJ9r", "wif": "L3vSTuYt9WkcpFBeYcJKPYtKUZaBSJcjGKU6u1piMkVCZMHXy9Mx", "signature": "IM8Mfu6VeCFcva4xbTd05Tw1Fz/x7ZE9jUhZxwhjZlZLi8FllBexBZUYILnfVWwcnIb60jbMrmYXZeieKj6eTjw=" }, { "address": "18ryNP9Y6sj1mM1ao8VJHAnnVE6aMN9BZj", "wif": "Kwh4pCJh5s8pnccGz775q8vxyXMgTh4VRhfMiSy4j14o5aQMdcxS", "signature": "IHksgi1przvnIEi20+1FU1EGJJTE2A0qsxgjhZssDi1akIQxlIgzcHG5a6kumOYCLh2pgnc6SSmKR0fn3BQTsRI=" }, { "address": "14b5i7LT88TVLa8Xc15fZ3jTsr28v7TiaW", "wif": "L2bSUYqCxuB1hktostcCmUz5FQPu5Gp7sKPEnDNhQ29kQWk1Q7og", "signature": "Hyp6mq3VlP3DSQERz084eYwU7uycGy9yG7maS15apk6TJ9nD3MsAzqwnC7DXrAUywWqkgPPVcpd6wRB5E4xPzGc=" }, { "address": "1AM8daWg9Yo7QQsqhn8pTM8aqzYJzEfv3b", "wif": "L4PbYoyd8u3aRXyJLsha6Vu5Lm8DT6W3ecqQVgqJzYyco6B8HCiv", "signature": "ILm+EsrjaLQXcz+TssF76ucykZeZysUQ3Ycl4c/Yia75ZrCTl+Mf1RqIS6pypMmzguobC2ZvDLWn9YFVORajc0M=" }, { "address": "15Z5e3wPA6pPFBjtZDv63Rrvnpjfumwfcb", "wif": "KyxE7fP7DhpMn2MKEL5MgNAAceUfRg6HsGdYSNJcdjVaHfAw6CXo", "signature": "IMIXhUwnhG86Y03Ijt8VZ6MEtnt9UXJIHvRL2PWssBJI75xpypG1GcfHoSDKFfN44eAqoJ0qvoF+IOXfq3cNdxg=" }, { "address": "19QVaXZURXyS8u4akAcVvSskyTYNwdMNQv", "wif": "L5APBPo7aNbg92citzXBaHEjrkHNVRKhcVRHF3iZZzCA6XDSNtEF", "signature": "H3j1BjzgW928ObBey2vSg2WF5USGXC/at3X2wlmim1/QTLqI6lQExoqMidiQ1yC0CVl52ywod7FSi3MHAeV0CGo=" }, { "address": "1KXFFRd8jenZwikVsH3waxTcBqvnnWHYSG", "wif": "L4fy5cT31uAavPSxvrtFvMEEHRw64w4Lv1HwC6871dh8ZTVFr7w3", "signature": "Hxu2odpNOycOIDeVxBgvGg7Z34ASkKYY91Ro0gHwX8LuKG2VRN2DYFcL0i/bwrcXd7ohHTC6/HQM94HZXfYv7v0=" }, { "address": "17dyke1cznQZbo9FFTiJTcF5EC9UDYfHa9", "wif": "Kxtdxymf3TYjJbnYNwiLBudCBbRr1tgFF5tZFUB2bEpnQLtjNtCo", "signature": "IArkfHdNFnkwLIPabpPak96mNyjWW16v1rAHJv1x8If8avXsz7XP2y4bUiMEm1ubMsISm43mRzgMv5ZpYrsPFRg=" }, { "address": "18zbhF9vCuXdCo6aUVgrkCdHmUriKhRRb2", "wif": "L3aUQkcjEVgG3sqsL38uHBS7ryRTRuXktUAnkqU333C6rzbtDjw9", "signature": "IPXpultX/xpsIRLbyjpBQ39ifMDk281+PkM9wDj6qHMhSoU4fqozelHPHvYPdqIgDKKA6QE74oy+KzJRTWN6dYw=" }, { "address": "197U8iN2qxkRKZs6ouAD1eUiS9zxPb9sAW", "wif": "KxwYk3eAZD7L2WomPafxe73FbpDMiAokE2DcWi9B4TiUeNjT85np", "signature": "H3dUUpC91mx2t6OOUlfl2qcaVx5nZWbf5VKck3YZV3R43GpTgLlYLgBr5lVm2pJK3GXSce0IILPGxbuIQp6u5l4=" }, { "address": "12enMBzw5rNAnvqhgZCgF2GciVMT5uhaBg", "wif": "KxBsZexBjcC66fYGdr9M5fmUWjyUNBXRDRuCpt64jnwzNPMmGPiF", "signature": "H5IkkOaTUHkGVbxQ5bwUgcuohKKzoU0hJVBuiGYk/bIJ/rYKzgMjxIVDXuGxTaUg3SEoThv7yH0vq76ZnrISVgY=" }, { "address": "1AsydSHMj14oKps7hTnwjyM12gCKL3PcH4", "wif": "L5hHKFm3Jmwiih4XFtRE3nXST92JaY82irdztrEn5NWm6HytcfjY", "signature": "H09V/Tfkgg7ToNQEoM5TWFRheAKPsA5eBxAgfmMLpeE1pzXWVwfqAQ8vNREN8MYv43YPy17jNdstbiOUQwFRGy8=" }, { "address": "1CMqXad7rHZNucU5x3DPHjCxX7F3F6XtZF", "wif": "L1R93kS3DoxQMvcRMDBjUYgnRA9XTeLGUEvP5xhc55VfxsP5zQfS", "signature": "HztpK83pdtiu0CNf8mhzxUFfFPKOBcsqWLRZygHWaDxLtFewYMxI2yG7NZgzlJ7pKAcD0JDJ3RufDR6VeZxwkN8=" }, { "address": "154ArLdUuCdtWef4d26HEuAqCWmMDDUfLh", "wif": "KxF9CpKkm4U48LBRegV8oXR7M2sZHNArnr7gjotgjJhUeQRp46se", "signature": "ILExo1wGDChNrLMEoELq7i4HzMEjGH52klKTIjEL6eC8IEcry1XYoKX3adOT0qYNWy8viJSOi2CjJKYqZAWzDFE=" }, { "address": "13cfNWYKWW65fT69WhgtNeRJypxcuE9VyF", "wif": "KzLn6YB3AdgNSrySfT6qWvn82GVFqy91CssiaeGvZ7GjEzpComau", "signature": "ICDFc+8R8Bnljs9TSsmr1qzTbm431AkRUenZ5kf/hnGiAN3mgq7E5BiAyE67r6thT1qDSMf41xujvtznLW9ZdTs=" }, { "address": "1Yi45LzwCSGvaDKfYZKYw1YJLgz8R1LLJ", "wif": "L2fS5SMGqM7yVTbhCRm3LwbuzZMkWVQnExHPXzVmd5szzbKySmsd", "signature": "H9b/nH/ohTTW/qcG8Y3lRaRf8JdtEN2uOcswWqssyDK1pMWH6SxLTZcQYwWiMzbqebFzIaaM1dDTcBcP1ca/eGY=" }, { "address": "1JK3nvbnTBiV4Xsf9WLgHrwe1Fk4ZPvxLw", "wif": "L2PrBqtdGcvQoudokcHP5STP9qQBmSYHpz23pyak7xAzPzzS3i26", "signature": "HwgGpTDMVS56ah/DgXri67vrBrAl211+sVIHkziP2Pj8c1KBEeukRttTkwH65HnVmLC7wF2sPnHpyV/6TOnsnVw=" }, { "address": "136V7pa6xJTwe3ZjxLTwcYXCjibvVPJfem", "wif": "L11aCz6eeEChnAnVGLEGghjWFf1LvGZdhRNMckBcy9P4znSPCpmm", "signature": "IEEtM743yIerINdN6jktzb6FLbFLlABW/LSWP0PZyLASoFbKZqZelOr/SlM/Yg6WJyzTpkH0PK8fZ9xM4/TpoQY=" }, { "address": "1Le2rCqhgXRMJnWCBE7rBHdZ8kq6BsJ4aJ", "wif": "L4SJCt8TyBrXutYprHVLTTLMJEoRwRyPxPqP49Dd5F5kP5m2K1zY", "signature": "Hx9eWJSJfibOjV3GF5+WmI64T7G/VMjZqqd86qQ4ZU+Ky+wuFyw0DOwoxup+3+sp3wmNvgM1WbPu1rymN3YD1O4=" }, { "address": "1MtCnAy9pMeF2bnoZgxMw2bf3gjW9JZL6T", "wif": "Kz5n3JqP7gcEXNyTyYGdEFcqMvmNEKRFAJtXh2EkvqAeZ4Pgf7po", "signature": "IBJCJZa6tsgbCvlVoQh8K6JkdP804rqs4tmZ5RUmxoalEjEYOd+AE2ClEap6lcF9Ej3R3cVcvscMTFqI3Dicbdw=" }, { "address": "1FiDyN7y88jxpanEna6BbjzEyUHgjL1UVr", "wif": "L323hwwEN6FfsJd9a3szoPaPNQV8uxJdMPqdvXv8hapJJeiRrgms", "signature": "IJ5052PUxE+7kSabgaKyG6VPlSSAS/IXlb55OmnVvBaglkVnmcADG8mWKpoPftCEOdJkxGrPMyhFsQET5jyTckE=" }, { "address": "18pT7zb9QgpcZoLAFBBpbBkJqe3BZY5hhk", "wif": "L4n5iVXA62GBg76wcDCAojtKLf6WyEbZxqo8zqFvGENHQizMhdej", "signature": "IGlDmbTF34a+XCct0K681DOl0NfzuyLJDfLoAVTDhSvpIqVz08cMRJcyuRZiXfJfOjGGpgzTgXZZJL6YsxC/1Mg=" }, { "address": "142ZivDuV7mGWCiUpwdQ2z13L24tMKidq4", "wif": "L1cu5rD1iAZmcAcgK87o9jF71huojDTytNVLYFQ1Fact8EK5B7GB", "signature": "H6uxflO+kXQkvfw+vzrEAubB/W32b7+6qNMQCwLLNh5pppt4EW0NHUClvBJ8UNfO3ZGS48V2NOu7a9wcDGgcBPU=" }, { "address": "1BtCK1CiFyby9JVX6wJUqoN5nAuyNsaAkE", "wif": "L3fL6nKqvtqgbYwpquRnHNuqqVGWi2DxL5vNXFzfuMKDBE86mPSh", "signature": "H8a6eRXEY4z643GeLsknfULPFUR40/7VgSp0FBYrWrNTx9qvXsQEfaYkG8dGdBUWmNEe9kL0Au9owH1XhREvwY0=" }, { "address": "1JhTugoaUiSk6a3UvBfs6DH5RkLr9uLbBR", "wif": "KwRxbCHkp7U6yDj8Nzm6mfiYaRfQxi6gAwkDWpsu79sCbJcA6xxd", "signature": "H7z0nHp0DHZUtU/yy8e+UUsEN6XYxZTRVcWvi5meQ9oEyWYpYgDYC95FSNOKZAkCfuNrDY3OV6gMIXGn/esJ1SM=" }, { "address": "1JwwdHUvLsfsyVUoskfkBTvyYqLtncXLwY", "wif": "L1XqH456GCKsRPrgnd18wPQVs3WVcuxNGBmmEdRHFdcaM3MJKg22", "signature": "H5Q1Ztqtev6s3uCYROvPvpaYJtfKysa5FpGxAN1X7vswJpwFMxgIfzALOKcx5wLqNVDMz1tfDbnHWMGG2k1ETVU=" }, { "address": "13hd26fp8TzEXJNeUBNdcfnfvXQFGAAhTA", "wif": "L4JgXdcdS7v4Rmw7YAe8Sxig4FFSic3HVN4atG7H7ArAMmjqLRHX", "signature": "IG9AzsGcCEepGaPc2Qe2MP/2flR1ah7ncP6zbX9c6uwE540zNn7X1oFfHGQZFpOtERkgENYSfrWY/Wq5iqRQYZY=" }, { "address": "16ucY3uGJi1pptFzKph9nsQzX9L1Zah7qx", "wif": "KwMgjkwwWwDeG6cDXsmaQCkVM2pSZzXnHwMxrH4w1oniQsuaPSnb", "signature": "H0m05aWt0CCCNWooc3CGxYyjxw5ziao3Gp0FxYRMkE3x9PY5XHlCuUVWzEy1jLfGSiyaCyp90b7Z0oFQuQ1PxT8=" }, { "address": "1FLGMUND7pQKV6FbLZ7GLChPpHjYuzesw", "wif": "L4SQQFAqjaoHmzxWnzzDm83uRhLywVGAogTjJqu1CfHRpFoNRGtp", "signature": "HyAcsA60GqRTdXu3cG5+u9Xo1gjhwPkAIY9R8dX7sTN4wfrSbeDITnPQWMGd1CHC1n4N/TYygsm91HtpF71F6Cs=" }, { "address": "114frswQGaefdfq9ZY9gT5N31gLX3MWjGo", "wif": "Kwsmpz9fE1zQqZM7ieypBLz6dRizLQMzzyELZV8Jk24MbJT19N8k", "signature": "IJzFqaDw91unjuwMxG0xumDbsceBJFg2b9/aryxg/CeluydKkJDZhlsd2lcyPKCLSth9utwlkmTlN10Q5sYtbDo=" }, { "address": "12nNtkmjgHQmq4yKgtbNsgBnqGfUXBym6f", "wif": "KycA7FhTrG84uikZ1o1pNV11rhSSAQM623thGeVH5pfXDMPMHSZu", "signature": "IBe6FAwyq5gGh9E0DRGddzqW6uiqP4bOzgsrp4aM4oGccboaLED1EtQ4BxiVbj0CsHTkAJxvSvH4itMIb1LJc0E=" }, { "address": "18zYwELNgkkFo8BH1Bssq6BabtKCHGUWHa", "wif": "L5fWXwd7Rw7E4yf7f4WtiSQmgqq6HbtnHqdUDsWf1s82W2Hfd5fa", "signature": "H8ESgZRxOis7+etBcEqQ2Tqb+41ymg4DuEoTIB6IeyVDOcjdjcLBfoXSviVVVcpowGsyGnUVg03HpF7pwV25Ih0=" }, { "address": "1PcuefFpE4JPA98t5mFuk9666rdq56iyFQ", "wif": "Kz34CMzUxYnXzJzCcPWF4Ta4ckF77wZ1YEcwu42b3PhUiqqjFxQJ", "signature": "IF3xL4OiZmoMe7faKDGpKXBfoAi6B3fn9NnZ6hH25iNfvcmxaeYyiD12qsYtObGHgsgU48+EusKHQig2e/s988o=" }, { "address": "1HNHDnzL5ivHYH32Zno7Ve6LUuN8BrUcsr", "wif": "L58PShsyAj785EwXbXbpNUwnF6Vtf2XVXXkuDWamCVGgUYgXZicU", "signature": "HwwD+jHPTm9Xk0M3LYja9NF5b/6HFIxFXIdjI4H4tbjfvwg5NVA4W3TEhGCnV8H3Np3ZfHLox0Z5kf7B2/4YCEE=" }, { "address": "16vw5dMgCHA9ykJLg66Csjgj6d3GUAQcXN", "wif": "KxJUYAxARCKvCmhxoT2x69DKqJmNw2raz6LHhqUXyXDKGEaj3Na7", "signature": "H3FE5gcyjPXC2zBWsOQzZ1/gen3fmlqkhu4OOSajmT8GUQQsguaDAp7rub2EqNvBoJ9WbS/zG98eM85SEJRTiLs=" }, { "address": "1CxxVdX5vFjjm4j7HFdNs95bjHfqYfw2km", "wif": "KxQkTAQFSZoLb8YMruhTM86dRkLn3ULV5wZUr4aXg1raEE8xmtr2", "signature": "HxL1S3suJvp9/mwbAtUgfWPenavgWlJ/0mr7sHPFpMQaaofMIX8i/2GWgACdg6ydw8QEI6DvSGIjKsAYQFnN56E=" }, { "address": "1F6RLtVepf1YmBJ12XLtc2ZPjis6MujFV5", "wif": "KwrjSVqzdQkAdRpJStoRe8v7rBdjqVTmP2WN5gUTuyqA1K5nWoHa", "signature": "H1p7S1Sh0+osdbBNMRfgqqU4JcvNe0eO9b0k0QzBp4zmLnkwKSf167+nxdVHaB5Vm4YOz0k9UappNnjibBlf/kI=" }, { "address": "18EN4qWBkc2oui5aSxg7AVG1nTakH2xvJ8", "wif": "Kx5JQKczGQ4kvkwzjQgMDpsGGmovPqTdnKC7HfMEzKBBLsA38SJ3", "signature": "HwJblWRzZh1C91C3PKsCKG1rer+pk/mQw7/0uT0HGHY7XjfymI7t7gRbU/2imq60wf/oDxIqs6rZVO0C/K9gbEg=" }, { "address": "1PL9j8JE9NTAAu9Em5dKJQ7Xngf5B1BKZH", "wif": "Kyne8Y5kRHBVbrG5WskGBHcSUJscDxACbT6oL4Cw1HvjtiZaBzbi", "signature": "IE/9pf6kC3ayQ054+aD8kJiuXTTN1s0ql4j12wA3RxEyKDbltLHvLH0V98DNmvjTdzmLqBLG5GAkdBwYVIhHeBQ=" }, { "address": "1JB7EWy4VstHUYYShso2hFQemB1c1s8WXk", "wif": "KwRW9DHRE4ccYAnoKV16WXgeceyVohk5u6LPwYoFzoEudS1sKBFk", "signature": "H7cdWu9GGqkujGwPFMjFvfzUdGWVWVMyCfxaerENqv+NQ5YkBY9PExR3C3lCzx+gf1j8Pbg5E/sdfowubMMxhL0=" }, { "address": "1LUjN5oWUtWDYLV5CkF8h4jTtsab8QqwjQ", "wif": "L1Z9cVF2SwTcMjh9tv6pbtq9RKGvuvw5fpd87Q4RTks1RLSwefRh", "signature": "H8mqfJc+FZehDAga90hPH0VfIvfHi9PwvJIj2C0K8bWy+t7ASmy45bbouLsfgt8X3m32l04WfXK4reSeHEi4x3E=" }, { "address": "1Nf8eRSRgkp2RL1Pfnr4fnpxMRrjSPRGhR", "wif": "KyT3az4Pq7NJS3KSq58DRPp9CpFXnsMEan1wQeFB6tmvYzCSunYE", "signature": "IBULc7dfaRlAlg9ogbWH7l6W5DXQWbtCZhgJ17RKmj5v+a3Z2fvMMGcDHJv2uaSSowJXrnYIEgMd6LtqNFaHh2w=" }, { "address": "1BGN1Vfd8XfTFp2gkgHwaSvypu8N3UGxPz", "wif": "Kyzxe4zYuFaUPzcft3aa9qAR4zdZCMmUVPBwP9TupTTVADfmsAx5", "signature": "IOUnxp6MOSdjATJh50SVfMEIZz9uCi9o45P3cNTQB66taaJIRmr5LSlID+xR/TSJQhQfAqbxytKGwO+sZYOMjgA=" }, { "address": "182sS9BeAgSyx6WNDJidthdtfmu3CxHp3g", "wif": "KxacNvHwdjWF3FTbuDb9s1reUrvhdpYHYTHw741jQeuKRKYBQVmi", "signature": "IDF+wb6KSMKaquxqziDk1l3pxQEweSy/0wkhuPuvnFFXZGvUW6d+Yc+LDrF2IzKam7RA2868k9vgReLrb7oN5Fk=" }, { "address": "1CgftGrr6zd3JKLGLZqjg9XkwUQos9TzKh", "wif": "L1KsN27ic9GxsWS8q1wqvhS5p2stifxhcibXgJGfQsoxdmutvc2E", "signature": "INM62jukmMO2aAYMPIdd+ZX1wuVpxzYfTiuWI59t4X4AHqD7uekp8pxVjBe9gJkicxUiTjvnFkchEXimnIUJrMM=" }, { "address": "1LTA4MuaQfSrxSoqKsSZWnzNqYeapsBFMy", "wif": "L2JoR6K3gSUu3ZTjVsMZSGuqRhz5bwN55PdfkDAWXUikwEJVjAg7", "signature": "H2xHxz3Otat2odzjmWMZ+Prksrjb3SRp3m2b1CEvXVi1XpZOeL8cwU3yFLSoC0kLMCTy1Z5Rh7SfIysxFWZjcxc=" }, { "address": "1PRtA7hCYzrFjuYTymsx95LTp32zM2P3pg", "wif": "KxHRZ1QWzWTj5tGkCpiwvmmnqLwwuzTnWsyhacpsRM53hn92kqf8", "signature": "H6eqmm1HKhyMR+gZgPzWlpRXg2QPNgXB3Zge5monKaDIYLqIFno6JcHbGPQlPrcY1LeIIfNWP3DVgprQovQ2i1o=" }, { "address": "12JcGBZza4Vrdn3mGyv7WoxMHqkTQYRLs9", "wif": "L5JosQVcAP5Q7ApyGq839eDUpYvAoDppHn5sXFbZkjhWKjsD9BaJ", "signature": "H+d9w64at/B26WPzoQCtOuFxYKxWRijrEqxne9broAiXj8cHXgdYUmCfdEeTcdH2wuxti901hUpu5zfyZVBpZoo=" }, { "address": "15xVtXWQSmiDF1FVbMq9mTBrySLrWJLDdB", "wif": "L4wNfTzzaFjMwfkFemTAwmZgDESVf8f2QTfMmvojBzn4eoqEhsmR", "signature": "Hxs3TMFAV1XeibZyI/Rq5X6ejbozU8e+cZDZ39FCKA1KN92AFvtkUxSbqUWqLKAnkfBiz8bDyLl531amqMHiN8M=" }, { "address": "14w13xbzCdCvrYLrGWdi6ExWP3jSLB3Pqb", "wif": "KyJyrAr5ugMeTEntTNBDyPwLbo2YvQVBrHtKv7nPYPK8XKSRZg6a", "signature": "HwfQg1x1PfBYxkPutK+CDqPPtWEQrHaEjuoNB0R14SgnX9RYcvZIHl5cz8KYiWRh6lwvTmxAf+FPL0/2jiE0kUY=" }, { "address": "1F2xJ9izn5AbXmVQjqPfEnrTT5AFDa8xFB", "wif": "KxKxt7ntTDhLLy5xhuAS5YAxksSp5ceP7q2pvruxL5vdZzmoRHKG", "signature": "IL42d1xHf8R7PF2cJ1+BcOyjYzZNWovR5lVegBF1vT8wHMj2FCCw+OmywxN58BijpR2LDQsKsHkED/8QwdAaY1k=" }, { "address": "195BmjZJuz6Kc9vj6Sn3Ujw8F2amAVu1YW", "wif": "L21X7Po1DuB49AhBiTFFQuVywaBRgwxKKdwZv5vRnGKX26wtKg41", "signature": "H0+ZEL/kQ1AA9ha9Zgkk6mPmGQCqDPPBiaU/aMEmfz4gNDODDwAuDxQVBwoFIkp5QJ1l0NWuOBbTVEndaSOrFig=" }, { "address": "1Kp4n2Z3RacDrwAF8m7ZhFYBjVzSP5EG3v", "wif": "Kyqk7GgVWaaJSa681qmNPdY2j7VqhcJ9aUqBWCrF8FLTbyq5A97z", "signature": "IEcl8PyC89VOmo33PiDPhUQnDxWzg336QHu3sZ54IrA9KNy0l8iaavWiMt/o6aK1ednn1FZw9NL66PVAyxSZyDQ=" }, { "address": "1Ahzue8Ksu46zDuHehN4tkNx9pnrFSV8Pb", "wif": "KxYddEN95vRt5KMDXSzX3p7m4E3KL9aBPaSNAZSRQVQeSWizHEtC", "signature": "HxzXsWW12bhsLbiBIH2//dgRcRt4Cu8kMEl7VxTeqhNDXa2koK2OhSID3InxTHz5q5y9av/rT78SoxRfItWx2Tc=" }, { "address": "1K6g2t6q3SrMQTuvxMgm4arYnye9JUokcb", "wif": "KxoJLiGXjMjYkzV7z3uAVNnk3firKe9TU87RwSYohfBmy4qkd6ph", "signature": "ICocj16ksUcsbynjRhQkxKY8AfLJBYS8VvsU+qi9UBBtEdXN1gpivxaWVJcPdzZDC7rkBeq3rPUi6wD3jf8GbMQ=" }, { "address": "14H7VmFPdvh9otGRSR63X16cTd8KNfQcsJ", "wif": "KxUQdjc3fPtgpdFsFsqGveFY8UBeP6GUazoMni1cc3xM2tnKEwjP", "signature": "HyAxKcRNpe12D4rjnYQM+9r+mxgkXblhUUhQs6PsC+ILvMjLnWN5V+atoS2TjrPwTLMfoToGKDpFuUTKYBE+T60=" }, { "address": "1PKmkgxUVjhHwmFH9ZXw29ovJLDiMgS85p", "wif": "L5KLavtpkgAeCHpyuaXBDdoRrCojy2vnTPHofNizTFH2HzjPgtkd", "signature": "IAop7pO82as4PrGY+d7237Wh64Br4m4H14SdQGwYb0h611IFD3lmYQVLtl8ifhRC/FJRn1G4q5Sbw3021WOpx9U=" }, { "address": "1GkAeYoh81w1XUB5QAjewXcLJuG4MEPMGg", "wif": "KzZkyaQ2p8ycxZkAV8t4VhvVY393H5qtWm2JwFLnPKVqzBc8aFqF", "signature": "IIDb7RGOiwORafjsU2oeTLcbfMzDs4JHgFWnj3asu4zAmqS5xJxgBrQ1dPDMtIQ9MOf0goUkMdN1yho04TUkCCI=" }, { "address": "1AEDebJoNN1oAWFWxQBRDTV3Q9JY5zF7qo", "wif": "L14Y6GTQXFAGFgzdWic8GG6PAdJgZbKu4YZGJBHndn9CPFLpUuZZ", "signature": "HxebtQFHXBZydScE4/gUA0jsGDKklLSwxKK/jsWyVTQw8VfiD0lJEEnTaSv9bgPllNbMEAJXvVtU23kfb4W7+L8=" }, { "address": "1LGQMUrgQQjdzKaNZW4VRsiWnnzGoWZTVW", "wif": "L1bYMTmFVu8FFoqJjqHQecy7h1cgdcGvPwFBMeC2fitFxEvAtvLR", "signature": "H57ky6Qlfl+Jupof4pxSmsypKniiDA2otOAP4tsIfYJT3K9GxjmFzqRtaT/HM0sx1xESV66kL5MPyFyHSf6rsYM=" }, { "address": "1HWzchVECQUGJKhu4Vx4z7kX9WwMvMoZGh", "wif": "KwYZMN1CTCpfJ28xvAPWQLrWpu7FShdNhhFt7Sc87tTMTepMBXFK", "signature": "HwyJtAWLpAFqMEM5FjC1tncGKP7I63QtTsOPbedsiX6Tg+TiDCdYVBw/3V8vwqWaH3NEhm3F3haPHgf7dfIjcZ8=" }, { "address": "1NT9xTsRc5mZPnRRzoHUsGEBRR9EuB5VSk", "wif": "L1DfXwwHAHiGQ9ziXB5DX89GSTNS6oGYsEKHNWJjrFnvjza1iBpq", "signature": "H+wfYf/vA50p7M5kpreHBcAj86W1qgdce7cxlrAAolYYOHrdmR3MHVFddTs41uLPcZQCkiSmbxcC6ETeZMxykXM=" }, { "address": "1A14Zia37FtzscnHVQMowHZzcoibUL73wc", "wif": "KxjyEjdQ731DUEqQVYhWpmkbBKJCY3hd8pKwem3RjGJBygeLQbLo", "signature": "IJGTlHhcyc1PwLnzKg8lwAffGMJzcAVwYMyIiJ41t2gLOGpBPQ9vr5/j4KncIedyKfFi5it8JBYUu8NzUtzfXkQ=" }, { "address": "1CXVsX1dRmWm3KedDtoDMJSbenfdeDPK88", "wif": "L4oLj8ycPZsnsmK818Q8cehakD2HXMwysAUBmWX1mVErrpfcwZ5G", "signature": "IBTHdNmH/L3dsaGEQ2BD50HJj861dUN2oXNV/MDc4x5fYwfDQ/Hc1ir8XF4zg9bRIyoPLJL+qKcfC90tyJbgwcY=" }, { "address": "1BMZUpFe3FZj8n3XR94FXhkxGmf9KRYKGg", "wif": "L3hQX3abPQWia9kosanvrK6btJkm6Dg2Qcg4yw9y92BjJCJgZnjS", "signature": "IMisx/Mu/z/Qeo6ZvT4zV+NysQmdBd5L/O2Qm2Kb4re40564PIc2asiXtN63+H8J9ih1XsN8eFn5DzEkb9D8kAk=" }, { "address": "1KjSicpQLoEzgqg7SjQnNFjNkQdKoVRKVp", "wif": "L1u6YL6vugnX8zn22pthNr63MLaCNn8rU3ex6UBV6XYtoEGmoeMu", "signature": "H1UP0Sxr5mKjT75dJGo8E4n2hB/SYrWb2ttSGsOgHPiDky/UxHDrpYFLVm5oNDideGLFUOdG5yN4oUvIoVcryEo=" }, { "address": "1NAhHfAR3WGdaeWg3ZXhr8sAtUGPFJtKTe", "wif": "KwZr1A9MtMpvdP7iSoT4AyW5aUJiya4toFWePt4ijnQrm5A6xbye", "signature": "HxSqKGPg1iUeMKrBg2GYz7+gv8AWxirPo0eLHLThUTrL+bXgE91dcgdy9LPFOn5wuvIRxSp/MsRm9loYa411osA=" }, { "address": "1J55LFmr2wwXwaLMAxidjDAZXUHMgS8nL5", "wif": "KzdNhSobjBTUEpQstbGvCZSVDjxJfnCEHycfuLWHHJ6CSNeYgHax", "signature": "H2TWrz6xO7RGdoi2qgqrcr6PLpVbPyr/2sN3F/0nCE0FVE/sBcZGQJjRVpsp1EYx/6w3GH/oD6jnEtRePWqKWI0=" }, { "address": "1568zfydB9n1LXhaSVc7zE7FZCqRpe5itX", "wif": "L5ikWToVZK1b8heKDL6Y2WsF1sZhZQQAgUvqRrZFX9xMsSzZCD4w", "signature": "H5biQUgDZfVtporZe0+WLk4TIpyibaYosQbIFIj6MiqVzXyj1l7T8Rav35fCE+B7rz/mFgmTYW/vTeMGd73MZaU=" }, { "address": "1EpPQJeica4FeXTxPBtM2HcN1drGT9NiV6", "wif": "L3YRxU1SUsyeVz9cV9BW5hyiFsh4atgoDKHivMxL862SPLKg3rXa", "signature": "IHlNh6QsJT99x1Q8f36FAn3B+EDBS2oeBN2MCIGnLUFrVutUzUGaIs3/J9VfKKhXQArdnbrPrzor8vy65MvMDu0=" }, { "address": "12duLneSfQWCuZwZriM9qK9wW99gMrNUig", "wif": "L1MyJ25p5nzyuqkDHWbPCMA3dJWoGTPPX8M1PgsyHZygWFUyKQet", "signature": "IIgkm9e762tsz6ZbhlvD06I4q+lu1X0qof9fk578SKYWx9j7P/qew/Xxzp9iwIHAdLPM7yuJTyTJOyVlgXT1Jt0=" }, { "address": "14YZHZbrL9EzH6sCpmQbeutTBqrFB1dRdD", "wif": "L4gYSCnBi35MCPRCfbDzPMmRvYBFWw9fQAxcvs4pYSCBc6SKD696", "signature": "IEpeBqqPmjbVpMb2LaPjgDfUcpDuAuxdidFiR2Q34b4MpuWBQmFvsAwqbyn8vAV8883sFGO//LDqIPmZfnvxdkI=" }, { "address": "1CiuEouXGWG1TR8iVo2reDe7ebcCqwcnPV", "wif": "Kyn4mz682ahaoiNvkYuVZh3zRWRLCDSFyQaz6cAmcNLE2fV3QZhZ", "signature": "HxRfJ73AFHPeiHasEN1r5Hp4heeLS/oQxcTDSX1K1X11oACPFQ6bG7iS1WV3PKmKKB4ZY/6WWfz2kE8mmHEVIIY=" }, { "address": "1P3z6491LJ78McE3AXUA6YBjmtPgnhmPm", "wif": "L4q49J2rR5waECqpCy2BqmY7rmw1y8TNRmqfsRVwGD6Hs1XFHHXs", "signature": "IFb5K9hljcuW7vUE1d8TSJ3FvtK+Tbz+QX99/HuxkNE2kxF70S8dYMaUbibq9/9bmsnZa5UGJg1wFPUtPMI5jWE=" }, { "address": "16qzDG8m63tTEv9rrYuzTumZTcWQwhnRMA", "wif": "Kwk34zp3ZxBRwJWCE3iTHVz9X7ZwsAXcgkdiK6rBwSo7yAkMxCoK", "signature": "Hxqa8KbHcpjOcmHwu6SI0e5M2uGUPKpN7DOJN6NkBY3Epqiz56a61NikoTarEqMZ7MA3JZbP/qYWN51hmkSaGXw=" }, { "address": "1Emrg69U67pGoLApMqAHVRWc5XKy88B3rG", "wif": "L4z6mmq5vBTNhWKQcu4ri7sBeZoqWoRJxFPzm4HovMidB7ioE5og", "signature": "IGDbZp23n01SS8wcbiKBkVq0bXApo2/qwCoSQt5MhSQMSQHmduePO9qhG981//FuWZIX4X6Hkc/UWgfuZxeQ3h8=" }, { "address": "14dcz4s1Uno7a1jqt1GxsLKahczMEVVNT8", "wif": "L43ZM7uut9rEWNneSW3aT4mmNKfoKia8nbhpJNtA2TxFfaZtj9Eh", "signature": "H9ekLjFd0ueGUb11IA1D94t6XpTxbVP6wuZQrvdilHRdAahZQEh5qL8xSGGLQ7IEtooDpuVcyeJYhSv3vfIgI6g=" }, { "address": "1AZcwLLxSoXKGVBpxxbG83ZDgLZJEqzNQv", "wif": "KxzNhnDuFRbFmoiogxQAvrPtDLX4CEiwHwiiYXte6VH8EU3jCzC8", "signature": "H5HW+ZZosxwczxxsqYhq+UwHJEk1Sf2xIQhkGCCbEljKLrM+PeSsFFvVKHny9eTYuNaCgoXD21LtfqaJQZmxg0E=" }, { "address": "1Net84z34Bz2Yz3o1fUeYauD1RgKFBUpyH", "wif": "L3rRYDqdTXm4jvRg9qzUB2R9JX1eZf5RtmWoDgUtnmDHfSrpwgMb", "signature": "HzgPoNDIe2QFdvRO+9YqlpWokioiZJETYAcSRboHgjlE/Il5vInuxRNxGkcbX9fu1mP3Nf3bH0v/en5EVzWRGlA=" }, { "address": "1q5DjZfjqXSW83PkrncQqByJkuKnSc926", "wif": "L5SLhsW38EKUz6ZpLCDx8PLqeyQCBMEfH2MKySidwHFqVvi7uoj8", "signature": "HxxTt7XidQfjMLDmK6fsf0f57wD+5wJGEV0pNtzFrR7d5+V2/YvdB1BurjRxvSZTzp5o/7AAEQcqE/JvpBprWIw=" }, { "address": "19ryK9RzvTeC7CZ1oRtw22ssCFWWYSGi29", "wif": "KzTmDNoobwaHkEvLBwnbwKNm6Qutwndqw3NnyNg9yaCKnb7WMQWq", "signature": "IFFeD6EQuyBjp0UU0t9gsYxiOzKSzEpIn30Kdy/pX4Z5pTrD/uxvO1k47sjFk513BVOCSFxWuqhFL5sNFq8aLSI=" }, { "address": "1Pc9FnL4nys9sNxDv5uhVrUQJptTdgN3ur", "wif": "L58gvLiGSZ3m3jRzo9Ypp7TDD9LGKMcAS45e1pFSQY8H4FUsr1kd", "signature": "H+ZXwCyU90e21YL6S0n1bcJ208zsq8FWLBQU/sOicsIMFdYQ8jLCiA2ErG7hv2o7UCNVD1p0QmLD7H73SjX5kEs=" }, { "address": "12Y7Vn7bZXs27H9bDVt1hSmEKmqfhjUHNr", "wif": "L4mLCnkFYcTGWY7xWdrr9fhLqzQGfMwKbFivHaaUA3BMBvm625FY", "signature": "H5Z2UZmRSvXCKJvFxaqsDw1rwtE20Ts2x2I/17Gl8ZrpBf8uFL/bfw2geBOSoEFU/uCVZOJj/GSHiW+vdWindik=" }, { "address": "18TNP7QLezqsv3cvBsnrB7adJbPaZhQELj", "wif": "L1fgADHELoBzLRDNiUvcXScW1tEpgLeBRJ79pWuNRUqQ7RC5fgVQ", "signature": "H2HcMFessphuTqJLLxhdxM9j3KFKmTFvkigLB+L/JJQ5u/RlqzMeFkvEjVVHZtXhm1KLdYYsCIPvgh/5MTLc0lY=" }, { "address": "1NYDPFBSvtEx3DtAaevqN8c4DMdMHNZz3H", "wif": "Ky6G8MAnacN9aAhpiFYYYgVMyp2YoQAmmSau6f9DJygP74FBa1ob", "signature": "H/hilSsA20DUX/O2AGVvnAgsndt9Talirx5PIEYc3QTIxuK5qaacH1UKuqvxyFk0/mDNBJCK1Zb6SB+XsmgfWHQ=" }, { "address": "18hz5PkxYQWTPdVg3wPwtcpHpgxXGwYbPU", "wif": "Kzj6ZSeXB6S38rNeQaAnDRnBEvhkpcwz8uksYC1uFKm45NFvmjHg", "signature": "H2cNrEqNAyqiPISsxkNM8Siaj7H+J8cFe5ZID1bkk0Tsf0D2fLYUE4rjWxkI+3di2i1rGwUEJIsV9hb8CjaBHZs=" }, { "address": "14yvK3MatK2u28nxZXfCNjyoyFuaGd4kU7", "wif": "L5Hm3zXXpuiBrF4ywFTqh5L7D7WfW2UfcfWfDbQwNarJJg2Y5LVL", "signature": "HzqB0gZfVAiKoXJ9Z5WGgz9EMAveMxF67gGReSpgr0zw1Mf7KA5inV0hPqA3lPRY4rmSOeKE0dBz2rFz0VawAwY=" }, { "address": "1HEjBMwYBoWPT3JJH16MEZbQ2EutUX9sU4", "wif": "KygyNuSYL82GrswYvb3w1ntpCmDaNEbwm4U5DKfWT6EGbBDz6oUE", "signature": "H+K90IF2uu1NVj/fnpH1sn7gEEjJ+zhXN1JHjRq5QC2GBWx92ScHjCb9EsecARtsMdsIyBd/lRA5B/9KjGfZoZs=" }, { "address": "1KCetUsMuMDXQiZqcA7TzQ8Gyvuo6ZgU9V", "wif": "L2MEa6TKPY3BVMYH7h22cq64Wx9iGNEzTu1RRtWc1W3gSy3kV3ZJ", "signature": "H23kt5yF2D6oCcSb4XpKGej9TAkspKbGaG/C3GSzduVMLnI7NltLeAbJqsIBCDP8qK3xRaqE1ZlHbn5ZJJcdvjs=" }, { "address": "1LPQfNKdVEs5pYEzeszqCa5zfFZSouD5zF", "wif": "KzqZiepEePG14E6HVt9uB7Nrq1XS9mCyaeAHC82jZZaNSLLjtCYK", "signature": "IO3YOm+Zq/JLWGjWq4f2j2NKXJNvZ8LIjSiPO6p19DdcA+exSXWrfYs5GsvSkQlxEoYgHvCGlXJOdwdCnpktFMM=" }, { "address": "12Hzw6UKBoJ3rhqvUczbr86y3HZu683t93", "wif": "L5KgJJsJcpj3dHzdGUCJtShWSo4q6hCCZhLZqfbP2F3XgNSXVq6N", "signature": "IB2+5oRrwyoAko9V1rwAvFAdujavO4QXqmKktcZjg2ap8dZkj7Y1XR+d3SNORCRrZ0DAsyE1yrjvd7yR8Xy19GU=" }, { "address": "1CfY95vjs38hqmeaZndyM7PRRVumzgPkUC", "wif": "L4p1pXiJq5STXefQekKCJajXwATg2wLwsPKHcWAuKUoGoNCRQvbF", "signature": "H8kFuZeSJ7A7fiGzjgjvNHDDYXzFjxe/KLBxF5nB7Onpf/xndQ6KNeHcJD2xj0VoP1GVJKEI83ddXzt7svB53m4=" }, { "address": "1JHaAQemw8o11ELAAcjosNLDzVqUU2dWW4", "wif": "L144LBabTTCXk96x5HonRN7skfikcYqBN6X5ZqFXg9ag4bJFwdaj", "signature": "HxQ+IxT9KAsGoBcJyKbC4VTzFAqEOFH3va1lw57kiywbs7XwsrojP91Md31jUM/U9pvosYceC6qaRvfG62arXa8=" } ]python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/tx_invalid.json000066400000000000000000000227171430270607500276240ustar00rootroot00000000000000[ ["The following are deserialized transactions which are invalid."], ["They are in the form"], ["[[[prevout hash, prevout index, prevout scriptPubKey], [input 2], ...],"], ["serializedTransaction, enforceP2SH]"], ["Objects that are only a single string (like this one) are ignored"], ["0e1b5688cf179cd9f7cbda1fac0090f6e684bbf8cd946660120197c3f3681809 but with extra junk appended to the end of the scriptPubKey"], [[["6ca7ec7b1847f6bdbd737176050e6a08d66ccd55bb94ad24f4018024107a5827", 0, "0x41 0x043b640e983c9690a14c039a2037ecc3467b27a0dcd58f19d76c7bc118d09fec45adc5370a1c5bf8067ca9f5557a4cf885fdb0fe0dcc9c3a7137226106fbc779a5 CHECKSIG VERIFY 1"]], "010000000127587a10248001f424ad94bb55cd6cd6086a0e05767173bdbdf647187beca76c000000004948304502201b822ad10d6adc1a341ae8835be3f70a25201bbff31f59cbb9c5353a5f0eca18022100ea7b2f7074e9aa9cf70aa8d0ffee13e6b45dddabf1ab961bda378bcdb778fa4701ffffffff0100f2052a010000001976a914fc50c5907d86fed474ba5ce8b12a66e0a4c139d888ac00000000", true], ["This is the nearly-standard transaction with CHECKSIGVERIFY 1 instead of CHECKSIG from tx_valid.json"], ["but with the signature duplicated in the scriptPubKey with a non-standard pushdata prefix"], ["See FindAndDelete, which will only remove if it uses the same pushdata prefix as is standard"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "DUP HASH160 0x14 0x5b6462475454710f3c22f5fdf0b40704c92f25c3 EQUALVERIFY CHECKSIGVERIFY 1 0x4c 0x47 0x3044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a01"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006a473044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a012103ba8c8b86dea131c22ab967e6dd99bdae8eff7a1f75a2c35f1f944109e3fe5e22ffffffff010000000000000000015100000000", true], ["Same as above, but with the sig in the scriptSig also pushed with the same non-standard OP_PUSHDATA"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "DUP HASH160 0x14 0x5b6462475454710f3c22f5fdf0b40704c92f25c3 EQUALVERIFY CHECKSIGVERIFY 1 0x4c 0x47 0x3044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a01"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006b4c473044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a012103ba8c8b86dea131c22ab967e6dd99bdae8eff7a1f75a2c35f1f944109e3fe5e22ffffffff010000000000000000015100000000", true], ["An invalid P2SH Transaction"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x7a052c840ba73af26755de42cf01cc9e0a49fef0 EQUAL"]], "010000000100010000000000000000000000000000000000000000000000000000000000000000000009085768617420697320ffffffff010000000000000000015100000000", true], ["No outputs"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x05ab9e14d983742513f0f451e105ffb4198d1dd4 EQUAL"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006d483045022100f16703104aab4e4088317c862daec83440242411b039d14280e03dd33b487ab802201318a7be236672c5c56083eb7a5a195bc57a40af7923ff8545016cd3b571e2a601232103c40e5d339df3f30bf753e7e04450ae4ef76c9e45587d1d993bdc4cd06f0651c7acffffffff0000000000", true], ["Negative output"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0xae609aca8061d77c5e111f6bb62501a6bbe2bfdb EQUAL"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006d4830450220063222cbb128731fc09de0d7323746539166544d6c1df84d867ccea84bcc8903022100bf568e8552844de664cd41648a031554327aa8844af34b4f27397c65b92c04de0123210243ec37dee0e2e053a9c976f43147e79bc7d9dc606ea51010af1ac80db6b069e1acffffffff01ffffffffffffffff015100000000", true], ["MAX_MONEY + 1 output"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x32afac281462b822adbec5094b8d4d337dd5bd6a EQUAL"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006e493046022100e1eadba00d9296c743cb6ecc703fd9ddc9b3cd12906176a226ae4c18d6b00796022100a71aef7d2874deff681ba6080f1b278bac7bb99c61b08a85f4311970ffe7f63f012321030c0588dc44d92bdcbf8e72093466766fdc265ead8db64517b0c542275b70fffbacffffffff010140075af0750700015100000000", true], ["MAX_MONEY output + 1 output"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0xb558cbf4930954aa6a344363a15668d7477ae716 EQUAL"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006d483045022027deccc14aa6668e78a8c9da3484fbcd4f9dcc9bb7d1b85146314b21b9ae4d86022100d0b43dece8cfb07348de0ca8bc5b86276fa88f7f2138381128b7c36ab2e42264012321029bb13463ddd5d2cc05da6e84e37536cb9525703cfd8f43afdb414988987a92f6acffffffff020040075af075070001510001000000000000015100000000", true], ["Duplicate inputs"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x236d0639db62b0773fd8ac34dc85ae19e9aba80a EQUAL"]], "01000000020001000000000000000000000000000000000000000000000000000000000000000000006c47304402204bb1197053d0d7799bf1b30cd503c44b58d6240cccbdc85b6fe76d087980208f02204beeed78200178ffc6c74237bb74b3f276bbb4098b5605d814304fe128bf1431012321039e8815e15952a7c3fada1905f8cf55419837133bd7756c0ef14fc8dfe50c0deaacffffffff0001000000000000000000000000000000000000000000000000000000000000000000006c47304402202306489afef52a6f62e90bf750bbcdf40c06f5c6b138286e6b6b86176bb9341802200dba98486ea68380f47ebb19a7df173b99e6bc9c681d6ccf3bde31465d1f16b3012321039e8815e15952a7c3fada1905f8cf55419837133bd7756c0ef14fc8dfe50c0deaacffffffff010000000000000000015100000000", true], ["Coinbase of size 1"], ["Note the input is just required to make the tester happy"], [[["0000000000000000000000000000000000000000000000000000000000000000", -1, "1"]], "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0151ffffffff010000000000000000015100000000", true], ["Coinbase of size 101"], ["Note the input is just required to make the tester happy"], [[["0000000000000000000000000000000000000000000000000000000000000000", -1, "1"]], "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff655151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151ffffffff010000000000000000015100000000", true], ["Null txin"], [[["0000000000000000000000000000000000000000000000000000000000000000", -1, "HASH160 0x14 0x02dae7dbbda56097959cba59b1989dd3e47937bf EQUAL"]], "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff6e49304602210086f39e028e46dafa8e1e3be63906465f4cf038fbe5ed6403dc3e74ae876e6431022100c4625c675cfc5c7e3a0e0d7eaec92ac24da20c73a88eb40d09253e51ac6def5201232103a183ddc41e84753aca47723c965d1b5c8b0e2b537963518355e6dd6cf8415e50acffffffff010000000000000000015100000000", true], ["Same as the transactions in valid with one input SIGHASH_ALL and one SIGHASH_ANYONECANPAY, but we set the _ANYONECANPAY sequence number, invalidating the SIGHASH_ALL signature"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0x21 0x035e7f0d4d0841bcd56c39337ed086b1a633ee770c1ffdd94ac552a95ac2ce0efc CHECKSIG"], ["0000000000000000000000000000000000000000000000000000000000000200", 0, "0x21 0x035e7f0d4d0841bcd56c39337ed086b1a633ee770c1ffdd94ac552a95ac2ce0efc CHECKSIG"]], "01000000020001000000000000000000000000000000000000000000000000000000000000000000004948304502203a0f5f0e1f2bdbcd04db3061d18f3af70e07f4f467cbc1b8116f267025f5360b022100c792b6e215afc5afc721a351ec413e714305cb749aae3d7fee76621313418df10101000000000200000000000000000000000000000000000000000000000000000000000000000000484730440220201dc2d030e380e8f9cfb41b442d930fa5a685bb2c8db5906671f865507d0670022018d9e7a8d4c8d86a73c2a724ee38ef983ec249827e0e464841735955c707ece98101000000010100000000000000015100000000", true], ["Incorrect signature order"], ["Note the input is just required to make the tester happy"], [[["b3da01dd4aae683c7aee4d5d8b52a540a508e1115f77cd7fa9a291243f501223", 0, "HASH160 0x14 0xb1ce99298d5f07364b57b1e5c9cc00be0b04a954 EQUAL"]], "01000000012312503f2491a2a97fcd775f11e108a540a5528b5d4dee7a3c68ae4add01dab300000000fdfe000048304502207aacee820e08b0b174e248abd8d7a34ed63b5da3abedb99934df9fddd65c05c4022100dfe87896ab5ee3df476c2655f9fbe5bd089dccbef3e4ea05b5d121169fe7f5f401483045022100f6649b0eddfdfd4ad55426663385090d51ee86c3481bdc6b0c18ea6c0ece2c0b0220561c315b07cffa6f7dd9df96dbae9200c2dee09bf93cc35ca05e6cdf613340aa014c695221031d11db38972b712a9fe1fc023577c7ae3ddb4a3004187d41c45121eecfdbb5b7210207ec36911b6ad2382860d32989c7b8728e9489d7bbc94a6b5509ef0029be128821024ea9fac06f666a4adc3fc1357b7bec1fd0bdece2b9d08579226a8ebde53058e453aeffffffff0180380100000000001976a914c9b99cddf847d10685a4fabaa0baf505f7c3dfab88ac00000000", true], ["Empty stack when we try to run CHECKSIG"], [[["ad503f72c18df5801ee64d76090afe4c607fb2b822e9b7b63c5826c50e22fc3b", 0, "0x21 0x027c3a97665bf283a102a587a62a30a0c102d4d3b141015e2cae6f64e2543113e5 CHECKSIG NOT"]], "01000000013bfc220ec526583cb6b7e922b8b27f604cfe0a09764de61e80f58dc1723f50ad0000000000ffffffff0101000000000000002321027c3a97665bf283a102a587a62a30a0c102d4d3b141015e2cae6f64e2543113e5ac00000000", true], ["Make diffs cleaner by leaving a comment here without comma at the end"] ] python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/data/tx_valid.json000066400000000000000000000705121430270607500272710ustar00rootroot00000000000000[ ["The following are deserialized transactions which are valid."], ["They are in the form"], ["[[[prevout hash, prevout index, prevout scriptPubKey], [input 2], ...],"], ["serializedTransaction, enforceP2SH]"], ["Objects that are only a single string (like this one) are ignored"], ["The following is 23b397edccd3740a74adb603c9756370fafcde9bcc4483eb271ecad09a94dd63"], ["It is of particular interest because it contains an invalidly-encoded signature which OpenSSL accepts"], ["See http://r6.ca/blog/20111119T211504Z.html"], ["It is also the first OP_CHECKMULTISIG transaction in standard form"], [[["60a20bd93aa49ab4b28d514ec10b06e1829ce6818ec06cd3aabd013ebcdc4bb1", 0, "1 0x41 0x04cc71eb30d653c0c3163990c47b976f3fb3f37cccdcbedb169a1dfef58bbfbfaff7d8a473e7e2e6d317b87bafe8bde97e3cf8f065dec022b51d11fcdd0d348ac4 0x41 0x0461cbdcc5409fb4b4d42b51d33381354d80e550078cb532a34bfa2fcfdeb7d76519aecc62770f5b0e4ef8551946d8a540911abe3e7854a26f39f58b25c15342af 2 OP_CHECKMULTISIG"]], "0100000001b14bdcbc3e01bdaad36cc08e81e69c82e1060bc14e518db2b49aa43ad90ba26000000000490047304402203f16c6f40162ab686621ef3000b04e75418a0c0cb2d8aebeac894ae360ac1e780220ddc15ecdfc3507ac48e1681a33eb60996631bf6bf5bc0a0682c4db743ce7ca2b01ffffffff0140420f00000000001976a914660d4ef3a743e3e696ad990364e555c271ad504b88ac00000000", true], ["The following is a tweaked form of 23b397edccd3740a74adb603c9756370fafcde9bcc4483eb271ecad09a94dd63"], ["It has an arbitrary extra byte stuffed into the signature at pos length - 2"], [[["60a20bd93aa49ab4b28d514ec10b06e1829ce6818ec06cd3aabd013ebcdc4bb1", 0, "1 0x41 0x04cc71eb30d653c0c3163990c47b976f3fb3f37cccdcbedb169a1dfef58bbfbfaff7d8a473e7e2e6d317b87bafe8bde97e3cf8f065dec022b51d11fcdd0d348ac4 0x41 0x0461cbdcc5409fb4b4d42b51d33381354d80e550078cb532a34bfa2fcfdeb7d76519aecc62770f5b0e4ef8551946d8a540911abe3e7854a26f39f58b25c15342af 2 OP_CHECKMULTISIG"]], "0100000001b14bdcbc3e01bdaad36cc08e81e69c82e1060bc14e518db2b49aa43ad90ba260000000004A0048304402203f16c6f40162ab686621ef3000b04e75418a0c0cb2d8aebeac894ae360ac1e780220ddc15ecdfc3507ac48e1681a33eb60996631bf6bf5bc0a0682c4db743ce7ca2bab01ffffffff0140420f00000000001976a914660d4ef3a743e3e696ad990364e555c271ad504b88ac00000000", true], ["The following is c99c49da4c38af669dea436d3e73780dfdb6c1ecf9958baa52960e8baee30e73"], ["It is of interest because it contains a 0-sequence as well as a signature of SIGHASH type 0 (which is not a real type)"], [[["406b2b06bcd34d3c8733e6b79f7a394c8a431fbf4ff5ac705c93f4076bb77602", 0, "DUP HASH160 0x14 0xdc44b1164188067c3a32d4780f5996fa14a4f2d9 EQUALVERIFY CHECKSIG"]], "01000000010276b76b07f4935c70acf54fbf1f438a4c397a9fb7e633873c4dd3bc062b6b40000000008c493046022100d23459d03ed7e9511a47d13292d3430a04627de6235b6e51a40f9cd386f2abe3022100e7d25b080f0bb8d8d5f878bba7d54ad2fda650ea8d158a33ee3cbd11768191fd004104b0e2c879e4daf7b9ab68350228c159766676a14f5815084ba166432aab46198d4cca98fa3e9981d0a90b2effc514b76279476550ba3663fdcaff94c38420e9d5000000000100093d00000000001976a9149a7b0f3b80c6baaeedce0a0842553800f832ba1f88ac00000000", true], ["A nearly-standard transaction with CHECKSIGVERIFY 1 instead of CHECKSIG"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "DUP HASH160 0x14 0x5b6462475454710f3c22f5fdf0b40704c92f25c3 EQUALVERIFY CHECKSIGVERIFY 1"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006a473044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a012103ba8c8b86dea131c22ab967e6dd99bdae8eff7a1f75a2c35f1f944109e3fe5e22ffffffff010000000000000000015100000000", true], ["Same as above, but with the signature duplicated in the scriptPubKey with the proper pushdata prefix"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "DUP HASH160 0x14 0x5b6462475454710f3c22f5fdf0b40704c92f25c3 EQUALVERIFY CHECKSIGVERIFY 1 0x47 0x3044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a01"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006a473044022067288ea50aa799543a536ff9306f8e1cba05b9c6b10951175b924f96732555ed022026d7b5265f38d21541519e4a1e55044d5b9e17e15cdbaf29ae3792e99e883e7a012103ba8c8b86dea131c22ab967e6dd99bdae8eff7a1f75a2c35f1f944109e3fe5e22ffffffff010000000000000000015100000000", true], ["The following is f7fdd091fa6d8f5e7a8c2458f5c38faffff2d3f1406b6e4fe2c99dcc0d2d1cbb"], ["It caught a bug in the workaround for 23b397edccd3740a74adb603c9756370fafcde9bcc4483eb271ecad09a94dd63 in an overly simple implementation"], [[["b464e85df2a238416f8bdae11d120add610380ea07f4ef19c5f9dfd472f96c3d", 0, "DUP HASH160 0x14 0xbef80ecf3a44500fda1bc92176e442891662aed2 EQUALVERIFY CHECKSIG"], ["b7978cc96e59a8b13e0865d3f95657561a7f725be952438637475920bac9eb21", 1, "DUP HASH160 0x14 0xbef80ecf3a44500fda1bc92176e442891662aed2 EQUALVERIFY CHECKSIG"]], "01000000023d6cf972d4dff9c519eff407ea800361dd0a121de1da8b6f4138a2f25de864b4000000008a4730440220ffda47bfc776bcd269da4832626ac332adfca6dd835e8ecd83cd1ebe7d709b0e022049cffa1cdc102a0b56e0e04913606c70af702a1149dc3b305ab9439288fee090014104266abb36d66eb4218a6dd31f09bb92cf3cfa803c7ea72c1fc80a50f919273e613f895b855fb7465ccbc8919ad1bd4a306c783f22cd3227327694c4fa4c1c439affffffff21ebc9ba20594737864352e95b727f1a565756f9d365083eb1a8596ec98c97b7010000008a4730440220503ff10e9f1e0de731407a4a245531c9ff17676eda461f8ceeb8c06049fa2c810220c008ac34694510298fa60b3f000df01caa244f165b727d4896eb84f81e46bcc4014104266abb36d66eb4218a6dd31f09bb92cf3cfa803c7ea72c1fc80a50f919273e613f895b855fb7465ccbc8919ad1bd4a306c783f22cd3227327694c4fa4c1c439affffffff01f0da5200000000001976a914857ccd42dded6df32949d4646dfa10a92458cfaa88ac00000000", true], ["The following tests for the presence of a bug in the handling of SIGHASH_SINGLE"], ["It results in signing the constant 1, instead of something generated based on the transaction,"], ["when the input doing the signing has an index greater than the maximum output index"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "DUP HASH160 0x14 0xe52b482f2faa8ecbf0db344f93c84ac908557f33 EQUALVERIFY CHECKSIG"], ["0000000000000000000000000000000000000000000000000000000000000200", 0, "1"]], "01000000020002000000000000000000000000000000000000000000000000000000000000000000000151ffffffff0001000000000000000000000000000000000000000000000000000000000000000000006b483045022100c9cdd08798a28af9d1baf44a6c77bcc7e279f47dc487c8c899911bc48feaffcc0220503c5c50ae3998a733263c5c0f7061b483e2b56c4c41b456e7d2f5a78a74c077032102d5c25adb51b61339d2b05315791e21bbe80ea470a49db0135720983c905aace0ffffffff010000000000000000015100000000", true], ["An invalid P2SH Transaction"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x7a052c840ba73af26755de42cf01cc9e0a49fef0 EQUAL"]], "010000000100010000000000000000000000000000000000000000000000000000000000000000000009085768617420697320ffffffff010000000000000000015100000000", false], ["A valid P2SH Transaction using the standard transaction type put forth in BIP 16"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x8febbed40483661de6958d957412f82deed8e2f7 EQUAL"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006e493046022100c66c9cdf4c43609586d15424c54707156e316d88b0a1534c9e6b0d4f311406310221009c0fe51dbc9c4ab7cc25d3fdbeccf6679fe6827f08edf2b4a9f16ee3eb0e438a0123210338e8034509af564c62644c07691942e0c056752008a173c89f60ab2a88ac2ebfacffffffff010000000000000000015100000000", true], ["Tests for CheckTransaction()"], ["MAX_MONEY output"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0x32afac281462b822adbec5094b8d4d337dd5bd6a EQUAL"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006e493046022100e1eadba00d9296c743cb6ecc703fd9ddc9b3cd12906176a226ae4c18d6b00796022100a71aef7d2874deff681ba6080f1b278bac7bb99c61b08a85f4311970ffe7f63f012321030c0588dc44d92bdcbf8e72093466766fdc265ead8db64517b0c542275b70fffbacffffffff010040075af0750700015100000000", true], ["MAX_MONEY output + 0 output"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "HASH160 0x14 0xb558cbf4930954aa6a344363a15668d7477ae716 EQUAL"]], "01000000010001000000000000000000000000000000000000000000000000000000000000000000006d483045022027deccc14aa6668e78a8c9da3484fbcd4f9dcc9bb7d1b85146314b21b9ae4d86022100d0b43dece8cfb07348de0ca8bc5b86276fa88f7f2138381128b7c36ab2e42264012321029bb13463ddd5d2cc05da6e84e37536cb9525703cfd8f43afdb414988987a92f6acffffffff020040075af075070001510000000000000000015100000000", true], ["Coinbase of size 2"], ["Note the input is just required to make the tester happy"], [[["0000000000000000000000000000000000000000000000000000000000000000", -1, "1"]], "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff025151ffffffff010000000000000000015100000000", true], ["Coinbase of size 100"], ["Note the input is just required to make the tester happy"], [[["0000000000000000000000000000000000000000000000000000000000000000", -1, "1"]], "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff6451515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151515151ffffffff010000000000000000015100000000", true], ["Simple transaction with first input is signed with SIGHASH_ALL, second with SIGHASH_ANYONECANPAY"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0x21 0x035e7f0d4d0841bcd56c39337ed086b1a633ee770c1ffdd94ac552a95ac2ce0efc CHECKSIG"], ["0000000000000000000000000000000000000000000000000000000000000200", 0, "0x21 0x035e7f0d4d0841bcd56c39337ed086b1a633ee770c1ffdd94ac552a95ac2ce0efc CHECKSIG"]], "010000000200010000000000000000000000000000000000000000000000000000000000000000000049483045022100d180fd2eb9140aeb4210c9204d3f358766eb53842b2a9473db687fa24b12a3cc022079781799cd4f038b85135bbe49ec2b57f306b2bb17101b17f71f000fcab2b6fb01ffffffff0002000000000000000000000000000000000000000000000000000000000000000000004847304402205f7530653eea9b38699e476320ab135b74771e1c48b81a5d041e2ca84b9be7a802200ac8d1f40fb026674fe5a5edd3dea715c27baa9baca51ed45ea750ac9dc0a55e81ffffffff010100000000000000015100000000", true], ["Same as above, but we change the sequence number of the first input to check that SIGHASH_ANYONECANPAY is being followed"], [[["0000000000000000000000000000000000000000000000000000000000000100", 0, "0x21 0x035e7f0d4d0841bcd56c39337ed086b1a633ee770c1ffdd94ac552a95ac2ce0efc CHECKSIG"], ["0000000000000000000000000000000000000000000000000000000000000200", 0, "0x21 0x035e7f0d4d0841bcd56c39337ed086b1a633ee770c1ffdd94ac552a95ac2ce0efc CHECKSIG"]], "01000000020001000000000000000000000000000000000000000000000000000000000000000000004948304502203a0f5f0e1f2bdbcd04db3061d18f3af70e07f4f467cbc1b8116f267025f5360b022100c792b6e215afc5afc721a351ec413e714305cb749aae3d7fee76621313418df101010000000002000000000000000000000000000000000000000000000000000000000000000000004847304402205f7530653eea9b38699e476320ab135b74771e1c48b81a5d041e2ca84b9be7a802200ac8d1f40fb026674fe5a5edd3dea715c27baa9baca51ed45ea750ac9dc0a55e81ffffffff010100000000000000015100000000", true], ["afd9c17f8913577ec3509520bd6e5d63e9c0fd2a5f70c787993b097ba6ca9fae which has several SIGHASH_SINGLE signatures"], [[["63cfa5a09dc540bf63e53713b82d9ea3692ca97cd608c384f2aa88e51a0aac70", 0, "DUP HASH160 0x14 0xdcf72c4fd02f5a987cf9b02f2fabfcac3341a87d EQUALVERIFY CHECKSIG"], ["04e8d0fcf3846c6734477b98f0f3d4badfb78f020ee097a0be5fe347645b817d", 1, "DUP HASH160 0x14 0xdcf72c4fd02f5a987cf9b02f2fabfcac3341a87d EQUALVERIFY CHECKSIG"], ["ee1377aff5d0579909e11782e1d2f5f7b84d26537be7f5516dd4e43373091f3f", 1, "DUP HASH160 0x14 0xdcf72c4fd02f5a987cf9b02f2fabfcac3341a87d EQUALVERIFY CHECKSIG"]], "010000000370ac0a1ae588aaf284c308d67ca92c69a39e2db81337e563bf40c59da0a5cf63000000006a4730440220360d20baff382059040ba9be98947fd678fb08aab2bb0c172efa996fd8ece9b702201b4fb0de67f015c90e7ac8a193aeab486a1f587e0f54d0fb9552ef7f5ce6caec032103579ca2e6d107522f012cd00b52b9a65fb46f0c57b9b8b6e377c48f526a44741affffffff7d815b6447e35fbea097e00e028fb7dfbad4f3f0987b4734676c84f3fcd0e804010000006b483045022100c714310be1e3a9ff1c5f7cacc65c2d8e781fc3a88ceb063c6153bf950650802102200b2d0979c76e12bb480da635f192cc8dc6f905380dd4ac1ff35a4f68f462fffd032103579ca2e6d107522f012cd00b52b9a65fb46f0c57b9b8b6e377c48f526a44741affffffff3f1f097333e4d46d51f5e77b53264db8f7f5d2e18217e1099957d0f5af7713ee010000006c493046022100b663499ef73273a3788dea342717c2640ac43c5a1cf862c9e09b206fcb3f6bb8022100b09972e75972d9148f2bdd462e5cb69b57c1214b88fc55ca638676c07cfc10d8032103579ca2e6d107522f012cd00b52b9a65fb46f0c57b9b8b6e377c48f526a44741affffffff0380841e00000000001976a914bfb282c70c4191f45b5a6665cad1682f2c9cfdfb88ac80841e00000000001976a9149857cc07bed33a5cf12b9c5e0500b675d500c81188ace0fd1c00000000001976a91443c52850606c872403c0601e69fa34b26f62db4a88ac00000000", true], ["ddc454a1c0c35c188c98976b17670f69e586d9c0f3593ea879928332f0a069e7, which spends an input that pushes using a PUSHDATA1 that is negative when read as signed"], [[["c5510a5dd97a25f43175af1fe649b707b1df8e1a41489bac33a23087027a2f48", 0, "0x4c 0xae 0x606563686f2022553246736447566b58312b5a536e587574356542793066794778625456415675534a6c376a6a334878416945325364667657734f53474f36633338584d7439435c6e543249584967306a486956304f376e775236644546673d3d22203e20743b206f70656e73736c20656e63202d7061737320706173733a5b314a564d7751432d707269766b65792d6865785d202d64202d6165732d3235362d636263202d61202d696e207460 DROP DUP HASH160 0x14 0xbfd7436b6265aa9de506f8a994f881ff08cc2872 EQUALVERIFY CHECKSIG"]], "0100000001482f7a028730a233ac9b48411a8edfb107b749e61faf7531f4257ad95d0a51c5000000008b483045022100bf0bbae9bde51ad2b222e87fbf67530fbafc25c903519a1e5dcc52a32ff5844e022028c4d9ad49b006dd59974372a54291d5764be541574bb0c4dc208ec51f80b7190141049dd4aad62741dc27d5f267f7b70682eee22e7e9c1923b9c0957bdae0b96374569b460eb8d5b40d972e8c7c0ad441de3d94c4a29864b212d56050acb980b72b2bffffffff0180969800000000001976a914e336d0017a9d28de99d16472f6ca6d5a3a8ebc9988ac00000000", true], ["Correct signature order"], ["Note the input is just required to make the tester happy"], [[["b3da01dd4aae683c7aee4d5d8b52a540a508e1115f77cd7fa9a291243f501223", 0, "HASH160 0x14 0xb1ce99298d5f07364b57b1e5c9cc00be0b04a954 EQUAL"]], "01000000012312503f2491a2a97fcd775f11e108a540a5528b5d4dee7a3c68ae4add01dab300000000fdfe0000483045022100f6649b0eddfdfd4ad55426663385090d51ee86c3481bdc6b0c18ea6c0ece2c0b0220561c315b07cffa6f7dd9df96dbae9200c2dee09bf93cc35ca05e6cdf613340aa0148304502207aacee820e08b0b174e248abd8d7a34ed63b5da3abedb99934df9fddd65c05c4022100dfe87896ab5ee3df476c2655f9fbe5bd089dccbef3e4ea05b5d121169fe7f5f4014c695221031d11db38972b712a9fe1fc023577c7ae3ddb4a3004187d41c45121eecfdbb5b7210207ec36911b6ad2382860d32989c7b8728e9489d7bbc94a6b5509ef0029be128821024ea9fac06f666a4adc3fc1357b7bec1fd0bdece2b9d08579226a8ebde53058e453aeffffffff0180380100000000001976a914c9b99cddf847d10685a4fabaa0baf505f7c3dfab88ac00000000", true], ["cc60b1f899ec0a69b7c3f25ddf32c4524096a9c5b01cbd84c6d0312a0c478984, which is a fairly strange transaction which relies on OP_CHECKSIG returning 0 when checking a completely invalid sig of length 0"], [[["cbebc4da731e8995fe97f6fadcd731b36ad40e5ecb31e38e904f6e5982fa09f7", 0, "0x2102085c6600657566acc2d6382a47bc3f324008d2aa10940dd7705a48aa2a5a5e33ac7c2103f5d0fb955f95dd6be6115ce85661db412ec6a08abcbfce7da0ba8297c6cc0ec4ac7c5379a820d68df9e32a147cffa36193c6f7c43a1c8c69cda530e1c6db354bfabdcfefaf3c875379a820f531f3041d3136701ea09067c53e7159c8f9b2746a56c3d82966c54bbc553226879a5479827701200122a59a5379827701200122a59a6353798277537982778779679a68"]], "0100000001f709fa82596e4f908ee331cb5e0ed46ab331d7dcfaf697fe95891e73dac4ebcb000000008c20ca42095840735e89283fec298e62ac2ddea9b5f34a8cbb7097ad965b87568100201b1b01dc829177da4a14551d2fc96a9db00c6501edfa12f22cd9cefd335c227f483045022100a9df60536df5733dd0de6bc921fab0b3eee6426501b43a228afa2c90072eb5ca02201c78b74266fac7d1db5deff080d8a403743203f109fbcabf6d5a760bf87386d20100ffffffff01c075790000000000232103611f9a45c18f28f06f19076ad571c344c82ce8fcfe34464cf8085217a2d294a6ac00000000", true], ["Empty pubkey"], [[["229257c295e7f555421c1bfec8538dd30a4b5c37c1c8810bbe83cafa7811652c", 0, "0x00 CHECKSIG NOT"]], "01000000012c651178faca83be0b81c8c1375c4b0ad38d53c8fe1b1c4255f5e795c25792220000000049483045022100d6044562284ac76c985018fc4a90127847708c9edb280996c507b28babdc4b2a02203d74eca3f1a4d1eea7ff77b528fde6d5dc324ec2dbfdb964ba885f643b9704cd01ffffffff010100000000000000232102c2410f8891ae918cab4ffc4bb4a3b0881be67c7a1e7faa8b5acf9ab8932ec30cac00000000", true], ["Empty signature"], [[["9ca93cfd8e3806b9d9e2ba1cf64e3cc6946ee0119670b1796a09928d14ea25f7", 0, "0x21 0x028a1d66975dbdf97897e3a4aef450ebeb5b5293e4a0b4a6d3a2daaa0b2b110e02 CHECKSIG NOT"]], "0100000001f725ea148d92096a79b1709611e06e94c63c4ef61cbae2d9b906388efd3ca99c000000000100ffffffff0101000000000000002321028a1d66975dbdf97897e3a4aef450ebeb5b5293e4a0b4a6d3a2daaa0b2b110e02ac00000000", true], [[["444e00ed7840d41f20ecd9c11d3f91982326c731a02f3c05748414a4fa9e59be", 0, "1 0x00 0x21 0x02136b04758b0b6e363e7a6fbe83aaf527a153db2b060d36cc29f7f8309ba6e458 2 CHECKMULTISIG"]], "0100000001be599efaa4148474053c2fa031c7262398913f1dc1d9ec201fd44078ed004e44000000004900473044022022b29706cb2ed9ef0cb3c97b72677ca2dfd7b4160f7b4beb3ba806aa856c401502202d1e52582412eba2ed474f1f437a427640306fd3838725fab173ade7fe4eae4a01ffffffff010100000000000000232103ac4bba7e7ca3e873eea49e08132ad30c7f03640b6539e9b59903cf14fd016bbbac00000000", true], [[["e16abbe80bf30c080f63830c8dbf669deaef08957446e95940227d8c5e6db612", 0, "1 0x21 0x03905380c7013e36e6e19d305311c1b81fce6581f5ee1c86ef0627c68c9362fc9f 0x00 2 CHECKMULTISIG"]], "010000000112b66d5e8c7d224059e946749508efea9d66bf8d0c83630f080cf30be8bb6ae100000000490047304402206ffe3f14caf38ad5c1544428e99da76ffa5455675ec8d9780fac215ca17953520220779502985e194d84baa36b9bd40a0dbd981163fa191eb884ae83fc5bd1c86b1101ffffffff010100000000000000232103905380c7013e36e6e19d305311c1b81fce6581f5ee1c86ef0627c68c9362fc9fac00000000", true], [[["ebbcf4bfce13292bd791d6a65a2a858d59adbf737e387e40370d4e64cc70efb0", 0, "2 0x21 0x033bcaa0a602f0d44cc9d5637c6e515b0471db514c020883830b7cefd73af04194 0x21 0x03a88b326f8767f4f192ce252afe33c94d25ab1d24f27f159b3cb3aa691ffe1423 2 CHECKMULTISIG NOT"]], "0100000001b0ef70cc644e0d37407e387e73bfad598d852a5aa6d691d72b2913cebff4bceb000000004a00473044022068cd4851fc7f9a892ab910df7a24e616f293bcb5c5fbdfbc304a194b26b60fba022078e6da13d8cb881a22939b952c24f88b97afd06b4c47a47d7f804c9a352a6d6d0100ffffffff0101000000000000002321033bcaa0a602f0d44cc9d5637c6e515b0471db514c020883830b7cefd73af04194ac00000000", true], [[["ba4cd7ae2ad4d4d13ebfc8ab1d93a63e4a6563f25089a18bf0fc68f282aa88c1", 0, "2 0x21 0x037c615d761e71d38903609bf4f46847266edc2fb37532047d747ba47eaae5ffe1 0x21 0x02edc823cd634f2c4033d94f5755207cb6b60c4b1f1f056ad7471c47de5f2e4d50 2 CHECKMULTISIG NOT"]], "0100000001c188aa82f268fcf08ba18950f263654a3ea6931dabc8bf3ed1d4d42aaed74cba000000004b0000483045022100940378576e069aca261a6b26fb38344e4497ca6751bb10905c76bb689f4222b002204833806b014c26fd801727b792b1260003c55710f87c5adbd7a9cb57446dbc9801ffffffff0101000000000000002321037c615d761e71d38903609bf4f46847266edc2fb37532047d747ba47eaae5ffe1ac00000000", true], ["OP_CODESEPARATOR tests"], ["Test that SignatureHash() removes OP_CODESEPARATOR with FindAndDelete()"], [[["bc7fd132fcf817918334822ee6d9bd95c889099c96e07ca2c1eb2cc70db63224", 0, "CODESEPARATOR 0x21 0x038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041 CHECKSIG"]], "01000000012432b60dc72cebc1a27ce0969c0989c895bdd9e62e8234839117f8fc32d17fbc000000004a493046022100a576b52051962c25e642c0fd3d77ee6c92487048e5d90818bcf5b51abaccd7900221008204f8fb121be4ec3b24483b1f92d89b1b0548513a134e345c5442e86e8617a501ffffffff010000000000000000016a00000000", true], [[["83e194f90b6ef21fa2e3a365b63794fb5daa844bdc9b25de30899fcfe7b01047", 0, "CODESEPARATOR CODESEPARATOR 0x21 0x038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041 CHECKSIG"]], "01000000014710b0e7cf9f8930de259bdc4b84aa5dfb9437b665a3e3a21ff26e0bf994e183000000004a493046022100a166121a61b4eeb19d8f922b978ff6ab58ead8a5a5552bf9be73dc9c156873ea02210092ad9bc43ee647da4f6652c320800debcf08ec20a094a0aaf085f63ecb37a17201ffffffff010000000000000000016a00000000", true], ["Hashed data starts at the CODESEPARATOR"], [[["326882a7f22b5191f1a0cc9962ca4b878cd969cf3b3a70887aece4d801a0ba5e", 0, "0x21 0x038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041 CODESEPARATOR CHECKSIG"]], "01000000015ebaa001d8e4ec7a88703a3bcf69d98c874bca6299cca0f191512bf2a7826832000000004948304502203bf754d1c6732fbf87c5dcd81258aefd30f2060d7bd8ac4a5696f7927091dad1022100f5bcb726c4cf5ed0ed34cc13dadeedf628ae1045b7cb34421bc60b89f4cecae701ffffffff010000000000000000016a00000000", true], ["But only if execution has reached it"], [[["a955032f4d6b0c9bfe8cad8f00a8933790b9c1dc28c82e0f48e75b35da0e4944", 0, "0x21 0x038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041 CHECKSIGVERIFY CODESEPARATOR 0x21 0x038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041 CHECKSIGVERIFY CODESEPARATOR 1"]], "010000000144490eda355be7480f2ec828dcc1b9903793a8008fad8cfe9b0c6b4d2f0355a900000000924830450221009c0a27f886a1d8cb87f6f595fbc3163d28f7a81ec3c4b252ee7f3ac77fd13ffa02203caa8dfa09713c8c4d7ef575c75ed97812072405d932bd11e6a1593a98b679370148304502201e3861ef39a526406bad1e20ecad06be7375ad40ddb582c9be42d26c3a0d7b240221009d0a3985e96522e59635d19cc4448547477396ce0ef17a58e7d74c3ef464292301ffffffff010000000000000000016a00000000", true], ["CHECKSIG is legal in scriptSigs"], [[["ccf7f4053a02e653c36ac75c891b7496d0dc5ce5214f6c913d9cf8f1329ebee0", 0, "DUP HASH160 0x14 0xee5a6aa40facefb2655ac23c0c28c57c65c41f9b EQUALVERIFY CHECKSIG"]], "0100000001e0be9e32f1f89c3d916c4f21e55cdcd096741b895cc76ac353e6023a05f4f7cc00000000d86149304602210086e5f736a2c3622ebb62bd9d93d8e5d76508b98be922b97160edc3dcca6d8c47022100b23c312ac232a4473f19d2aeb95ab7bdf2b65518911a0d72d50e38b5dd31dc820121038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041ac4730440220508fa761865c8abd81244a168392876ee1d94e8ed83897066b5e2df2400dad24022043f5ee7538e87e9c6aef7ef55133d3e51da7cc522830a9c4d736977a76ef755c0121038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041ffffffff010000000000000000016a00000000", true], ["Same semantics for OP_CODESEPARATOR"], [[["10c9f0effe83e97f80f067de2b11c6a00c3088a4bce42c5ae761519af9306f3c", 1, "DUP HASH160 0x14 0xee5a6aa40facefb2655ac23c0c28c57c65c41f9b EQUALVERIFY CHECKSIG"]], "01000000013c6f30f99a5161e75a2ce4bca488300ca0c6112bde67f0807fe983feeff0c91001000000e608646561646265656675ab61493046022100ce18d384221a731c993939015e3d1bcebafb16e8c0b5b5d14097ec8177ae6f28022100bcab227af90bab33c3fe0a9abfee03ba976ee25dc6ce542526e9b2e56e14b7f10121038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041ac493046022100c3b93edcc0fd6250eb32f2dd8a0bba1754b0f6c3be8ed4100ed582f3db73eba2022100bf75b5bd2eff4d6bf2bda2e34a40fcc07d4aa3cf862ceaa77b47b81eff829f9a01ab21038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041ffffffff010000000000000000016a00000000", true], ["Signatures are removed from the script they are in by FindAndDelete() in the CHECKSIG code; even multiple instances of one signature can be removed."], [[["6056ebd549003b10cbbd915cea0d82209fe40b8617104be917a26fa92cbe3d6f", 0, "DUP HASH160 0x14 0xee5a6aa40facefb2655ac23c0c28c57c65c41f9b EQUALVERIFY CHECKSIG"]], "01000000016f3dbe2ca96fa217e94b1017860be49f20820dea5c91bdcb103b0049d5eb566000000000fd1d0147304402203989ac8f9ad36b5d0919d97fa0a7f70c5272abee3b14477dc646288a8b976df5022027d19da84a066af9053ad3d1d7459d171b7e3a80bc6c4ef7a330677a6be548140147304402203989ac8f9ad36b5d0919d97fa0a7f70c5272abee3b14477dc646288a8b976df5022027d19da84a066af9053ad3d1d7459d171b7e3a80bc6c4ef7a330677a6be548140121038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041ac47304402203757e937ba807e4a5da8534c17f9d121176056406a6465054bdd260457515c1a02200f02eccf1bec0f3a0d65df37889143c2e88ab7acec61a7b6f5aa264139141a2b0121038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041ffffffff010000000000000000016a00000000", true], ["That also includes ahead of the opcode being executed."], [[["5a6b0021a6042a686b6b94abc36b387bef9109847774e8b1e51eb8cc55c53921", 1, "DUP HASH160 0x14 0xee5a6aa40facefb2655ac23c0c28c57c65c41f9b EQUALVERIFY CHECKSIG"]], "01000000012139c555ccb81ee5b1e87477840991ef7b386bc3ab946b6b682a04a621006b5a01000000fdb40148304502201723e692e5f409a7151db386291b63524c5eb2030df652b1f53022fd8207349f022100b90d9bbf2f3366ce176e5e780a00433da67d9e5c79312c6388312a296a5800390148304502201723e692e5f409a7151db386291b63524c5eb2030df652b1f53022fd8207349f022100b90d9bbf2f3366ce176e5e780a00433da67d9e5c79312c6388312a296a5800390121038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f2204148304502201723e692e5f409a7151db386291b63524c5eb2030df652b1f53022fd8207349f022100b90d9bbf2f3366ce176e5e780a00433da67d9e5c79312c6388312a296a5800390175ac4830450220646b72c35beeec51f4d5bc1cbae01863825750d7f490864af354e6ea4f625e9c022100f04b98432df3a9641719dbced53393022e7249fb59db993af1118539830aab870148304502201723e692e5f409a7151db386291b63524c5eb2030df652b1f53022fd8207349f022100b90d9bbf2f3366ce176e5e780a00433da67d9e5c79312c6388312a296a580039017521038479a0fa998cd35259a2ef0a7a5c68662c1474f88ccb6d08a7677bbec7f22041ffffffff010000000000000000016a00000000", true], ["Finally CHECKMULTISIG removes all signatures prior to hashing the script containing those signatures. In conjunction with the SIGHASH_SINGLE bug this lets us test whether or not FindAndDelete() is actually present in scriptPubKey/redeemScript evaluation by including a signature of the digest 0x01 We can compute in advance for our pubkey, embed it it in the scriptPubKey, and then also using a normal SIGHASH_ALL signature. If FindAndDelete() wasn't run, the 'bugged' signature would still be in the hashed script, and the normal signature would fail."], ["Here's an example on mainnet within a P2SH redeemScript. Remarkably it's a standard transaction in <0.9"], [[["b5b598de91787439afd5938116654e0b16b7a0d0f82742ba37564219c5afcbf9", 0, "DUP HASH160 0x14 0xf6f365c40f0739b61de827a44751e5e99032ed8f EQUALVERIFY CHECKSIG"], ["ab9805c6d57d7070d9a42c5176e47bb705023e6b67249fb6760880548298e742", 0, "HASH160 0x14 0xd8dacdadb7462ae15cd906f1878706d0da8660e6 EQUAL"]], "0100000002f9cbafc519425637ba4227f8d0a0b7160b4e65168193d5af39747891de98b5b5000000006b4830450221008dd619c563e527c47d9bd53534a770b102e40faa87f61433580e04e271ef2f960220029886434e18122b53d5decd25f1f4acb2480659fea20aabd856987ba3c3907e0121022b78b756e2258af13779c1a1f37ea6800259716ca4b7f0b87610e0bf3ab52a01ffffffff42e7988254800876b69f24676b3e0205b77be476512ca4d970707dd5c60598ab00000000fd260100483045022015bd0139bcccf990a6af6ec5c1c52ed8222e03a0d51c334df139968525d2fcd20221009f9efe325476eb64c3958e4713e9eefe49bf1d820ed58d2112721b134e2a1a53034930460221008431bdfa72bc67f9d41fe72e94c88fb8f359ffa30b33c72c121c5a877d922e1002210089ef5fc22dd8bfc6bf9ffdb01a9862d27687d424d1fefbab9e9c7176844a187a014c9052483045022015bd0139bcccf990a6af6ec5c1c52ed8222e03a0d51c334df139968525d2fcd20221009f9efe325476eb64c3958e4713e9eefe49bf1d820ed58d2112721b134e2a1a5303210378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71210378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c7153aeffffffff01a08601000000000017a914d8dacdadb7462ae15cd906f1878706d0da8660e68700000000", true], ["Same idea, but with bare CHECKMULTISIG"], [[["ceafe58e0f6e7d67c0409fbbf673c84c166e3c5d3c24af58f7175b18df3bb3db", 0, "DUP HASH160 0x14 0xf6f365c40f0739b61de827a44751e5e99032ed8f EQUALVERIFY CHECKSIG"], ["ceafe58e0f6e7d67c0409fbbf673c84c166e3c5d3c24af58f7175b18df3bb3db", 1, "2 0x48 0x3045022015bd0139bcccf990a6af6ec5c1c52ed8222e03a0d51c334df139968525d2fcd20221009f9efe325476eb64c3958e4713e9eefe49bf1d820ed58d2112721b134e2a1a5303 0x21 0x0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71 0x21 0x0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71 3 CHECKMULTISIG"]], "0100000002dbb33bdf185b17f758af243c5d3c6e164cc873f6bb9f40c0677d6e0f8ee5afce000000006b4830450221009627444320dc5ef8d7f68f35010b4c050a6ed0d96b67a84db99fda9c9de58b1e02203e4b4aaa019e012e65d69b487fdf8719df72f488fa91506a80c49a33929f1fd50121022b78b756e2258af13779c1a1f37ea6800259716ca4b7f0b87610e0bf3ab52a01ffffffffdbb33bdf185b17f758af243c5d3c6e164cc873f6bb9f40c0677d6e0f8ee5afce010000009300483045022015bd0139bcccf990a6af6ec5c1c52ed8222e03a0d51c334df139968525d2fcd20221009f9efe325476eb64c3958e4713e9eefe49bf1d820ed58d2112721b134e2a1a5303483045022015bd0139bcccf990a6af6ec5c1c52ed8222e03a0d51c334df139968525d2fcd20221009f9efe325476eb64c3958e4713e9eefe49bf1d820ed58d2112721b134e2a1a5303ffffffff01a0860100000000001976a9149bc0bbdd3024da4d0c38ed1aecf5c68dd1d3fa1288ac00000000", true], ["Make diffs cleaner by leaving a comment here without comma at the end"] ] python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/fakebitcoinproxy.py000066400000000000000000000255341430270607500276110ustar00rootroot00000000000000""" `FakeBitcoinProxy` allows for unit testing of code that normally uses bitcoin RPC without requiring a running bitcoin node. `FakeBitcoinProxy` has an interface similar to `bitcoin.rpc.Proxy`, but does not connect to a local bitcoin RPC node. Hence, `FakeBitcoinProxy` is similar to a mock for the RPC tests. `FakeBitcoinProxy` does _not_ implement a full bitcoin RPC node. Instead, it currently implements only a subset of the available RPC commands. Test setup is responsible for populating a `FakeBitcoinProxy` object with reasonable mock data. :author: Bryan Bishop """ import random import hashlib from bitcoin.core import ( # bytes to hex (see x) b2x, # convert hex string to bytes (see b2x) x, # convert little-endian hex string to bytes (see b2lx) lx, # convert bytes to little-endian hex string (see lx) b2lx, # number of satoshis per bitcoin COIN, # a type for a transaction that isn't finished building CMutableTransaction, CMutableTxIn, CMutableTxOut, COutPoint, CTxIn, ) from bitcoin.wallet import ( # bitcoin address initialized from base58-encoded string CBitcoinAddress, # base58-encoded secret key CBitcoinSecret, # has a nifty function from_pubkey P2PKHBitcoinAddress, ) def make_address_from_passphrase(passphrase, compressed=True, as_str=True): """ Create a Bitcoin address from a passphrase. The passphrase is hashed and then used as the secret bytes to construct the CBitcoinSecret. """ if not isinstance(passphrase, bytes): passphrase = bytes(passphrase, "utf-8") passphrasehash = hashlib.sha256(passphrase).digest() private_key = CBitcoinSecret.from_secret_bytes(passphrasehash, compressed=compressed) address = P2PKHBitcoinAddress.from_pubkey(private_key.pub) if as_str: return str(address) else: return address def make_txout(amount=None, address=None, counter=None): """ Make a CTxOut object based on the parameters. Otherwise randomly generate a CTxOut to represent a transaction output. :param amount: amount in satoshis """ passphrase_template = "correct horse battery staple txout {counter}" if not counter: counter = random.randrange(0, 2**50) if not address: passphrase = passphrase_template.format(counter=counter) address = make_address_from_passphrase(bytes(passphrase, "utf-8")) if not amount: maxsatoshis = (21 * 1000 * 1000) * (100 * 1000 * 1000) # 21 million BTC * 100 million satoshi per BTC amount = random.randrange(0, maxsatoshis) # between 0 satoshi and 21 million BTC txout = CMutableTxOut(amount, CBitcoinAddress(address).to_scriptPubKey()) return txout def make_blocks_from_blockhashes(blockhashes): """ Create some block data suitable for FakeBitcoinProxy to consume during instantiation. """ blocks = [] for (height, blockhash) in enumerate(blockhashes): block = {"hash": blockhash, "height": height, "tx": []} if height != 0: block["previousblockhash"] = previousblockhash blocks.append(block) previousblockhash = blockhash return blocks def make_rpc_batch_request_entry(rpc_name, params): """ Construct an entry for the list of commands that will be passed as a batch (for `_batch`). """ return { "id": "50", "version": "1.1", "method": rpc_name, "params": params, } class FakeBitcoinProxyException(Exception): """ Incorrect usage of fake proxy. """ pass class FakeBitcoinProxy(object): """ This is an alternative to using `bitcoin.rpc.Proxy` in tests. This class can store a number of blocks and transactions, which can then be retrieved by calling various "RPC" methods. """ def __init__(self, blocks=None, transactions=None, getnewaddress_offset=None, getnewaddress_passphrase_template="getnewaddress passphrase template {}", num_fundrawtransaction_inputs=5): """ :param getnewaddress_offset: a number to start using and incrementing in template used by getnewaddress. :type getnewaddress_offset: int :param int num_fundrawtransaction_inputs: number of inputs to create during fundrawtransaction. """ self.blocks = blocks or {} self.transactions = transactions or {} if getnewaddress_offset == None: self._getnewaddress_offset = 0 else: self._getnewaddress_offset = getnewaddress_offset self._getnewaddress_passphrase_template = getnewaddress_passphrase_template self._num_fundrawtransaction_inputs = num_fundrawtransaction_inputs self.populate_blocks_with_blockheights() def _call(self, rpc_method_name, *args, **kwargs): """ This represents a "raw" RPC call, which has output that python-bitcoinlib does not parse. """ method = getattr(self, rpc_method_name) return method(*args, **kwargs) def populate_blocks_with_blockheights(self): """ Helper method to correctly apply "height" on all blocks. """ for (height, block) in enumerate(self.blocks): block["height"] = height def getblock(self, blockhash, *args, **kwargs): """ :param blockhash: hash of the block to retrieve data for :raise IndexError: invalid blockhash """ # Note that the actual "getblock" bitcoind RPC call from # python-bitcoinlib returns a CBlock object, not a dictionary. if isinstance(blockhash, bytes): blockhash = b2lx(blockhash) for block in self.blocks: if block["hash"] == blockhash: return block raise IndexError("no block found for blockhash {}".format(blockhash)) def getblockhash(self, blockheight): """ Get block by blockheight. :type blockheight: int :rtype: dict """ for block in self.blocks: if block["height"] == int(blockheight): return block["hash"] def getblockcount(self): """ Return the total number of blocks. When there is only one block in the blockchain, this function will return zero. :rtype: int """ return len(self.blocks) - 1 def getrawtransaction(self, txid, *args, **kwargs): """ Get parsed transaction. :type txid: bytes or str :rtype: dict """ if isinstance(txid, bytes): txid = b2lx(txid) return self.transactions[txid] def getnewaddress(self): """ Construct a new address based on a passphrase template. As more addresses are generated, the template value goes up. """ passphrase = self._getnewaddress_passphrase_template.format(self._getnewaddress_offset) address = make_address_from_passphrase(bytes(passphrase, "utf-8")) self._getnewaddress_offset += 1 return CBitcoinAddress(address) def importaddress(self, *args, **kwargs): """ Completely unrealistic fake version of importaddress. """ return True # This was implemented a long time ago and it's possible that this does not # match the current behavior of fundrawtransaction. def fundrawtransaction(self, given_transaction, *args, **kwargs): """ Make up some inputs for the given transaction. """ # just use any txid here vintxid = lx("99264749804159db1e342a0c8aa3279f6ef4031872051a1e52fb302e51061bef") if isinstance(given_transaction, str): given_bytes = x(given_transaction) elif isinstance(given_transaction, CMutableTransaction): given_bytes = given_transaction.serialize() else: raise FakeBitcoinProxyException("Wrong type passed to fundrawtransaction.") # this is also a clever way to not cause a side-effect in this function transaction = CMutableTransaction.deserialize(given_bytes) for vout_counter in range(0, self._num_fundrawtransaction_inputs): txin = CMutableTxIn(COutPoint(vintxid, vout_counter)) transaction.vin.append(txin) # also allocate a single output (for change) txout = make_txout() transaction.vout.append(txout) transaction_hex = b2x(transaction.serialize()) return {"hex": transaction_hex, "fee": 5000000} def signrawtransaction(self, given_transaction): """ This method does not actually sign the transaction, but it does return a transaction based on the given transaction. """ if isinstance(given_transaction, str): given_bytes = x(given_transaction) elif isinstance(given_transaction, CMutableTransaction): given_bytes = given_transaction.serialize() else: raise FakeBitcoinProxyException("Wrong type passed to signrawtransaction.") transaction = CMutableTransaction.deserialize(given_bytes) transaction_hex = b2x(transaction.serialize()) return {"hex": transaction_hex} def sendrawtransaction(self, given_transaction): """ Pretend to broadcast and relay the transaction. Return the txid of the given transaction. """ if isinstance(given_transaction, str): given_bytes = x(given_transaction) elif isinstance(given_transaction, CMutableTransaction): given_bytes = given_transaction.serialize() else: raise FakeBitcoinProxyException("Wrong type passed to sendrawtransaction.") transaction = CMutableTransaction.deserialize(given_bytes) return b2lx(transaction.GetHash()) def _batch(self, batch_request_entries): """ Process a bunch of requests all at once. This mimics the _batch RPC feature found in python-bitcoinlib and bitcoind RPC. """ necessary_keys = ["id", "version", "method", "params"] results = [] for (idx, request) in enumerate(batch_request_entries): error = None result = None # assert presence of important details for necessary_key in necessary_keys: if not necessary_key in request.keys(): raise FakeBitcoinProxyException("Missing necessary key {} for _batch request number {}".format(necessary_key, idx)) if isinstance(request["params"], list): method = getattr(self, request["method"]) result = method(*request["params"]) else: # matches error message received through python-bitcoinrpc error = {"message": "Params must be an array", "code": -32600} results.append({ "error": error, "id": request["id"], "result": result, }) return results python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_base58.py000066400000000000000000000037231430270607500263530ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import json import os import unittest from binascii import unhexlify from bitcoin.base58 import * def load_test_vectors(name): with open(os.path.dirname(__file__) + '/data/' + name, 'r') as fd: for testcase in json.load(fd): yield testcase class Test_base58(unittest.TestCase): def test_encode_decode(self): for exp_bin, exp_base58 in load_test_vectors('base58_encode_decode.json'): exp_bin = unhexlify(exp_bin.encode('utf8')) act_base58 = encode(exp_bin) act_bin = decode(exp_base58) self.assertEqual(act_base58, exp_base58) self.assertEqual(act_bin, exp_bin) class Test_CBase58Data(unittest.TestCase): def test_from_data(self): b = CBase58Data.from_bytes(b"b\xe9\x07\xb1\\\xbf'\xd5BS\x99\xeb\xf6\xf0\xfbP\xeb\xb8\x8f\x18", 0) self.assertEqual(b.nVersion, 0) self.assertEqual(str(b), '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa') b = CBase58Data.from_bytes(b'Bf\xfco,(a\xd7\xfe"\x9b\'\x9ay\x80:\xfc\xa7\xba4', 196) self.assertEqual(b.nVersion, 196) self.assertEqual(str(b), '2MyJKxYR2zNZZsZ39SgkCXWCfQtXKhnWSWq') def test_invalid_base58_exception(self): invalids = ('', # missing everything '#', # invalid character '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNb', # invalid checksum ) for invalid in invalids: msg = '%r should have raised InvalidBase58Error but did not' % invalid with self.assertRaises(Base58Error, msg=msg): CBase58Data(invalid) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_bech32.py000066400000000000000000000044501430270607500263300ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import json import os import unittest from binascii import unhexlify from bitcoin.core.script import CScript, OP_0, OP_1, OP_16 from bitcoin.bech32 import * from bitcoin.segwit_addr import encode, decode def load_test_vectors(name): with open(os.path.dirname(__file__) + '/data/' + name, 'r') as fd: for testcase in json.load(fd): yield testcase def to_scriptPubKey(witver, witprog): """Decoded bech32 address to script""" return CScript([witver]) + CScript(bytes(witprog)) class Test_bech32(unittest.TestCase): def op_decode(self, witver): """OP encoding to int""" if witver == OP_0: return 0 if OP_1 <= witver <= OP_16: return witver - OP_1 + 1 self.fail('Wrong witver: %d' % witver) def test_encode_decode(self): for exp_bin, exp_bech32 in load_test_vectors('bech32_encode_decode.json'): exp_bin = unhexlify(exp_bin.encode('utf8')) witver = self.op_decode(exp_bin[0]) hrp = exp_bech32[:exp_bech32.rindex('1')].lower() self.assertEqual(exp_bin[1], len(exp_bin[2:])) act_bech32 = encode(hrp, witver, exp_bin[2:]) act_bin = decode(hrp, exp_bech32) self.assertEqual(act_bech32.lower(), exp_bech32.lower()) self.assertEqual(to_scriptPubKey(*act_bin), bytes(exp_bin)) class Test_CBech32Data(unittest.TestCase): def test_from_data(self): b = CBech32Data.from_bytes(0, unhexlify('751e76e8199196d454941c45d1b3a323f1433bd6')) self.assertEqual(b.witver, 0) self.assertEqual(str(b).upper(), 'BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4') def test_invalid_bech32_exception(self): for invalid, _ in load_test_vectors("bech32_invalid.json"): msg = '%r should have raised Bech32Error but did not' % invalid with self.assertRaises(Bech32Error, msg=msg): CBech32Data(invalid) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_bloom.py000066400000000000000000000073321430270607500263740ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest import bitcoin.core from bitcoin.core import x from bitcoin.bloom import * class Test_MurmurHash3(unittest.TestCase): def test(self): def T(expected, seed, data): self.assertEqual(MurmurHash3(seed, x(data)), expected) T(0x00000000, 0x00000000, "") T(0x6a396f08, 0xFBA4C795, "") T(0x81f16f39, 0xffffffff, "") T(0x514e28b7, 0x00000000, "00") T(0xea3f0b17, 0xFBA4C795, "00") T(0xfd6cf10d, 0x00000000, "ff") T(0x16c6b7ab, 0x00000000, "0011") T(0x8eb51c3d, 0x00000000, "001122") T(0xb4471bf8, 0x00000000, "00112233") T(0xe2301fa8, 0x00000000, "0011223344") T(0xfc2e4a15, 0x00000000, "001122334455") T(0xb074502c, 0x00000000, "00112233445566") T(0x8034d2a0, 0x00000000, "0011223344556677") T(0xb4698def, 0x00000000, "001122334455667788") class Test_CBloomFilter(unittest.TestCase): def test_create_insert_serialize(self): filter = CBloomFilter(3, 0.01, 0, CBloomFilter.UPDATE_ALL) def T(elem): """Filter contains elem""" elem = x(elem) filter.insert(elem) self.assertTrue(filter.contains(elem)) def F(elem): """Filter does not contain elem""" elem = x(elem) self.assertFalse(filter.contains(elem)) T('99108ad8ed9bb6274d3980bab5a85c048f0950c8') F('19108ad8ed9bb6274d3980bab5a85c048f0950c8') T('b5a2c786d9ef4658287ced5914b37a1b4aa32eee') T('b9300670b4c5366e95b2699e8b18bc75e5f729c5') self.assertEqual(filter.serialize(), x('03614e9b050000000000000001')) deserialized = CBloomFilter.deserialize(x('03614e9b050000000000000001')) self.assertTrue(deserialized.contains(x('99108ad8ed9bb6274d3980bab5a85c048f0950c8'))) self.assertFalse(deserialized.contains(x('19108ad8ed9bb6274d3980bab5a85c048f0950c8'))) self.assertTrue(deserialized.contains(x('b5a2c786d9ef4658287ced5914b37a1b4aa32eee'))) self.assertTrue(deserialized.contains(x('b9300670b4c5366e95b2699e8b18bc75e5f729c5'))) def test_create_insert_serialize_with_tweak(self): # Same test as bloom_create_insert_serialize, but we add a nTweak of 100 filter = CBloomFilter(3, 0.01, 2147483649, CBloomFilter.UPDATE_ALL) def T(elem): """Filter contains elem""" elem = x(elem) filter.insert(elem) self.assertTrue(filter.contains(elem)) def F(elem): """Filter does not contain elem""" elem = x(elem) self.assertFalse(filter.contains(elem)) T('99108ad8ed9bb6274d3980bab5a85c048f0950c8') F('19108ad8ed9bb6274d3980bab5a85c048f0950c8') T('b5a2c786d9ef4658287ced5914b37a1b4aa32eee') T('b9300670b4c5366e95b2699e8b18bc75e5f729c5') self.assertEqual(filter.serialize(), x('03ce4299050000000100008001')) def test_bloom_create_insert_key(self): filter = CBloomFilter(2, 0.001, 0, CBloomFilter.UPDATE_ALL) pubkey = x('045B81F0017E2091E2EDCD5EECF10D5BDD120A5514CB3EE65B8447EC18BFC4575C6D5BF415E54E03B1067934A0F0BA76B01C6B9AB227142EE1D543764B69D901E0') pubkeyhash = bitcoin.core.Hash160(pubkey) filter.insert(pubkey) filter.insert(pubkeyhash) self.assertEqual(filter.serialize(), x('038fc16b080000000000000001')) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_checkblock.py000066400000000000000000000041151430270607500273500ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import json import unittest import os from bitcoin.core import * def load_test_vectors(name): with open(os.path.dirname(__file__) + '/data/' + name, 'r') as fd: for test_case in json.load(fd): # Comments designated by single length strings if len(test_case) == 1: continue assert len(test_case) == 5 (comment, fHeader, fCheckPoW, cur_time, serialized_blk) = test_case blk = None if fHeader: blk = CBlockHeader.deserialize(x(serialized_blk)) else: blk = CBlock.deserialize(x(serialized_blk)) yield (comment, fHeader, fCheckPoW, cur_time, blk) class Test_CheckBlock(unittest.TestCase): def test_checkblock_valid(self): for comment, fHeader, fCheckPoW, cur_time, blk in load_test_vectors('checkblock_valid.json'): try: if fHeader: CheckBlockHeader(blk, fCheckPoW=fCheckPoW, cur_time=cur_time) else: CheckBlock(blk, fCheckPoW=fCheckPoW, cur_time=cur_time) except ValidationError as err: self.fail('Failed "%s" with error %r' % (comment, err)) def test_checkblock_invalid(self): for comment, fHeader, fCheckPoW, cur_time, blk in load_test_vectors('checkblock_invalid.json'): try: if fHeader: CheckBlockHeader(blk, fCheckPoW=fCheckPoW, cur_time=cur_time) else: CheckBlock(blk, fCheckPoW=fCheckPoW, cur_time=cur_time) except ValidationError as err: continue self.fail('Invalid block "%s" passed checks' % comment) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_core.py000066400000000000000000000273461430270607500262230ustar00rootroot00000000000000# Copyright (C) 2013-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest from bitcoin.core import * class Test_str_value(unittest.TestCase): def test(self): def T(value, expected): actual = str_money_value(value) self.assertEqual(actual, expected) T( 0, '0.0') T( 1, '0.00000001') T( 10, '0.0000001') T( 12345678, '0.12345678') T( 10000000, '0.1') T( 100000000, '1.0') T(1000000000, '10.0') T(1010000000, '10.1') T(1001000000, '10.01') T(1012345678, '10.12345678') class Test_Money(unittest.TestCase): def test_MoneyRange(self): self.assertFalse(MoneyRange(-1)) self.assertTrue(MoneyRange(0)) self.assertTrue(MoneyRange(100000)) self.assertTrue(MoneyRange(21000000 * COIN)) # Maximum money on Bitcoin network self.assertFalse(MoneyRange(21000001 * COIN)) def test_MoneyRangeCustomParams(self): highMaxParamsType = type(str('CoreHighMainParams'), (CoreMainParams,object), {'MAX_MONEY': 22000000 * COIN }) highMaxParams = highMaxParamsType() self.assertTrue(MoneyRange(21000001 * COIN, highMaxParams)) self.assertTrue(MoneyRange(22000000 * COIN, highMaxParams)) self.assertFalse(MoneyRange(22000001 * COIN, highMaxParams)) class Test_CBlockHeader(unittest.TestCase): def test_serialization(self): genesis = CBlockHeader(nVersion=1, hashPrevBlock=lx('0000000000000000000000000000000000000000000000000000000000000000'), hashMerkleRoot=lx('4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b'), nTime=1231006505, nBits=486604799, nNonce=2083236893) serialized = genesis.serialize() self.assertEqual(Hash(serialized), lx('000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f')) genesis2 = CBlockHeader.deserialize(serialized) self.assertEqual(genesis, genesis2) def test_GetHash(self): genesis = CBlockHeader(nVersion=1, hashPrevBlock=lx('0000000000000000000000000000000000000000000000000000000000000000'), hashMerkleRoot=lx('4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b'), nTime=1231006505, nBits=486604799, nNonce=2083236893) self.assertEqual(genesis.GetHash(), lx('000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f')) def test_calc_difficulty(self): def T(nbits, expected): actual = CBlockHeader.calc_difficulty(nbits) actual = round(actual, 3) self.assertEqual(actual, expected) T(486604799, 1.000) # block 0 T(486594666, 1.183) # block 33333 T(469809688, 352.161) # block 74000 T(453179945, 22012.381) # block 105000 T(436527338, 3438908.960) # block 210000 T(426957810, 37392766.136) # block 250000 class Test_CBlock(unittest.TestCase): def test_serialization(self): initial_serialized = x('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000') genesis = CBlock.deserialize(initial_serialized) serialized = genesis.serialize() self.assertEqual(Hash(serialized[0:80]), lx('000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f')) self.assertEqual(serialized, initial_serialized) def test_GetHash(self): genesis = CBlock.deserialize(x('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000')) self.assertEqual(genesis.GetHash(), lx('000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f')) def test_calc_merkle_root_of_empty_block(self): """CBlock.calc_merkle_root() fails if vtx empty""" block = CBlock() with self.assertRaises(ValueError): block.calc_merkle_root() def test_calc_merkle_root(self): # genesis block = CBlock.deserialize(x('0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4a29ab5f49ffff001d1dac2b7c0101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000')) self.assertEqual(block.calc_merkle_root(), lx('4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b')) self.assertEqual(block.vMerkleTree, (lx('4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b'),)) # 170 two transactions block = CBlock.deserialize(x('0100000055bd840a78798ad0da853f68974f3d183e2bd1db6a842c1feecf222a00000000ff104ccb05421ab93e63f8c3ce5c2c2e9dbb37de2764b3a3175c8166562cac7d51b96a49ffff001d283e9e700201000000010000000000000000000000000000000000000000000000000000000000000000ffffffff0704ffff001d0102ffffffff0100f2052a01000000434104d46c4968bde02899d2aa0963367c7a6ce34eec332b32e42e5f3407e052d64ac625da6f0718e7b302140434bd725706957c092db53805b821a85b23a7ac61725bac000000000100000001c997a5e56e104102fa209c6a852dd90660a20b2d9c352423edce25857fcd3704000000004847304402204e45e16932b8af514961a1d3a1a25fdf3f4f7732e9d624c6c61548ab5fb8cd410220181522ec8eca07de4860a4acdd12909d831cc56cbbac4622082221a8768d1d0901ffffffff0200ca9a3b00000000434104ae1a62fe09c5f51b13905f07f06b99a2f7159b2225f374cd378d71302fa28414e7aab37397f554a7df5f142c21c1b7303b8a0626f1baded5c72a704f7e6cd84cac00286bee0000000043410411db93e1dcdb8a016b49840f8c53bc1eb68a382e97b1482ecad7b148a6909a5cb2e0eaddfb84ccf9744464f82e160bfa9b8b64f9d4c03f999b8643f656b412a3ac00000000')) self.assertEqual(block.calc_merkle_root(), lx('7dac2c5666815c17a3b36427de37bb9d2e2c5ccec3f8633eb91a4205cb4c10ff')) # 99960 three transactions block = CBlock.deserialize(x('01000000e78b20013e6e9a21b6366ead5d866b2f9dc00664508b90f24da8000000000000f94b61259c7e9af3455b277275800d0d6a58b929eedf9e0153a6ef2278a5d53408d11a4d4c86041b0fbf10b00301000000010000000000000000000000000000000000000000000000000000000000000000ffffffff07044c86041b0119ffffffff0100f2052a0100000043410427e729f9cb5564abf2a1ccda596c636b77bd4d9d91f657d4738f3c70fce8ac4e12b1c782905554d9ff2c2e050fdfe3ff93c91c5817e617877d51f450b528c9e4ac000000000100000001e853c9e0c133547fd9e162b1d3860dd0f27d5b9b8a7430d28896c00fbb3f1bc7000000008c49304602210095bcd54ebd0caa7cee75f0f89de472a765e6ef4b98c5fd4b32c7f9d4905db9ae022100ebd3f668e3a1a36d56e30184c27531dbb9fc136c84b1282be562064d86997d1e014104727eb4fdcc90658cd26abe7dcb0ae7297810b15b9e27c32bcf8e3edd934901968806dc18b1276d7273cc4c223feee0070361ed947888a3cef422bebfede96e08ffffffff020065cd1d000000001976a91468c6c2b3c0bc4a8eeb10d16a300d627a31a3b58588ac0008af2f000000001976a9141d87f0a54a1d704ffc70eae83b025698bc0fdcfc88ac00000000010000000125f582f1d37b6713b14b85665a2daea4f464f5ed1c3ab3d4dcf152fb61414b9e000000008a473044022066ec12ced31659e1bf961b542b58bba76ba8f2a1e8f36d5f60be0601598eac21022047ce33685a63283a4c3ebc390261191f215999b2f7d8e1504b8af39aae4a2881014104c5e1d713d10fe59cc48f60701a3efcac418969c22e9c6cf57440f71e44dc82837af5351bf3e1d898f06aa5c792bf0251a39902311d1d27c16847b1b414494f35ffffffff02404b4c00000000001976a91466a3b2e43cfa5c6d9b2f0095f7be5a5cb608478c88ac80b8dc3c030000001976a9146df5ed8cee34df5c05c90406761a11ed143c202d88ac00000000')) self.assertEqual(block.calc_merkle_root(), lx('34d5a57822efa653019edfee29b9586a0d0d807572275b45f39a7e9c25614bf9')) # 99993 four transactions block = CBlock.deserialize(x('01000000acda3db591d5c2c63e8c09e7523a5b0581707ef3e3520d6ca180000000000000701179cb9a9e0fe709cc96261b6b943b31362b61dacba94b03f9b71a06cc2eff7d1c1b4d4c86041b75962f880401000000010000000000000000000000000000000000000000000000000000000000000000ffffffff07044c86041b0152ffffffff014034152a01000000434104216220ab283b5e2871c332de670d163fb1b7e509fd67db77997c5568e7c25afd988f19cd5cc5aec6430866ec64b5214826b28e0f7a86458073ff933994b47a5cac0000000001000000042a40ae58b06c3a61ae55dbee05cab546e80c508f71f24ef0cdc9749dac91ea5f000000004a49304602210089c685b37903c4aa62d984929afeaca554d1641f9a668398cd228fb54588f06b0221008a5cfbc5b0a38ba78c4f4341e53272b9cd0e377b2fb740106009b8d7fa693f0b01ffffffff7b999491e30af112b11105cb053bc3633a8a87f44740eb158849a76891ff228b00000000494830450221009a4aa8663ff4017063d2020519f2eade5b4e3e30be69bf9a62b4e6472d1747b2022021ee3b3090b8ce439dbf08a5df31e2dc23d68073ebda45dc573e8a4f74f5cdfc01ffffffffdea82ec2f9e88e0241faa676c13d093030b17c479770c6cc83239436a4327d49000000004a493046022100c29d9de71a34707c52578e355fa0fdc2bb69ce0a957e6b591658a02b1e039d69022100f82c8af79c166a822d305f0832fb800786d831aea419069b3aed97a6edf8f02101fffffffff3e7987da9981c2ae099f97a551783e1b21669ba0bf3aca8fe12896add91a11a0000000049483045022100e332c81781b281a3b35cf75a5a204a2be451746dad8147831255291ebac2604d02205f889a2935270d1bf1ef47db773d68c4d5c6a51bb51f082d3e1c491de63c345601ffffffff0100c817a8040000001976a91420420e56079150b50fb0617dce4c374bd61eccea88ac00000000010000000265a7293b2d69ba51d554cd32ac7586f7fbeaeea06835f26e03a2feab6aec375f000000004a493046022100922361eaafe316003087d355dd3c0ef3d9f44edae661c212a28a91e020408008022100c9b9c84d53d82c0ba9208f695c79eb42a453faea4d19706a8440e1d05e6cff7501fffffffff6971f00725d17c1c531088144b45ed795a307a22d51ca377c6f7f93675bb03a000000008b483045022100d060f2b2f4122edac61a25ea06396fe9135affdabc66d350b5ae1813bc6bf3f302205d8363deef2101fc9f3d528a8b3907e9d29c40772e587dcea12838c574cb80f801410449fce4a25c972a43a6bc67456407a0d4ced782d4cf8c0a35a130d5f65f0561e9f35198349a7c0b4ec79a15fead66bd7642f17cc8c40c5df95f15ac7190c76442ffffffff0200f2052a010000001976a914c3f537bc307c7eda43d86b55695e46047b770ea388ac00cf7b05000000001976a91407bef290008c089a60321b21b1df2d7f2202f40388ac0000000001000000014ab7418ecda2b2531eef0145d4644a4c82a7da1edd285d1aab1ec0595ac06b69000000008c493046022100a796490f89e0ef0326e8460edebff9161da19c36e00c7408608135f72ef0e03e0221009e01ef7bc17cddce8dfda1f1a6d3805c51f9ab2f8f2145793d8e85e0dd6e55300141043e6d26812f24a5a9485c9d40b8712215f0c3a37b0334d76b2c24fcafa587ae5258853b6f49ceeb29cd13ebb76aa79099fad84f516bbba47bd170576b121052f1ffffffff0200a24a04000000001976a9143542e17b6229a25d5b76909f9d28dd6ed9295b2088ac003fab01000000001976a9149cea2b6e3e64ad982c99ebba56a882b9e8a816fe88ac00000000')) self.assertEqual(block.calc_merkle_root(), lx('ff2ecc061ab7f9034ba9cbda612b36313b946b1b2696cc09e70f9e9acb791170')) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_fakebitcoinproxy.py000066400000000000000000000361461430270607500306510ustar00rootroot00000000000000""" :author: Bryan Bishop """ import unittest import random from copy import copy from bitcoin.core import ( # bytes to hex (see x) b2x, # convert hex string to bytes (see b2x) x, # convert little-endian hex string to bytes (see b2lx) lx, # convert bytes to little-endian hex string (see lx) b2lx, # number of satoshis per bitcoin COIN, # a type for a transaction that isn't finished building CMutableTransaction, CMutableTxIn, CMutableTxOut, COutPoint, CTxIn, ) from bitcoin.wallet import ( # has a nifty function from_pubkey P2PKHBitcoinAddress, ) from bitcoin.tests.fakebitcoinproxy import ( FakeBitcoinProxy, make_txout, make_blocks_from_blockhashes, make_rpc_batch_request_entry, # TODO: import and test with FakeBitcoinProxyException ) class FakeBitcoinProxyTestCase(unittest.TestCase): def test_constructor(self): FakeBitcoinProxy() def test_constructor_accepts_blocks(self): blockhash0 = "blockhash0" blockhash1 = "blockhash1" blocks = [ {"hash": blockhash0}, {"hash": blockhash1}, ] proxy = FakeBitcoinProxy(blocks=blocks) self.assertNotEqual(proxy.blocks, {}) self.assertTrue(proxy.blocks is blocks) def test_getblock_with_string(self): blockhash0 = "blockhash0" blockhash1 = "blockhash1" blocks = [ {"hash": blockhash0}, {"hash": blockhash1}, ] proxy = FakeBitcoinProxy(blocks=blocks) result = proxy.getblock(blockhash0) self.assertEqual(type(result), dict) # should have a height now self.assertTrue("height" in result.keys()) self.assertEqual(result["height"], 0) def test_blockheight_extensively(self): blockhashes = ["blockhash{}".format(x) for x in range(0, 10)] blocks = [] for blockhash in blockhashes: blocks.append({"hash": blockhash}) proxy = FakeBitcoinProxy(blocks=blocks) for (expected_height, blockhash) in enumerate(blockhashes): blockdata = proxy.getblock(blockhash) self.assertEqual(blockdata["height"], expected_height) def test_getblock_with_bytes(self): blockhash0 = "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936301" blocks = [ {"hash": blockhash0}, ] proxy = FakeBitcoinProxy(blocks=blocks) result = proxy.getblock(lx(blockhash0)) self.assertEqual(type(result), dict) def test_getblock_returns_transaction_data(self): blockhash0 = "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936302" transaction_txids = ["foo", "bar"] blocks = [ {"hash": blockhash0, "tx": transaction_txids}, ] proxy = FakeBitcoinProxy(blocks=blocks) result = proxy.getblock(blockhash0) self.assertTrue("tx" in result.keys()) self.assertEqual(type(result["tx"]), list) self.assertEqual(result["tx"], transaction_txids) def test_getblockhash_zero(self): blockhash0 = "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936302" blocks = [ {"hash": blockhash0}, ] proxy = FakeBitcoinProxy(blocks=blocks) blockhash_result = proxy.getblockhash(0) self.assertEqual(blockhash_result, blockhash0) def test_getblockhash_many(self): blockhashes = [ "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936302", "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936303", "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936304", "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936305", ] blocks = make_blocks_from_blockhashes(blockhashes) proxy = FakeBitcoinProxy(blocks=blocks) for (height, expected_blockhash) in enumerate(blockhashes): blockhash_result = proxy.getblockhash(height) self.assertEqual(blockhash_result, expected_blockhash) def test_getblockcount_zero(self): blocks = [] proxy = FakeBitcoinProxy(blocks=blocks) count = proxy.getblockcount() self.assertEqual(count, len(blocks) - 1) def test_getblockcount_many(self): blockhash0 = "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea64936301" blockhash1 = "0000b9fc70e9a8bb863a8c37f0f3d10d4d3e99e0e94bd42b35f0fdbb497399eb" blocks = [ {"hash": blockhash0}, {"hash": blockhash1, "previousblockhash": blockhash0}, ] proxy = FakeBitcoinProxy(blocks=blocks) count = proxy.getblockcount() self.assertEqual(count, len(blocks) - 1) def test_getrawtransaction(self): txids = [ "b9e3b3366b31136bd262c64ff6e4c29918a457840c5f53cbeeeefa41ca3b7005", "21886e5c02049751acea9d462359d68910bef938d9a58288c961d18b6e50daef", "b2d0cc6840be86516ce79ed7249bfd09f95923cc27784c2fa0dd910bfdb03173", "eacb81d11a539047af73b5d810d3683af3b1171e683dcbfcfb2819286d762c0c", "eee72e928403fea7bca29f366483c3e0ab629ac5dce384a0f541aacf6f810d30", ] txdefault = {"tx": "", "confirmations": 0} transactions = dict([(txid, copy(txdefault)) for txid in txids]) # just making sure... self.assertTrue(transactions[txids[0]] is not transactions[txids[1]]) proxy = FakeBitcoinProxy(transactions=transactions) for txid in txids: txdata = proxy.getrawtransaction(txid) self.assertEqual(type(txdata), dict) self.assertTrue("tx" in txdata.keys()) self.assertEqual(type(txdata["tx"]), str) self.assertEqual(txdata["tx"], "") self.assertTrue("confirmations" in txdata.keys()) self.assertEqual(txdata["confirmations"], 0) def test_getnewaddress_returns_different_addresses(self): num_addresses = random.randint(10, 100) addresses = set() proxy = FakeBitcoinProxy() for each in range(num_addresses): address = proxy.getnewaddress() addresses.add(str(address)) self.assertEqual(len(addresses), num_addresses) def test_getnewaddress_returns_cbitcoinaddress(self): proxy = FakeBitcoinProxy() address = proxy.getnewaddress() self.assertEqual(type(address), P2PKHBitcoinAddress) def test_importaddress(self): proxy = FakeBitcoinProxy() proxy.importaddress("foo") def test_importaddress_with_parameters(self): proxy = FakeBitcoinProxy() address = "some_address" label = "" rescan = False proxy.importaddress(address, label, rescan) def test_fundrawtransaction(self): unfunded_transaction = CMutableTransaction([], [make_txout() for x in range(0, 5)]) proxy = FakeBitcoinProxy() funded_transaction_hex = proxy.fundrawtransaction(unfunded_transaction)["hex"] funded_transaction = CMutableTransaction.deserialize(x(funded_transaction_hex)) self.assertTrue(unfunded_transaction is not funded_transaction) self.assertEqual(type(funded_transaction), type(unfunded_transaction)) self.assertNotEqual(len(funded_transaction.vin), 0) self.assertTrue(len(funded_transaction.vin) > len(unfunded_transaction.vin)) self.assertEqual(type(funded_transaction.vin[0]), CTxIn) def test_fundrawtransaction_hex_hash(self): unfunded_transaction = CMutableTransaction([], [make_txout() for x in range(0, 5)]) proxy = FakeBitcoinProxy() funded_transaction_hex = proxy.fundrawtransaction(b2x(unfunded_transaction.serialize()))["hex"] funded_transaction = CMutableTransaction.deserialize(x(funded_transaction_hex)) self.assertTrue(unfunded_transaction is not funded_transaction) self.assertEqual(type(funded_transaction), type(unfunded_transaction)) self.assertNotEqual(len(funded_transaction.vin), 0) self.assertTrue(len(funded_transaction.vin) > len(unfunded_transaction.vin)) self.assertEqual(type(funded_transaction.vin[0]), CTxIn) def test_fundrawtransaction_adds_output(self): num_outputs = 5 unfunded_transaction = CMutableTransaction([], [make_txout() for x in range(0, num_outputs)]) proxy = FakeBitcoinProxy() funded_transaction_hex = proxy.fundrawtransaction(b2x(unfunded_transaction.serialize()))["hex"] funded_transaction = CMutableTransaction.deserialize(x(funded_transaction_hex)) self.assertTrue(len(funded_transaction.vout) > num_outputs) self.assertEqual(len(funded_transaction.vout), num_outputs + 1) def test_signrawtransaction(self): num_outputs = 5 given_transaction = CMutableTransaction([], [make_txout() for x in range(0, num_outputs)]) proxy = FakeBitcoinProxy() result = proxy.signrawtransaction(given_transaction) self.assertEqual(type(result), dict) self.assertTrue("hex" in result.keys()) result_transaction_hex = result["hex"] result_transaction = CMutableTransaction.deserialize(x(result_transaction_hex)) self.assertTrue(result_transaction is not given_transaction) self.assertTrue(result_transaction.vin is not given_transaction.vin) self.assertTrue(result_transaction.vout is not given_transaction.vout) self.assertEqual(len(result_transaction.vout), len(given_transaction.vout)) self.assertEqual(result_transaction.vout[0].scriptPubKey, given_transaction.vout[0].scriptPubKey) def test_sendrawtransaction(self): num_outputs = 5 given_transaction = CMutableTransaction([], [make_txout() for x in range(0, num_outputs)]) expected_txid = b2lx(given_transaction.GetHash()) given_transaction_hex = b2x(given_transaction.serialize()) proxy = FakeBitcoinProxy() resulting_txid = proxy.sendrawtransaction(given_transaction_hex) self.assertEqual(resulting_txid, expected_txid) def test__batch_empty_list_input(self): requests = [] self.assertEqual(len(requests), 0) # must be empty for test proxy = FakeBitcoinProxy() results = proxy._batch(requests) self.assertEqual(type(results), list) self.assertEqual(len(results), 0) def test__batch_raises_when_no_params(self): proxy = FakeBitcoinProxy() with self.assertRaises(TypeError): proxy._batch() def test__batch_same_count_results_as_requests(self): proxy = FakeBitcoinProxy() request = make_rpc_batch_request_entry("getblockcount", []) requests = [request] results = proxy._batch(requests) self.assertEqual(len(requests), len(results)) def test__batch_gives_reasonable_getblockcount_result(self): proxy = FakeBitcoinProxy() request = make_rpc_batch_request_entry("getblockcount", []) requests = [request] results = proxy._batch(requests) self.assertEqual(results[0]["result"], -1) def test__batch_result_keys(self): expected_keys = ["error", "id", "result"] proxy = FakeBitcoinProxy() request = make_rpc_batch_request_entry("getblockcount", []) requests = [request] results = proxy._batch(requests) result = results[0] self.assertTrue(all([expected_key in result.keys() for expected_key in expected_keys])) def test__batch_result_error_is_none(self): proxy = FakeBitcoinProxy() request = make_rpc_batch_request_entry("getblockcount", []) requests = [request] results = proxy._batch(requests) result = results[0] self.assertEqual(result["error"], None) def test__batch_returns_error_when_given_invalid_params(self): params = 1 proxy = FakeBitcoinProxy() request = make_rpc_batch_request_entry("getblockcount", params) requests = [request] results = proxy._batch(requests) result = results[0] self.assertEqual(type(result), dict) self.assertIn("error", result.keys()) self.assertIn("id", result.keys()) self.assertIn("result", result.keys()) self.assertEqual(result["result"], None) self.assertEqual(type(result["error"]), dict) self.assertIn("message", result["error"].keys()) self.assertIn("code", result["error"].keys()) self.assertEqual(result["error"]["message"], "Params must be an array") def test__batch_getblockhash_many(self): block_count = 100 blocks = [] previous_blockhash = None for counter in range(0, block_count): blockhash = "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea649{}".format(counter) block_data = { "hash": blockhash, } if previous_blockhash: block_data["previous_blockhash"] = previous_blockhash blocks.append(block_data) previous_blockhash = blockhash proxy = FakeBitcoinProxy(blocks=blocks) count = proxy.getblockcount() self.assertEqual(count, len(blocks) - 1) requests = [] for counter in range(0, count + 1): # from 0 to len(blocks) request = make_rpc_batch_request_entry("getblockhash", [counter]) requests.append(request) results = proxy._batch(requests) self.assertEqual(type(results), list) self.assertEqual(len(results), len(requests)) for (counter, result) in enumerate(results): self.assertEqual(result["error"], None) expected_blockhash = "00008c0c84aee66413f1e8ff95fdca5e8ebf35c94b090290077cdcea649{}".format(counter) self.assertEqual(result["result"], expected_blockhash) def test_make_blocks_from_blockhashes(self): blockhashes = ["blah{}".format(x) for x in range(0, 25)] blocks = make_blocks_from_blockhashes(blockhashes) self.assertEqual(type(blocks), list) self.assertEqual(len(blocks), len(blockhashes)) self.assertEqual(type(blocks[0]), dict) self.assertTrue(all(["hash" in block.keys() for block in blocks])) self.assertTrue(all(["height" in block.keys() for block in blocks])) self.assertTrue(all(["tx" in block.keys() for block in blocks])) self.assertNotIn("previousblockhash", blocks[0].keys()) self.assertTrue(all(["previousblockhash" in block.keys() for block in blocks[1:]])) self.assertEqual(blocks[-1]["previousblockhash"], blocks[-2]["hash"]) self.assertEqual(sorted([block["hash"] for block in blocks]), sorted(blockhashes)) def test_make_blocks_from_blockhashes_empty(self): blockhashes = [] blocks = make_blocks_from_blockhashes(blockhashes) self.assertEqual(type(blocks), list) self.assertEqual(len(blocks), len(blockhashes)) # Just in case for some reason the function ever appends to the given # list (incorrectly).. self.assertEqual(len(blockhashes), 0) self.assertEqual(len(blocks), 0) # and because paranoia self.assertTrue(blockhashes is not blocks) if __name__ == "__main__": unittest.main() python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_key.py000066400000000000000000000027101430270607500260470ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest from bitcoin.core.key import * from bitcoin.core import x class Test_CPubKey(unittest.TestCase): def test(self): def T(hex_pubkey, is_valid, is_fullyvalid, is_compressed): key = CPubKey(x(hex_pubkey)) self.assertEqual(key.is_valid, is_valid) self.assertEqual(key.is_fullyvalid, is_fullyvalid) self.assertEqual(key.is_compressed, is_compressed) T('', False, False, False) T('00', True, True, False) # why is this valid? T('01', True, False, False) T('02', True, False, False) T('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71', True, True, True) T('0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71', True, False, True) T('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71', True, True, True) T('0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455', True, True, False) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_messages.py000066400000000000000000000100351430270607500270650ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest from bitcoin.messages import msg_version, msg_verack, msg_addr, msg_alert, \ msg_inv, msg_getdata, msg_getblocks, msg_getheaders, msg_headers, msg_tx, \ msg_block, msg_getaddr, msg_ping, msg_pong, msg_mempool, MsgSerializable, \ msg_notfound, msg_reject from io import BytesIO class MessageTestCase(unittest.TestCase): def serialization_test(self, cls): m = cls() mSerialized = m.to_bytes() mDeserialzed = cls.from_bytes(mSerialized) mSerialzedTwice = mDeserialzed.to_bytes() self.assertEqual(mSerialized, mSerialzedTwice) class Test_msg_version(MessageTestCase): def test_serialization(self): super(Test_msg_version, self).serialization_test(msg_version) class Test_msg_verack(MessageTestCase): def test_serialization(self): super(Test_msg_verack, self).serialization_test(msg_verack) class Test_msg_addr(MessageTestCase): def test_serialization(self): super(Test_msg_addr, self).serialization_test(msg_addr) class Test_msg_alert(MessageTestCase): def test_serialization(self): super(Test_msg_alert, self).serialization_test(msg_alert) class Test_msg_inv(MessageTestCase): def test_serialization(self): super(Test_msg_inv, self).serialization_test(msg_inv) class Test_msg_getdata(MessageTestCase): def test_serialization(self): super(Test_msg_getdata, self).serialization_test(msg_getdata) class Test_msg_getblocks(MessageTestCase): def test_serialization(self): super(Test_msg_getblocks, self).serialization_test(msg_getblocks) class Test_msg_notfound(MessageTestCase): def test_serialization(self): super(Test_msg_notfound, self).serialization_test(msg_notfound) class Test_msg_getheaders(MessageTestCase): def test_serialization(self): super(Test_msg_getheaders, self).serialization_test(msg_getheaders) class Test_msg_headers(MessageTestCase): def test_serialization(self): super(Test_msg_headers, self).serialization_test(msg_headers) class Test_msg_tx(MessageTestCase): def test_serialization(self): super(Test_msg_tx, self).serialization_test(msg_tx) class Test_msg_block(MessageTestCase): def test_serialization(self): super(Test_msg_block, self).serialization_test(msg_block) class Test_msg_getaddr(MessageTestCase): def test_serialization(self): super(Test_msg_getaddr, self).serialization_test(msg_getaddr) class Test_msg_ping(MessageTestCase): def test_serialization(self): super(Test_msg_ping, self).serialization_test(msg_ping) class Test_msg_pong(MessageTestCase): def test_serialization(self): super(Test_msg_pong, self).serialization_test(msg_pong) class Test_msg_reject(MessageTestCase): def test_serialization(self): super(Test_msg_reject, self).serialization_test(msg_reject) class Test_msg_mempool(MessageTestCase): def test_serialization(self): super(Test_msg_mempool, self).serialization_test(msg_mempool) class Test_messages(unittest.TestCase): verackbytes = b'\xf9\xbe\xb4\xd9verack\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00]\xf6\xe0\xe2' def test_read_msg_verack(self): f = BytesIO(self.verackbytes) m = MsgSerializable.stream_deserialize(f) self.assertEqual(m.command, msg_verack.command) def test_fail_invalid_message(self): bad_verack_bytes = b'\xf8' + self.verackbytes[1:] f = BytesIO(bad_verack_bytes) with self.assertRaises(ValueError): MsgSerializable.stream_deserialize(f) def test_msg_verack_to_bytes(self): m = msg_verack() b = m.to_bytes() self.assertEqual(self.verackbytes, b) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_net.py000066400000000000000000000065751430270607500260620ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest from bitcoin.net import CAddress, CAlert, CUnsignedAlert, CInv from io import BytesIO class TestUnsignedAlert(unittest.TestCase): def test_serialization(self): alert = CUnsignedAlert() alert.setCancel = [1, 2, 3] alert.strComment = b"Comment" stream = BytesIO() alert.stream_serialize(stream) serialized = BytesIO(stream.getvalue()) deserialized = CUnsignedAlert.stream_deserialize(serialized) self.assertEqual(deserialized, alert) class TestCAlert(unittest.TestCase): def test_serialization(self): alert = CAlert() alert.setCancel = [1, 2, 3] alert.strComment = b"Comment" stream = BytesIO() alert.stream_serialize(stream) serialized = BytesIO(stream.getvalue()) deserialized = CAlert.stream_deserialize(serialized) self.assertEqual(deserialized, alert) class TestCInv(unittest.TestCase): def test_serialization(self): inv = CInv() inv.type = 123 inv.hash = b"0" * 32 stream = BytesIO() inv.stream_serialize(stream) serialized = BytesIO(stream.getvalue()) deserialized = CInv.stream_deserialize(serialized) self.assertEqual(deserialized, inv) class TestCAddress(unittest.TestCase): def test_serializationSimple(self): c = CAddress() cSerialized = c.serialize() cDeserialized = CAddress.deserialize(cSerialized) cSerializedTwice = cDeserialized.serialize() self.assertEqual(cSerialized, cSerializedTwice) def test_serializationIPv4(self): c = CAddress() c.ip = "1.1.1.1" c.port = 8333 c.nTime = 1420576401 cSerialized = c.serialize() cDeserialized = CAddress.deserialize(cSerialized) self.assertEqual(c, cDeserialized) cSerializedTwice = cDeserialized.serialize() self.assertEqual(cSerialized, cSerializedTwice) def test_serializationIPv6(self): c = CAddress() c.ip = "1234:ABCD:1234:ABCD:1234:00:ABCD:1234" c.port = 8333 c.nTime = 1420576401 cSerialized = c.serialize() cDeserialized = CAddress.deserialize(cSerialized) self.assertEqual(c, cDeserialized) cSerializedTwice = cDeserialized.serialize() self.assertEqual(cSerialized, cSerializedTwice) def test_serializationDiff(self): # Sanity check that the serialization code preserves differences c1 = CAddress() c1.ip = "1.1.1.1" c1.port = 8333 c1.nTime = 1420576401 c2 = CAddress() c2.ip = "1.1.1.2" c2.port = 8333 c2.nTime = 1420576401 self.assertNotEqual(c1, c2) c1Serialized = c1.serialize() c2Serialized = c2.serialize() self.assertNotEqual(c1Serialized, c2Serialized) c1Deserialized = CAddress.deserialize(c1Serialized) c2Deserialized = CAddress.deserialize(c2Serialized) self.assertNotEqual(c1Deserialized, c2Deserialized) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_ripemd160.py000066400000000000000000000021771430270607500267750ustar00rootroot00000000000000import unittest from bitcoin.core.contrib.ripemd160 import ripemd160 class Test_ripemd160(unittest.TestCase): def test_ripemd160(self): """RIPEMD-160 test vectors.""" # See https://homes.esat.kuleuven.be/~bosselae/ripemd160.html for msg, hexout in [ (b"", "9c1185a5c5e9fc54612808977ee8f548b2258d31"), (b"a", "0bdc9d2d256b3ee9daae347be6f4dc835a467ffe"), (b"abc", "8eb208f7e05d987a9b044a8e98c6b087f15a0bfc"), (b"message digest", "5d0689ef49d2fae572b881b123a85ffa21595f36"), (b"abcdefghijklmnopqrstuvwxyz", "f71c27109c692c1b56bbdceb5b9d2865b3708dbc"), (b"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "12a053384a9c0c88e405a06c27dcf49ada62eb2b"), (b"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "b0e20b6e3116640286ed3a87a5713079b21f5189"), (b"1234567890" * 8, "9b752e45573d4b39f4dbd3323cab82bf63326bfb"), (b"a" * 1000000, "52783243c1697bdbe16d37f97f68f08325dc1528") ]: self.assertEqual(ripemd160(msg).hex(), hexout)python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_rpc.py000066400000000000000000000023471430270607500260510ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest from bitcoin.rpc import Proxy class Test_RPC(unittest.TestCase): # Tests disabled, see discussion below. # "Looks like your unit tests won't work if Bitcoin Core isn't running; # maybe they in turn need to check that and disable the test if core isn't available?" # https://github.com/petertodd/python-bitcoinlib/pull/10 pass # def test_can_validate(self): # working_address = '1CB2fxLGAZEzgaY4pjr4ndeDWJiz3D3AT7' # p = Proxy() # r = p.validateAddress(working_address) # self.assertEqual(r['address'], working_address) # self.assertEqual(r['isvalid'], True) # # def test_cannot_validate(self): # non_working_address = 'LTatMHrYyHcxhxrY27AqFN53bT4TauR86h' # p = Proxy() # r = p.validateAddress(non_working_address) # self.assertEqual(r['isvalid'], False) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_script.py000066400000000000000000000323201430270607500265630ustar00rootroot00000000000000# Copyright (C) 2013-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest import os from bitcoin.core import b2x,x from bitcoin.core.script import * class Test_CScriptOp(unittest.TestCase): def test_pushdata(self): def T(data, expected): data = x(data) expected = x(expected) serialized_data = CScriptOp.encode_op_pushdata(data) self.assertEqual(serialized_data, expected) T('', '00') T('00', '0100') T('0011223344556677', '080011223344556677') T('ff'*0x4b, '4b' + 'ff'*0x4b) T('ff'*0x4c, '4c4c' + 'ff'*0x4c) T('ff'*0x4c, '4c4c' + 'ff'*0x4c) T('ff'*0xff, '4cff' + 'ff'*0xff) T('ff'*0x100, '4d0001' + 'ff'*0x100) T('ff'*0xffff, '4dffff' + 'ff'*0xffff) T('ff'*0x10000, '4e00000100' + 'ff'*0x10000) def test_is_singleton(self): self.assertTrue(OP_0 is CScriptOp(0x00)) self.assertTrue(OP_1 is CScriptOp(0x51)) self.assertTrue(OP_16 is CScriptOp(0x60)) self.assertTrue(OP_CHECKSIG is CScriptOp(0xac)) for i in range(0x0, 0x100): self.assertTrue(CScriptOp(i) is CScriptOp(i)) def test_encode_decode_op_n(self): def t(n, op): actual = CScriptOp.encode_op_n(n) self.assertEqual(actual, op) self.assertTrue(isinstance(actual, CScriptOp)) actual = op.decode_op_n() self.assertEqual(actual, n) self.assertTrue(isinstance(actual, int)) t(0, OP_0) t(1, OP_1) t(2, OP_2) t(3, OP_3) t(4, OP_4) t(5, OP_5) t(6, OP_6) t(7, OP_7) t(8, OP_8) t(9, OP_9) t(9, OP_9) t(10, OP_10) t(11, OP_11) t(12, OP_12) t(13, OP_13) t(14, OP_14) t(15, OP_15) t(16, OP_16) with self.assertRaises(ValueError): OP_CHECKSIG.decode_op_n() with self.assertRaises(ValueError): CScriptOp(1).decode_op_n() class Test_CScript(unittest.TestCase): def test_tokenize_roundtrip(self): def T(serialized_script, expected_tokens, test_roundtrip=True): serialized_script = x(serialized_script) script_obj = CScript(serialized_script) actual_tokens = list(script_obj) self.assertEqual(actual_tokens, expected_tokens) if test_roundtrip: recreated_script = CScript(actual_tokens) self.assertEqual(recreated_script, serialized_script) T('', []) # standard pushdata T('00', [OP_0]) T('0100', [b'\x00']) T('4b' + 'ff'*0x4b, [b'\xff'*0x4b]) # non-optimal pushdata T('4c00', [b''], False) T('4c04deadbeef', [x('deadbeef')], False) T('4d0000', [b''], False) T('4d0400deadbeef', [x('deadbeef')], False) T('4e00000000', [b''], False) T('4e04000000deadbeef', [x('deadbeef')], False) # numbers T('00', [0x0]) T('4f', [OP_1NEGATE]) T('51', [0x1]) T('52', [0x2]) T('53', [0x3]) T('54', [0x4]) T('55', [0x5]) T('56', [0x6]) T('57', [0x7]) T('58', [0x8]) T('59', [0x9]) T('5a', [0xa]) T('5b', [0xb]) T('5c', [0xc]) T('5d', [0xd]) T('5e', [0xe]) T('5f', [0xf]) # some opcodes T('9b', [OP_BOOLOR]) T('9a9b', [OP_BOOLAND, OP_BOOLOR]) T('ff', [OP_INVALIDOPCODE]) T('fafbfcfd', [CScriptOp(0xfa), CScriptOp(0xfb), CScriptOp(0xfc), CScriptOp(0xfd)]) # all three types T('512103e2a0e6a91fa985ce4dda7f048fca5ec8264292aed9290594321aa53d37fdea32410478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc345552ae', [1, x('03e2a0e6a91fa985ce4dda7f048fca5ec8264292aed9290594321aa53d37fdea32'), x('0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455'), 2, OP_CHECKMULTISIG]) def test_invalid_scripts(self): def T(serialized): with self.assertRaises(CScriptInvalidError): list(CScript(x(serialized))) T('01') T('02') T('0201') T('4b') T('4b' + 'ff'*0x4a) T('4c') T('4cff' + 'ff'*0xfe) T('4d') T('4dff') T('4dffff' + 'ff'*0xfffe) T('4e') T('4effffff') T('4effffffff' + 'ff'*0xfffe) # not going to test with 4GiB-1... def test_equality(self): # Equality is on the serialized script, not the logical meaning. # This is important for P2SH. def T(serialized1, serialized2, are_equal): script1 = CScript(x(serialized1)) script2 = CScript(x(serialized2)) if are_equal: self.assertEqual(script1, script2) else: self.assertNotEqual(script1, script2) T('', '', True) T('', '00', False) T('00', '00', True) T('00', '01', False) T('01ff', '01ff', True) T('fc01ff', '01ff', False) # testing equality on an invalid script is legal, and evaluates based # on the serialization T('4e', '4e', True) T('4e', '4e00', False) def test_add(self): script = CScript() script2 = script + 1 # + operator must create a new instance self.assertIsNot(script, script2) script = script2 self.assertEqual(script, b'\x51') script += 2 # += should not be done in place self.assertIsNot(script, script2) self.assertEqual(script, b'\x51\x52') script += OP_CHECKSIG self.assertEqual(script, b'\x51\x52\xac') script += b'deadbeef' self.assertEqual(script, b'\x51\x52\xac\x08deadbeef') script = CScript() + 1 + 2 + OP_CHECKSIG + b'deadbeef' self.assertEqual(script, b'\x51\x52\xac\x08deadbeef') # big number script = CScript() + 2**64 self.assertEqual(script, b'\x09\x00\x00\x00\x00\x00\x00\x00\x00\x01') # some stuff we can't add with self.assertRaises(TypeError): script += None self.assertEqual(script, b'\x09\x00\x00\x00\x00\x00\x00\x00\x00\x01') with self.assertRaises(TypeError): script += [1, 2, 3] self.assertEqual(script, b'\x09\x00\x00\x00\x00\x00\x00\x00\x00\x01') with self.assertRaises(TypeError): script = script + None self.assertEqual(script, b'\x09\x00\x00\x00\x00\x00\x00\x00\x00\x01') def test_repr(self): def T(script, expected_repr): actual_repr = repr(script) self.assertEqual(actual_repr, expected_repr) T( CScript([]), 'CScript([])') T( CScript([1]), 'CScript([1])') T( CScript([1, 2, 3]), 'CScript([1, 2, 3])') T( CScript([1, x('7ac977d8373df875eceda362298e5d09d4b72b53'), OP_DROP]), "CScript([1, x('7ac977d8373df875eceda362298e5d09d4b72b53'), OP_DROP])") T(CScript(x('0001ff515261ff')), "CScript([0, x('ff'), 1, 2, OP_NOP, OP_INVALIDOPCODE])") # truncated scripts T(CScript(x('6101')), "CScript([OP_NOP, x('')...])") T(CScript(x('614bff')), "CScript([OP_NOP, x('ff')...])") T(CScript(x('614c')), "CScript([OP_NOP, ])") T(CScript(x('614c0200')), "CScript([OP_NOP, x('00')...])") def test_is_p2sh(self): def T(serialized, b): script = CScript(x(serialized)) self.assertEqual(script.is_p2sh(), b) # standard P2SH T('a9146567e91196c49e1dffd09d5759f6bbc0c6d4c2e587', True) # NOT a P2SH txout due to the non-optimal PUSHDATA encoding T('a94c146567e91196c49e1dffd09d5759f6bbc0c6d4c2e587', False) def test_is_push_only(self): def T(serialized, b): script = CScript(x(serialized)) self.assertEqual(script.is_push_only(), b) T('', True) T('00', True) T('0101', True) T('4c00', True) T('4d0000', True) T('4e00000000', True) T('4f', True) # OP_RESERVED *is* considered to be a pushdata op by is_push_only! # Or specifically, the IsPushOnly() used in P2SH validation. T('50', True) T('51', True) T('52', True) T('53', True) T('54', True) T('55', True) T('56', True) T('57', True) T('58', True) T('59', True) T('5a', True) T('5b', True) T('5c', True) T('5d', True) T('5e', True) T('5f', True) T('60', True) T('61', False) def test_is_push_only_on_invalid_pushdata(self): def T(hex_script): invalid_script = CScript(x(hex_script)) self.assertFalse(invalid_script.is_push_only()) T('01') T('02ff') T('4b') T('4c01') T('4c02ff') T('4d') T('4d0100') T('4d0200ff') T('4e') T('4e01000000') T('4e02000000ff') def test_has_canonical_pushes(self): def T(hex_script, expected_result): script = CScript(x(hex_script)) self.assertEqual(script.has_canonical_pushes(), expected_result) T('', True) T('00', True) T('FF', True) # could have used an OP_n code, rather than a 1-byte push T('0100', False) T('0101', False) T('0102', False) T('0103', False) T('0104', False) T('0105', False) T('0106', False) T('0107', False) T('0108', False) T('0109', False) T('010A', False) T('010B', False) T('010C', False) T('010D', False) T('010E', False) T('010F', False) T('0110', False) T('0111', True) # Could have used a normal n-byte push, rather than OP_PUSHDATA1 T('4c00', False) T('4c0100', False) T('4c01FF', False) T('4b' + '00'*75, True) T('4c4b' + '00'*75, False) T('4c4c' + '00'*76, True) # Could have used a OP_PUSHDATA1. T('4d0000', False) T('4d0100FF', False) T('4dFF00' + 'FF'*0xFF, False) T('4d0001' + 'FF'*0x100, True) # Could have used a OP_PUSHDATA2. T('4e00000000', False) T('4e01000000FF', False) T('4eFFFF0000' + 'FF'*0xFFFF, False) T('4e00000100' + 'FF'*0x10000, True) def test_has_canonical_pushes_with_invalid_truncated_script(self): def T(hex_script): script = CScript(x(hex_script)) self.assertEqual(script.has_canonical_pushes(), False) T('01') T('02ff') T('4b') T('4c01') T('4c02ff') T('4d') T('4d0100') T('4d0200ff') T('4e') T('4e01000000') T('4e02000000ff') def test_is_unspendable(self): def T(serialized, b): script = CScript(x(serialized)) self.assertEqual(script.is_unspendable(), b) T('', False) T('00', False) T('006a', False) T('6a', True) T('6a6a', True) T('6a51', True) def test_is_valid(self): def T(serialized, b): script = CScript(x(serialized)) self.assertEqual(script.is_valid(), b) T('', True) T('00', True) T('01', False) # invalid opcodes do not by themselves make a script invalid T('ff', True) def test_to_p2sh_scriptPubKey(self): def T(redeemScript, expected_hex_bytes): redeemScript = CScript(redeemScript) actual_script = redeemScript.to_p2sh_scriptPubKey() self.assertEqual(b2x(actual_script), expected_hex_bytes) T([], 'a914b472a266d0bd89c13706a4132ccfb16f7c3b9fcb87') T([1,x('029b6d2c97b8b7c718c325d7be3ac30f7c9d67651bce0c929f55ee77ce58efcf84'),1,OP_CHECKMULTISIG], 'a91419a7d869032368fd1f1e26e5e73a4ad0e474960e87') T([b'\xff'*517], 'a9140da7fa40ebf248dfbca363c79921bdd665fed5ba87') with self.assertRaises(ValueError): CScript([b'a' * 518]).to_p2sh_scriptPubKey() class Test_IsLowDERSignature(unittest.TestCase): def test_high_s_value(self): sig = x('3046022100820121109528efda8bb20ca28788639e5ba5b365e0a84f8bd85744321e7312c6022100a7c86a21446daa405306fe10d0a9906e37d1a2c6b6fdfaaf6700053058029bbe') self.assertFalse(IsLowDERSignature(sig)) def test_low_s_value(self): sig = x('3045022100b135074e08cc93904a1712b2600d3cb01899a5b1cc7498caa4b8585bcf5f27e7022074ab544045285baef0a63f0fb4c95e577dcbf5c969c0bf47c7da8e478909d669') self.assertTrue(IsLowDERSignature(sig)) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_scripteval.py000066400000000000000000000076451430270607500274470ustar00rootroot00000000000000# Copyright (C) 2013-2017 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import json import os import unittest from binascii import unhexlify from bitcoin.core import * from bitcoin.core.script import * from bitcoin.core.scripteval import * def parse_script(s): def ishex(s): return set(s).issubset(set('0123456789abcdefABCDEF')) r = [] # Create an opcodes_by_name table with both OP_ prefixed names and # shortened ones with the OP_ dropped. opcodes_by_name = {} for name, code in OPCODES_BY_NAME.items(): opcodes_by_name[name] = code opcodes_by_name[name[3:]] = code for word in s.split(): if word.isdigit() or (word[0] == '-' and word[1:].isdigit()): r.append(CScript([int(word)])) elif word.startswith('0x') and ishex(word[2:]): # Raw ex data, inserted NOT pushed onto stack: r.append(unhexlify(word[2:].encode('utf8'))) elif len(word) >= 2 and word[0] == "'" and word[-1] == "'": r.append(CScript([bytes(word[1:-1].encode('utf8'))])) elif word in opcodes_by_name: r.append(CScript([opcodes_by_name[word]])) else: raise ValueError("Error parsing script: %r" % s) return CScript(b''.join(r)) def load_test_vectors(name): with open(os.path.dirname(__file__) + '/data/' + name, 'r') as fd: for test_case in json.load(fd): if len(test_case) == 1: continue # comment if len(test_case) == 3: test_case.append('') # add missing comment scriptSig, scriptPubKey, flags, comment = test_case scriptSig = parse_script(scriptSig) scriptPubKey = parse_script(scriptPubKey) flag_set = set() for flag in flags.split(','): if flag == '' or flag == 'NONE': pass else: try: flag = SCRIPT_VERIFY_FLAGS_BY_NAME[flag] except IndexError: raise Exception('Unknown script verify flag %r' % flag) flag_set.add(flag) yield (scriptSig, scriptPubKey, flag_set, comment, test_case) class Test_EvalScript(unittest.TestCase): def create_test_txs(self, scriptSig, scriptPubKey): txCredit = CTransaction([CTxIn(COutPoint(), CScript([OP_0, OP_0]), nSequence=0xFFFFFFFF)], [CTxOut(0, scriptPubKey)], nLockTime=0) txSpend = CTransaction([CTxIn(COutPoint(txCredit.GetTxid(), 0), scriptSig, nSequence=0xFFFFFFFF)], [CTxOut(0, CScript())], nLockTime=0) return (txCredit, txSpend) def test_script_valid(self): for scriptSig, scriptPubKey, flags, comment, test_case in load_test_vectors('script_valid.json'): (txCredit, txSpend) = self.create_test_txs(scriptSig, scriptPubKey) try: VerifyScript(scriptSig, scriptPubKey, txSpend, 0, flags) except ValidationError as err: self.fail('Script FAILED: %r %r %r with exception %r' % (scriptSig, scriptPubKey, comment, err)) def test_script_invalid(self): for scriptSig, scriptPubKey, flags, comment, test_case in load_test_vectors('script_invalid.json'): (txCredit, txSpend) = self.create_test_txs(scriptSig, scriptPubKey) try: VerifyScript(scriptSig, scriptPubKey, txSpend, 0, flags) except ValidationError: continue self.fail('Expected %r to fail' % test_case) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_segwit.py000066400000000000000000000235511430270607500265670ustar00rootroot00000000000000# Copyright (C) 2016 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest import random import sys import bitcoin from bitcoin.core import * from bitcoin.core.script import * from bitcoin.wallet import * # Test serialization class Test_Segwit(unittest.TestCase): # Test BIP 143 vectors def test_p2wpkh_signaturehash(self): unsigned_tx = x('0100000002fff7f7881a8099afa6940d42d1e7f6362bec38171ea3edf433541db4e4ad969f0000000000eeffffffef51e1b804cc89d182d279655c3aa89e815b1b309fe287d9b2b55d57b90ec68a0100000000ffffffff02202cb206000000001976a9148280b37df378db99f66f85c95a783a76ac7a6d5988ac9093510d000000001976a9143bde42dbee7e4dbe6a21b2d50ce2f0167faa815988ac11000000') scriptpubkey = CScript(x('00141d0f172a0ecb48aee1be1f2687d2963ae33f71a1')) value = int(6*COIN) address = CBech32BitcoinAddress.from_scriptPubKey(scriptpubkey) self.assertEqual(SignatureHash(address.to_redeemScript(), CTransaction.deserialize(unsigned_tx), 1, SIGHASH_ALL, value, SIGVERSION_WITNESS_V0), x('c37af31116d1b27caf68aae9e3ac82f1477929014d5b917657d0eb49478cb670')) def test_p2sh_p2wpkh_signaturehash(self): unsigned_tx = x('0100000001db6b1b20aa0fd7b23880be2ecbd4a98130974cf4748fb66092ac4d3ceb1a54770100000000feffffff02b8b4eb0b000000001976a914a457b684d7f0d539a46a45bbc043f35b59d0d96388ac0008af2f000000001976a914fd270b1ee6abcaea97fea7ad0402e8bd8ad6d77c88ac92040000') scriptpubkey = CScript(x('a9144733f37cf4db86fbc2efed2500b4f4e49f31202387')) redeemscript = CScript(x('001479091972186c449eb1ded22b78e40d009bdf0089')) value = int(10*COIN) address = CBase58BitcoinAddress.from_scriptPubKey(redeemscript) self.assertEqual(SignatureHash(address.to_redeemScript(), CTransaction.deserialize(unsigned_tx), 0, SIGHASH_ALL, value, SIGVERSION_WITNESS_V0), x('64f3b0f4dd2bb3aa1ce8566d220cc74dda9df97d8490cc81d89d735c92e59fb6')) def test_p2wsh_signaturehash1(self): unsigned_tx = x('0100000002fe3dc9208094f3ffd12645477b3dc56f60ec4fa8e6f5d67c565d1c6b9216b36e0000000000ffffffff0815cf020f013ed6cf91d29f4202e8a58726b1ac6c79da47c23d1bee0a6925f80000000000ffffffff0100f2052a010000001976a914a30741f8145e5acadf23f751864167f32e0963f788ac00000000') scriptpubkey1 = CScript(x('21036d5c20fa14fb2f635474c1dc4ef5909d4568e5569b79fc94d3448486e14685f8ac')) value1 = int(1.5625*COIN) scriptpubkey2 = CScript(x('00205d1b56b63d714eebe542309525f484b7e9d6f686b3781b6f61ef925d66d6f6a0')) value2 = int(49*COIN) scriptcode1 = CScript(x('21026dccc749adc2a9d0d89497ac511f760f45c47dc5ed9cf352a58ac706453880aeadab210255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465ac')) # This is the same script with everything up to the last executed OP_CODESEPARATOR, including that # OP_CODESEPARATOR removed scriptcode2 = CScript(x('210255a9626aebf5e29c0e6538428ba0d1dcf6ca98ffdf086aa8ced5e0d0215ea465ac')) self.assertEqual(SignatureHash(scriptcode1, CTransaction.deserialize(unsigned_tx), 1, SIGHASH_SINGLE, value2, SIGVERSION_WITNESS_V0), x('82dde6e4f1e94d02c2b7ad03d2115d691f48d064e9d52f58194a6637e4194391')) self.assertEqual(SignatureHash(scriptcode2, CTransaction.deserialize(unsigned_tx), 1, SIGHASH_SINGLE, value2, SIGVERSION_WITNESS_V0), x('fef7bd749cce710c5c052bd796df1af0d935e59cea63736268bcbe2d2134fc47')) def test_p2wsh_signaturehash2(self): unsigned_tx = x('0100000002e9b542c5176808107ff1df906f46bb1f2583b16112b95ee5380665ba7fcfc0010000000000ffffffff80e68831516392fcd100d186b3c2c7b95c80b53c77e77c35ba03a66b429a2a1b0000000000ffffffff0280969800000000001976a914de4b231626ef508c9a74a8517e6783c0546d6b2888ac80969800000000001976a9146648a8cd4531e1ec47f35916de8e259237294d1e88ac00000000') scriptpubkey1 = CScript(x('0020ba468eea561b26301e4cf69fa34bde4ad60c81e70f059f045ca9a79931004a4d')) value1 = int(0.16777215*COIN) witnessscript1= CScript(x('0063ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac')) scriptcode1 = CScript(x('0063ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac')) scriptpubkey2 = CScript(x('0020d9bbfbe56af7c4b7f960a70d7ea107156913d9e5a26b0a71429df5e097ca6537')) value2 = int(0.16777215*COIN) witnessscript2= CScript(x('5163ab68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac')) scriptcode2 = CScript(x('68210392972e2eb617b2388771abe27235fd5ac44af8e61693261550447a4c3e39da98ac')) self.assertEqual(SignatureHash(scriptcode1, CTransaction.deserialize(unsigned_tx), 0, SIGHASH_SINGLE|SIGHASH_ANYONECANPAY, value1, SIGVERSION_WITNESS_V0), x('e9071e75e25b8a1e298a72f0d2e9f4f95a0f5cdf86a533cda597eb402ed13b3a')) self.assertEqual(SignatureHash(scriptcode2, CTransaction.deserialize(unsigned_tx), 1, SIGHASH_SINGLE|SIGHASH_ANYONECANPAY, value2, SIGVERSION_WITNESS_V0), x('cd72f1f1a433ee9df816857fad88d8ebd97e09a75cd481583eb841c330275e54')) def test_p2sh_p2wsh_signaturehash(self): unsigned_tx = x('010000000136641869ca081e70f394c6948e8af409e18b619df2ed74aa106c1ca29787b96e0100000000ffffffff0200e9a435000000001976a914389ffce9cd9ae88dcc0631e88a821ffdbe9bfe2688acc0832f05000000001976a9147480a33f950689af511e6e84c138dbbd3c3ee41588ac00000000') scriptPubKey = CScript(x('a9149993a429037b5d912407a71c252019287b8d27a587')) value = int(9.87654321*COIN) redeemScript = CScript(x('0020a16b5755f7f6f96dbd65f5f0d6ab9418b89af4b1f14a1bb8a09062c35f0dcb54')) witnessscript= CScript(x('56210307b8ae49ac90a048e9b53357a2354b3334e9c8bee813ecb98e99a7e07e8c3ba32103b28f0c28bfab54554ae8c658ac5c3e0ce6e79ad336331f78c428dd43eea8449b21034b8113d703413d57761b8b9781957b8c0ac1dfe69f492580ca4195f50376ba4a21033400f6afecb833092a9a21cfdf1ed1376e58c5d1f47de74683123987e967a8f42103a6d48b1131e94ba04d9737d61acdaa1322008af9602b3b14862c07a1789aac162102d8b661b0b3302ee2f162b09e07a55ad5dfbe673a9f01d9f0c19617681024306b56ae')) self.assertEqual(SignatureHash(witnessscript, CTransaction.deserialize(unsigned_tx), 0, SIGHASH_ALL, value, SIGVERSION_WITNESS_V0), x('185c0be5263dce5b4bb50a047973c1b6272bfbd0103a89444597dc40b248ee7c')) self.assertEqual(SignatureHash(witnessscript, CTransaction.deserialize(unsigned_tx), 0, SIGHASH_NONE, value, SIGVERSION_WITNESS_V0), x('e9733bc60ea13c95c6527066bb975a2ff29a925e80aa14c213f686cbae5d2f36')) self.assertEqual(SignatureHash(witnessscript, CTransaction.deserialize(unsigned_tx), 0, SIGHASH_SINGLE, value, SIGVERSION_WITNESS_V0), x('1e1f1c303dc025bd664acb72e583e933fae4cff9148bf78c157d1e8f78530aea')) self.assertEqual(SignatureHash(witnessscript, CTransaction.deserialize(unsigned_tx), 0, SIGHASH_ALL|SIGHASH_ANYONECANPAY, value, SIGVERSION_WITNESS_V0), x('2a67f03e63a6a422125878b40b82da593be8d4efaafe88ee528af6e5a9955c6e')) self.assertEqual(SignatureHash(witnessscript, CTransaction.deserialize(unsigned_tx), 0, SIGHASH_NONE|SIGHASH_ANYONECANPAY, value, SIGVERSION_WITNESS_V0), x('781ba15f3779d5542ce8ecb5c18716733a5ee42a6f51488ec96154934e2c890a')) self.assertEqual(SignatureHash(witnessscript, CTransaction.deserialize(unsigned_tx), 0, SIGHASH_SINGLE|SIGHASH_ANYONECANPAY, value, SIGVERSION_WITNESS_V0), x('511e8e52ed574121fc1b654970395502128263f62662e076dc6baf05c2e6a99b')) def test_checkblock(self): # (No witness) coinbase generated by Bitcoin Core str_coinbase = '01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03520101ffffffff0100f2052a01000000232102960c90bc04a631cb17922e4f5d80ac75fd590a88b8baaa5a3d5086ac85e4d788ac00000000' # No witness transaction str_tx = '0100000001e3d0c1d051a3abe79d5951dcab86f71d8926aff5caed5ff9bd72cb593e4ebaf5010000006b483045022100a28e1c57e160296953e1af85c5034bb1b907c12c50367da75ba547874a8a8c52022040682e888ddce7fd5c72519a9f28f22f5164c8af864d33332bbc7f65596ad4ae012102db30394fd5cc8288bed607b9382338240c014a98c9c0febbfb380db74ceb30a3ffffffff020d920000000000001976a914ad781c8ffcc18b2155433cba2da4601180a66eef88aca3170000000000001976a914bacb1c4b0725e61e385c7093b4260533953c8e1688ac00000000' # SegWit transaction str_w_tx = '0100000000010115e180dc28a2327e687facc33f10f2a20da717e5548406f7ae8b4c811072f8560100000000ffffffff0100b4f505000000001976a9141d7cd6c75c2e86f4cbf98eaed221b30bd9a0b92888ac02483045022100df7b7e5cda14ddf91290e02ea10786e03eb11ee36ec02dd862fe9a326bbcb7fd02203f5b4496b667e6e281cc654a2da9e4f08660c620a1051337fa8965f727eb19190121038262a6c6cec93c2d3ecd6c6072efea86d02ff8e3328bbd0242b20af3425990ac00000000' witness_nonce = bytes(random.getrandbits(8) for _ in range(32)) coinbase = CMutableTransaction.deserialize(x(str_coinbase)) coinbase.wit = CTxWitness([CTxInWitness(CScriptWitness([witness_nonce]))]) tx_legacy = CTransaction.deserialize(x(str_tx)) tx_segwit = CTransaction.deserialize(x(str_w_tx)) witness_merkle_root = CBlock.build_witness_merkle_tree_from_txs((coinbase, tx_legacy, tx_segwit))[-1] commitment = Hash(witness_merkle_root + witness_nonce) commitment_script = bitcoin.core.WITNESS_COINBASE_SCRIPTPUBKEY_MAGIC + commitment coinbase.vout.append(CTxOut(0, CScript(commitment_script))) block = CBlock(2, b'\x00'*32, b'\x00'*32, 0, 0, 0, (coinbase, tx_legacy, tx_segwit)) CheckBlock(block, False, True) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_serialize.py000066400000000000000000000123411430270607500272470ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest, random from binascii import unhexlify from bitcoin.core.serialize import * class Test_Serializable(unittest.TestCase): def test_extra_data(self): """Serializable.deserialize() fails if extra data is present""" class FooSerializable(Serializable): @classmethod def stream_deserialize(cls, f): return cls() def stream_serialize(self, f): pass try: FooSerializable.deserialize(b'\x00') except DeserializationExtraDataError as err: self.assertEqual(err.obj, FooSerializable()) self.assertEqual(err.padding, b'\x00') else: self.fail("DeserializationExtraDataError not raised") FooSerializable.deserialize(b'\x00', allow_padding=True) class Test_VarIntSerializer(unittest.TestCase): def test(self): def T(value, expected): expected = unhexlify(expected) actual = VarIntSerializer.serialize(value) self.assertEqual(actual, expected) roundtrip = VarIntSerializer.deserialize(actual) self.assertEqual(value, roundtrip) T(0x0, b'00') T(0xfc, b'fc') T(0xfd, b'fdfd00') T(0xffff, b'fdffff') T(0x10000, b'fe00000100') T(0xffffffff, b'feffffffff') T(0x100000000, b'ff0000000001000000') T(0xffffffffffffffff, b'ffffffffffffffffff') def test_non_optimal(self): def T(serialized, expected_value): serialized = unhexlify(serialized) actual_value = VarIntSerializer.deserialize(serialized) self.assertEqual(actual_value, expected_value) T(b'fd0000', 0) T(b'fd3412', 0x1234) T(b'fe00000000', 0) T(b'fe67452301', 0x1234567) T(b'ff0000000000000000', 0) T(b'ffefcdab8967452301', 0x123456789abcdef) def test_truncated(self): def T(serialized): serialized = unhexlify(serialized) with self.assertRaises(SerializationTruncationError): VarIntSerializer.deserialize(serialized) T(b'') T(b'fd') T(b'fd00') T(b'fe') T(b'fe00') T(b'fe0000') T(b'fe000000') T(b'ff') T(b'ff00000000000000') class Test_BytesSerializer(unittest.TestCase): def test(self): def T(value, expected): value = unhexlify(value) expected = unhexlify(expected) actual = BytesSerializer.serialize(value) self.assertEqual(actual, expected) roundtrip = BytesSerializer.deserialize(actual) self.assertEqual(value, roundtrip) T(b'', b'00') T(b'00', b'0100') T(b'00'*0xffff, b'fdffff' + b'00'*0xffff) def test_truncated(self): def T(serialized, ex_cls=SerializationTruncationError): serialized = unhexlify(serialized) with self.assertRaises(ex_cls): BytesSerializer.deserialize(serialized) T(b'') T(b'01') T(b'0200') T(b'ff00000000000000ff11223344', SerializationError) # > max_size class Test_Compact(unittest.TestCase): def test_from_compact_zero(self): self.assertEqual(uint256_from_compact(0x00123456), 0) self.assertEqual(uint256_from_compact(0x01003456), 0) self.assertEqual(uint256_from_compact(0x02000056), 0) self.assertEqual(uint256_from_compact(0x03000000), 0) self.assertEqual(uint256_from_compact(0x04000000), 0) self.assertEqual(uint256_from_compact(0x00923456), 0) def test_from_compact_negative_zero(self): # Negative bit isn't supported yet # self.assertEqual(uint256_from_compact(0x01803456), 0) # self.assertEqual(uint256_from_compact(0x02800056), 0) # self.assertEqual(uint256_from_compact(0x03800000), 0) # self.assertEqual(uint256_from_compact(0x04800000), 0) return def test_twelve(self): self.assertEqual(uint256_from_compact(0x01123456), 0x0012) self.assertEqual(compact_from_uint256(0x0012), 0x01120000) def test_from_uint256(self): self.assertEqual(compact_from_uint256(0x1234), 0x02123400) self.assertEqual(compact_from_uint256(0x123456), 0x03123456) self.assertEqual(compact_from_uint256(0x12345600), 0x04123456) self.assertEqual(compact_from_uint256(0x92340000), 0x05009234) self.assertEqual(compact_from_uint256(0x1234560000000000000000000000000000000000000000000000000000000000), 0x20123456) class Test_Uint256_Serialize(unittest.TestCase): def test_fixed(self): values = [] values.append(0) values.append(0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff) for x in range(100): values.append(random.getrandbits(256)) for n in values: assert(uint256_from_str(uint256_to_str(n)) == n) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_signmessage.py000066400000000000000000000043421430270607500275670ustar00rootroot00000000000000# Copyright (C) 2013-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import unittest from bitcoin.wallet import CBitcoinSecret from bitcoin.signmessage import BitcoinMessage, VerifyMessage, SignMessage import os import json def load_test_vectors(name): with open(os.path.dirname(__file__) + '/data/' + name, 'r') as fd: return json.load(fd) class Test_SignVerifyMessage(unittest.TestCase): def test_verify_message_simple(self): address = "1F26pNMrywyZJdr22jErtKcjF8R3Ttt55G" message = address signature = "H85WKpqtNZDrajOnYDgUY+abh0KCAcOsAIOQwx2PftAbLEPRA7mzXA/CjXRxzz0MC225pR/hx02Vf2Ag2x33kU4=" message = BitcoinMessage(message) self.assertTrue(VerifyMessage(address, message, signature)) def test_verify_message_vectors(self): for vector in load_test_vectors('signmessage.json'): message = BitcoinMessage(vector['address']) self.assertTrue(VerifyMessage(vector['address'], message, vector['signature'])) def test_sign_message_simple(self): key = CBitcoinSecret("L4vB5fomsK8L95wQ7GFzvErYGht49JsCPJyJMHpB4xGM6xgi2jvG") address = "1F26pNMrywyZJdr22jErtKcjF8R3Ttt55G" message = address message = BitcoinMessage(message) signature = SignMessage(key, message) self.assertTrue(signature) self.assertTrue(VerifyMessage(address, message, signature)) def test_sign_message_vectors(self): for vector in load_test_vectors('signmessage.json'): key = CBitcoinSecret(vector['wif']) message = BitcoinMessage(vector['address']) signature = SignMessage(key, message) self.assertTrue(signature, "Failed to sign for [%s]" % vector['address']) self.assertTrue(VerifyMessage(vector['address'], message, vector['signature']), "Failed to verify signature for [%s]" % vector['address']) if __name__ == "__main__": unittest.main() python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_transactions.py000066400000000000000000000123651430270607500277760ustar00rootroot00000000000000# Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import json import unittest import os from bitcoin.core import * from bitcoin.core.scripteval import VerifyScript, SCRIPT_VERIFY_P2SH from bitcoin.tests.test_scripteval import parse_script def load_test_vectors(name): with open(os.path.dirname(__file__) + '/data/' + name, 'r') as fd: for test_case in json.load(fd): # Comments designated by single length strings if len(test_case) == 1: continue assert len(test_case) == 3 prevouts = {} for json_prevout in test_case[0]: assert len(json_prevout) == 3 n = json_prevout[1] if n == -1: n = 0xffffffff prevout = COutPoint(lx(json_prevout[0]), n) prevouts[prevout] = parse_script(json_prevout[2]) tx = CTransaction.deserialize(x(test_case[1])) enforceP2SH = test_case[2] yield (prevouts, tx, enforceP2SH) class Test_COutPoint(unittest.TestCase): def test_is_null(self): self.assertTrue(COutPoint().is_null()) self.assertTrue(COutPoint(hash=b'\x00'*32,n=0xffffffff).is_null()) self.assertFalse(COutPoint(hash=b'\x00'*31 + b'\x01').is_null()) self.assertFalse(COutPoint(n=1).is_null()) def test_repr(self): def T(outpoint, expected): actual = repr(outpoint) self.assertEqual(actual, expected) T( COutPoint(), 'COutPoint()') T( COutPoint(lx('4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b'), 0), "COutPoint(lx('4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b'), 0)") def test_str(self): def T(outpoint, expected): actual = str(outpoint) self.assertEqual(actual, expected) T(COutPoint(), '0000000000000000000000000000000000000000000000000000000000000000:4294967295') T(COutPoint(lx('4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b'), 0), '4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:0') T(COutPoint(lx('4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b'), 10), '4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b:10') class Test_CMutableOutPoint(unittest.TestCase): def test_GetHash(self): """CMutableOutPoint.GetHash() is not cached""" outpoint = CMutableOutPoint() h1 = outpoint.GetHash() outpoint.n = 1 self.assertNotEqual(h1, outpoint.GetHash()) class Test_CTxIn(unittest.TestCase): def test_is_final(self): self.assertTrue(CTxIn().is_final()) self.assertTrue(CTxIn(nSequence=0xffffffff).is_final()) self.assertFalse(CTxIn(nSequence=0).is_final()) def test_repr(self): def T(txin, expected): actual = repr(txin) self.assertEqual(actual, expected) T( CTxIn(), 'CTxIn(COutPoint(), CScript([]), 0xffffffff)') class Test_CMutableTxIn(unittest.TestCase): def test_GetHash(self): """CMutableTxIn.GetHash() is not cached""" txin = CMutableTxIn() h1 = txin.GetHash() txin.prevout.n = 1 self.assertNotEqual(h1, txin.GetHash()) class Test_CTransaction(unittest.TestCase): def test_is_coinbase(self): tx = CMutableTransaction() self.assertFalse(tx.is_coinbase()) tx.vin.append(CMutableTxIn()) # IsCoinBase() in reference client doesn't check if vout is empty self.assertTrue(tx.is_coinbase()) tx.vin[0].prevout.n = 0 self.assertFalse(tx.is_coinbase()) tx.vin[0] = CTxIn() tx.vin.append(CTxIn()) self.assertFalse(tx.is_coinbase()) def test_tx_valid(self): for prevouts, tx, enforceP2SH in load_test_vectors('tx_valid.json'): try: CheckTransaction(tx) except CheckTransactionError: self.fail('tx failed CheckTransaction(): ' \ + str((prevouts, b2x(tx.serialize()), enforceP2SH))) continue for i in range(len(tx.vin)): flags = set() if enforceP2SH: flags.add(SCRIPT_VERIFY_P2SH) VerifyScript(tx.vin[i].scriptSig, prevouts[tx.vin[i].prevout], tx, i, flags=flags) def test_tx_invalid(self): for prevouts, tx, enforceP2SH in load_test_vectors('tx_invalid.json'): try: CheckTransaction(tx) except CheckTransactionError: continue with self.assertRaises(ValidationError): for i in range(len(tx.vin)): flags = set() if enforceP2SH: flags.add(SCRIPT_VERIFY_P2SH) VerifyScript(tx.vin[i].scriptSig, prevouts[tx.vin[i].prevout], tx, i, flags=flags) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/tests/test_wallet.py000066400000000000000000000366561430270607500265670ustar00rootroot00000000000000# Copyright (C) 2013-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. import hashlib import unittest from bitcoin.core import b2x, x from bitcoin.core.script import CScript, IsLowDERSignature from bitcoin.core.key import CPubKey, is_libsec256k1_available, use_libsecp256k1_for_signing from bitcoin.wallet import * class Test_CBitcoinAddress(unittest.TestCase): def test_create_from_string(self): """Create CBitcoinAddress's from strings""" def T(str_addr, expected_bytes, expected_version, expected_class): addr = CBitcoinAddress(str_addr) self.assertEqual(addr.to_bytes(), expected_bytes) self.assertEqual(addr.__class__, expected_class) if isinstance(addr, CBase58BitcoinAddress): self.assertEqual(addr.nVersion, expected_version) elif isinstance(addr, CBech32BitcoinAddress): self.assertEqual(addr.witver, expected_version) T('1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa', x('62e907b15cbf27d5425399ebf6f0fb50ebb88f18'), 0, P2PKHBitcoinAddress) T('37k7toV1Nv4DfmQbmZ8KuZDQCYK9x5KpzP', x('4266fc6f2c2861d7fe229b279a79803afca7ba34'), 5, P2SHBitcoinAddress) T('BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4', x('751e76e8199196d454941c45d1b3a323f1433bd6'), 0, P2WPKHBitcoinAddress) T('bc1qc7slrfxkknqcq2jevvvkdgvrt8080852dfjewde450xdlk4ugp7szw5tk9', x('c7a1f1a4d6b4c1802a59631966a18359de779e8a6a65973735a3ccdfdabc407d'), 0, P2WSHBitcoinAddress) def test_wrong_nVersion(self): """Creating a CBitcoinAddress from a unknown nVersion fails""" # tests run in mainnet, so both of the following should fail with self.assertRaises(CBitcoinAddressError): CBitcoinAddress('mpXwg4jMtRhuSpVq4xS3HFHmCmWp9NyGKt') with self.assertRaises(CBitcoinAddressError): CBitcoinAddress('2MyJKxYR2zNZZsZ39SgkCXWCfQtXKhnWSWq') def test_from_scriptPubKey(self): def T(hex_scriptpubkey, expected_str_address, expected_class): scriptPubKey = CScript(x(hex_scriptpubkey)) addr = CBitcoinAddress.from_scriptPubKey(scriptPubKey) self.assertEqual(str(addr), expected_str_address) self.assertEqual(addr.__class__, expected_class) T('a914000000000000000000000000000000000000000087', '31h1vYVSYuKP6AhS86fbRdMw9XHieotbST', P2SHBitcoinAddress) T('76a914000000000000000000000000000000000000000088ac', '1111111111111111111114oLvT2', P2PKHBitcoinAddress) T('0014751e76e8199196d454941c45d1b3a323f1433bd6', 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4', P2WPKHBitcoinAddress) T('0020c7a1f1a4d6b4c1802a59631966a18359de779e8a6a65973735a3ccdfdabc407d', 'bc1qc7slrfxkknqcq2jevvvkdgvrt8080852dfjewde450xdlk4ugp7szw5tk9', P2WSHBitcoinAddress) def test_from_nonstd_scriptPubKey(self): """CBitcoinAddress.from_scriptPubKey() with non-standard scriptPubKeys""" # Bad P2SH scriptPubKeys # non-canonical pushdata scriptPubKey = CScript(x('a94c14000000000000000000000000000000000000000087')) with self.assertRaises(CBitcoinAddressError): CBitcoinAddress.from_scriptPubKey(scriptPubKey) # Bad P2PKH scriptPubKeys # Missing a byte scriptPubKey = CScript(x('76a914000000000000000000000000000000000000000088')) with self.assertRaises(CBitcoinAddressError): CBitcoinAddress.from_scriptPubKey(scriptPubKey) # One extra byte scriptPubKey = CScript(x('76a914000000000000000000000000000000000000000088acac')) with self.assertRaises(CBitcoinAddressError): CBitcoinAddress.from_scriptPubKey(scriptPubKey) # One byte changed scriptPubKey = CScript(x('76a914000000000000000000000000000000000000000088ad')) with self.assertRaises(CBitcoinAddressError): CBitcoinAddress.from_scriptPubKey(scriptPubKey) def test_from_invalid_scriptPubKey(self): """CBitcoinAddress.from_scriptPubKey() with invalid scriptPubKeys""" # We should raise a CBitcoinAddressError, not any other type of error # Truncated P2SH scriptPubKey = CScript(x('a91400000000000000000000000000000000000000')) with self.assertRaises(CBitcoinAddressError): CBitcoinAddress.from_scriptPubKey(scriptPubKey) # Truncated P2PKH scriptPubKey = CScript(x('76a91400000000000000000000000000000000000000')) with self.assertRaises(CBitcoinAddressError): CBitcoinAddress.from_scriptPubKey(scriptPubKey) def test_to_redeemScript(self): def T(str_addr, expected_scriptPubKey_hexbytes): addr = CBitcoinAddress(str_addr) actual_scriptPubKey = addr.to_redeemScript() self.assertEqual(b2x(actual_scriptPubKey), expected_scriptPubKey_hexbytes) T('31h1vYVSYuKP6AhS86fbRdMw9XHieotbST', 'a914000000000000000000000000000000000000000087') T('1111111111111111111114oLvT2', '76a914000000000000000000000000000000000000000088ac') T('bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4', '76a914751e76e8199196d454941c45d1b3a323f1433bd688ac') def test_to_scriptPubKey(self): """CBitcoinAddress.to_scriptPubKey() works""" def T(str_addr, expected_scriptPubKey_hexbytes): addr = CBitcoinAddress(str_addr) actual_scriptPubKey = addr.to_scriptPubKey() self.assertEqual(b2x(actual_scriptPubKey), expected_scriptPubKey_hexbytes) T('31h1vYVSYuKP6AhS86fbRdMw9XHieotbST', 'a914000000000000000000000000000000000000000087') T('1111111111111111111114oLvT2', '76a914000000000000000000000000000000000000000088ac') class Test_P2SHBitcoinAddress(unittest.TestCase): def test_from_redeemScript(self): def T(script, expected_str_address): addr = P2SHBitcoinAddress.from_redeemScript(script) self.assertEqual(str(addr), expected_str_address) T(CScript(), '3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy') T(CScript(x('76a914751e76e8199196d454941c45d1b3a323f1433bd688ac')), '3LRW7jeCvQCRdPF8S3yUCfRAx4eqXFmdcr') class Test_P2PKHBitcoinAddress(unittest.TestCase): def test_from_non_canonical_scriptPubKey(self): def T(hex_scriptpubkey, expected_str_address): scriptPubKey = CScript(x(hex_scriptpubkey)) addr = P2PKHBitcoinAddress.from_scriptPubKey(scriptPubKey) self.assertEqual(str(addr), expected_str_address) # now test that CBitcoinAddressError is raised with accept_non_canonical_pushdata=False with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_scriptPubKey(scriptPubKey, accept_non_canonical_pushdata=False) T('76a94c14000000000000000000000000000000000000000088ac', '1111111111111111111114oLvT2') T('76a94d1400000000000000000000000000000000000000000088ac', '1111111111111111111114oLvT2'), T('76a94e14000000000000000000000000000000000000000000000088ac', '1111111111111111111114oLvT2') # make sure invalid scripts raise CBitcoinAddressError with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_scriptPubKey(x('76a94c14')) def test_from_bare_checksig_scriptPubKey(self): def T(hex_scriptpubkey, expected_str_address): scriptPubKey = CScript(x(hex_scriptpubkey)) addr = P2PKHBitcoinAddress.from_scriptPubKey(scriptPubKey) self.assertEqual(str(addr), expected_str_address) # now test that CBitcoinAddressError is raised with accept_non_canonical_pushdata=False with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_scriptPubKey(scriptPubKey, accept_bare_checksig=False) # compressed T('21000000000000000000000000000000000000000000000000000000000000000000ac', '14p5cGy5DZmtNMQwTQiytBvxMVuTmFMSyU') # uncompressed T('410000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ac', '1QLFaVVt99p1y18zWSZnespzhkFxjwBbdP') # non-canonical encoding T('4c21000000000000000000000000000000000000000000000000000000000000000000ac', '14p5cGy5DZmtNMQwTQiytBvxMVuTmFMSyU') # odd-lengths are *not* accepted with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_scriptPubKey(x('2200000000000000000000000000000000000000000000000000000000000000000000ac')) def test_from_valid_pubkey(self): """Create P2PKHBitcoinAddress's from valid pubkeys""" def T(pubkey, expected_str_addr): addr = P2PKHBitcoinAddress.from_pubkey(pubkey) self.assertEqual(str(addr), expected_str_addr) T(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71'), '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8') T(x('0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455'), '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T') T(CPubKey(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71')), '1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8') T(CPubKey(x('0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455')), '1JwSSubhmg6iPtRjtyqhUYYH7bZg3Lfy1T') def test_from_invalid_pubkeys(self): """Create P2PKHBitcoinAddress's from invalid pubkeys""" # first test with accept_invalid=True def T(invalid_pubkey, expected_str_addr): addr = P2PKHBitcoinAddress.from_pubkey(invalid_pubkey, accept_invalid=True) self.assertEqual(str(addr), expected_str_addr) T(x(''), '1HT7xU2Ngenf7D4yocz2SAcnNLW7rK8d4E') T(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c72'), '1L9V4NXbNtZsLjrD3nkU7gtEYLWRBWXLiZ') # With accept_invalid=False we should get CBitcoinAddressError's with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_pubkey(x('')) with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_pubkey(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c72')) with self.assertRaises(CBitcoinAddressError): P2PKHBitcoinAddress.from_pubkey(CPubKey(x('0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c72'))) class Test_CBitcoinSecret(unittest.TestCase): def test(self): def T(base58_privkey, expected_hex_pubkey, expected_is_compressed_value): key = CBitcoinSecret(base58_privkey) self.assertEqual(b2x(key.pub), expected_hex_pubkey) self.assertEqual(key.is_compressed, expected_is_compressed_value) T('5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS', '0478d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71a1518063243acd4dfe96b66e3f2ec8013c8e072cd09b3834a19f81f659cc3455', False) T('L3p8oAcQTtuokSCRHQ7i4MhjWc9zornvpJLfmg62sYpLRJF9woSu', '0378d430274f8c5ec1321338151e9f27f4c676a008bdf8638d07c0b6be9ab35c71', True) def test_sign(self): key = CBitcoinSecret('5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS') hash = b'\x00' * 32 sig = key.sign(hash) # Check a valid signature self.assertTrue(key.pub.verify(hash, sig)) self.assertTrue(IsLowDERSignature(sig)) # Check that invalid hash returns false self.assertFalse(key.pub.verify(b'\xFF'*32, sig)) # Check that invalid signature returns false. # # Note the one-in-four-billion chance of a false positive :) self.assertFalse(key.pub.verify(hash, sig[0:-4] + b'\x00\x00\x00\x00')) def test_sign_invalid_hash(self): key = CBitcoinSecret('5KJvsngHeMpm884wtkJNzQGaCErckhHJBGFsvd3VyK5qMZXj3hS') with self.assertRaises(TypeError): sig = key.sign('0' * 32) hash = b'\x00' * 32 with self.assertRaises(ValueError): sig = key.sign(hash[0:-2]) class Test_RFC6979(unittest.TestCase): def test(self): if not is_libsec256k1_available(): return use_libsecp256k1_for_signing(True) # Test Vectors for RFC 6979 ECDSA, secp256k1, SHA-256 # (private key, message, expected k, expected signature) test_vectors = [ (0x1, "Satoshi Nakamoto", 0x8F8A276C19F4149656B280621E358CCE24F5F52542772691EE69063B74F15D15, "934b1ea10a4b3c1757e2b0c017d0b6143ce3c9a7e6a4a49860d7a6ab210ee3d82442ce9d2b916064108014783e923ec36b49743e2ffa1c4496f01a512aafd9e5"), (0x1, "All those moments will be lost in time, like tears in rain. Time to die...", 0x38AA22D72376B4DBC472E06C3BA403EE0A394DA63FC58D88686C611ABA98D6B3, "8600dbd41e348fe5c9465ab92d23e3db8b98b873beecd930736488696438cb6b547fe64427496db33bf66019dacbf0039c04199abb0122918601db38a72cfc21"), (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364140, "Satoshi Nakamoto", 0x33A19B60E25FB6F4435AF53A3D42D493644827367E6453928554F43E49AA6F90, "fd567d121db66e382991534ada77a6bd3106f0a1098c231e47993447cd6af2d06b39cd0eb1bc8603e159ef5c20a5c8ad685a45b06ce9bebed3f153d10d93bed5"), (0xf8b8af8ce3c7cca5e300d33939540c10d45ce001b8f252bfbc57ba0342904181, "Alan Turing", 0x525A82B70E67874398067543FD84C83D30C175FDC45FDEEE082FE13B1D7CFDF1, "7063ae83e7f62bbb171798131b4a0564b956930092b33b07b395615d9ec7e15c58dfcc1e00a35e1572f366ffe34ba0fc47db1e7189759b9fb233c5b05ab388ea"), (0xe91671c46231f833a6406ccbea0e3e392c76c167bac1cb013f6f1013980455c2, "There is a computer disease that anybody who works with computers knows about. It's a very serious disease and it interferes completely with the work. The trouble with computers is that you 'play' with them!", 0x1F4B84C23A86A221D233F2521BE018D9318639D5B8BBD6374A8A59232D16AD3D, "b552edd27580141f3b2a5463048cb7cd3e047b97c9f98076c32dbdf85a68718b279fa72dd19bfae05577e06c7c0c1900c371fcd5893f7e1d56a37d30174671f6") ] for vector in test_vectors: secret = CBitcoinSecret.from_secret_bytes(x('{:064x}'.format(vector[0]))) encoded_sig = secret.sign(hashlib.sha256(vector[1].encode('utf8')).digest()) assert(encoded_sig[0] == 0x30) assert(encoded_sig[1] == len(encoded_sig)-2) assert(encoded_sig[2] == 0x02) rlen = encoded_sig[3] rpos = 4 assert(rlen in (32, 33)) if rlen == 33: assert(encoded_sig[rpos] == 0) rpos += 1 rlen -= 1 rval = encoded_sig[rpos:rpos+rlen] spos = rpos+rlen assert(encoded_sig[spos] == 0x02) spos += 1 slen = encoded_sig[spos] assert(slen in (32, 33)) spos += 1 if slen == 33: assert(encoded_sig[spos] == 0) spos += 1 slen -= 1 sval = encoded_sig[spos:spos+slen] sig = b2x(rval + sval) assert(str(sig) == vector[3]) use_libsecp256k1_for_signing(False) python-bitcoinlib-python-bitcoinlib-v0.11.2/bitcoin/wallet.py000066400000000000000000000322621430270607500243530ustar00rootroot00000000000000# Copyright (C) 2012-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Wallet-related functionality Includes things like representing addresses and converting them to/from scriptPubKeys; currently there is no actual wallet support implemented. """ import bitcoin import bitcoin.base58 import bitcoin.bech32 import bitcoin.core import bitcoin.core.key import bitcoin.core.script as script class CBitcoinAddress(object): def __new__(cls, s): try: return CBech32BitcoinAddress(s) except bitcoin.bech32.Bech32Error: pass try: return CBase58BitcoinAddress(s) except bitcoin.base58.Base58Error: pass raise CBitcoinAddressError('Unrecognized encoding for bitcoin address') @classmethod def from_scriptPubKey(cls, scriptPubKey): """Convert a scriptPubKey to a subclass of CBitcoinAddress""" try: return CBech32BitcoinAddress.from_scriptPubKey(scriptPubKey) except CBitcoinAddressError: pass try: return CBase58BitcoinAddress.from_scriptPubKey(scriptPubKey) except CBitcoinAddressError: pass raise CBitcoinAddressError('scriptPubKey is not in a recognized address format') class CBitcoinAddressError(Exception): """Raised when an invalid Bitcoin address is encountered""" class CBech32BitcoinAddress(bitcoin.bech32.CBech32Data, CBitcoinAddress): """A Bech32-encoded Bitcoin address""" @classmethod def from_bytes(cls, witver, witprog): assert witver == 0 self = super(CBech32BitcoinAddress, cls).from_bytes( witver, bytes(witprog) ) if len(self) == 32: self.__class__ = P2WSHBitcoinAddress elif len(self) == 20: self.__class__ = P2WPKHBitcoinAddress else: raise CBitcoinAddressError('witness program does not match any known segwit address format') return self @classmethod def from_scriptPubKey(cls, scriptPubKey): """Convert a scriptPubKey to a CBech32BitcoinAddress Returns a CBech32BitcoinAddress subclass, either P2WSHBitcoinAddress or P2WPKHBitcoinAddress. If the scriptPubKey is not recognized CBitcoinAddressError will be raised. """ try: return P2WSHBitcoinAddress.from_scriptPubKey(scriptPubKey) except CBitcoinAddressError: pass try: return P2WPKHBitcoinAddress.from_scriptPubKey(scriptPubKey) except CBitcoinAddressError: pass raise CBitcoinAddressError('scriptPubKey not a valid bech32-encoded address') class CBase58BitcoinAddress(bitcoin.base58.CBase58Data, CBitcoinAddress): """A Base58-encoded Bitcoin address""" @classmethod def from_bytes(cls, data, nVersion): self = super(CBase58BitcoinAddress, cls).from_bytes(data, nVersion) if nVersion == bitcoin.params.BASE58_PREFIXES['SCRIPT_ADDR']: self.__class__ = P2SHBitcoinAddress elif nVersion == bitcoin.params.BASE58_PREFIXES['PUBKEY_ADDR']: self.__class__ = P2PKHBitcoinAddress else: raise CBitcoinAddressError('Version %d not a recognized Bitcoin Address' % nVersion) return self @classmethod def from_scriptPubKey(cls, scriptPubKey): """Convert a scriptPubKey to a CBitcoinAddress Returns a CBitcoinAddress subclass, either P2SHBitcoinAddress or P2PKHBitcoinAddress. If the scriptPubKey is not recognized CBitcoinAddressError will be raised. """ try: return P2SHBitcoinAddress.from_scriptPubKey(scriptPubKey) except CBitcoinAddressError: pass try: return P2PKHBitcoinAddress.from_scriptPubKey(scriptPubKey) except CBitcoinAddressError: pass raise CBitcoinAddressError('scriptPubKey not a valid base58-encoded address') class P2SHBitcoinAddress(CBase58BitcoinAddress): @classmethod def from_bytes(cls, data, nVersion=None): if nVersion is None: nVersion = bitcoin.params.BASE58_PREFIXES['SCRIPT_ADDR'] elif nVersion != bitcoin.params.BASE58_PREFIXES['SCRIPT_ADDR']: raise ValueError('nVersion incorrect for P2SH address: got %d; expected %d' % \ (nVersion, bitcoin.params.BASE58_PREFIXES['SCRIPT_ADDR'])) return super(P2SHBitcoinAddress, cls).from_bytes(data, nVersion) @classmethod def from_redeemScript(cls, redeemScript): """Convert a redeemScript to a P2SH address Convenience function: equivalent to P2SHBitcoinAddress.from_scriptPubKey(redeemScript.to_p2sh_scriptPubKey()) """ return cls.from_scriptPubKey(redeemScript.to_p2sh_scriptPubKey()) @classmethod def from_scriptPubKey(cls, scriptPubKey): """Convert a scriptPubKey to a P2SH address Raises CBitcoinAddressError if the scriptPubKey isn't of the correct form. """ if scriptPubKey.is_p2sh(): return cls.from_bytes(scriptPubKey[2:22], bitcoin.params.BASE58_PREFIXES['SCRIPT_ADDR']) else: raise CBitcoinAddressError('not a P2SH scriptPubKey') def to_scriptPubKey(self): """Convert an address to a scriptPubKey""" assert self.nVersion == bitcoin.params.BASE58_PREFIXES['SCRIPT_ADDR'] return script.CScript([script.OP_HASH160, self, script.OP_EQUAL]) def to_redeemScript(self): return self.to_scriptPubKey() class P2PKHBitcoinAddress(CBase58BitcoinAddress): @classmethod def from_bytes(cls, data, nVersion=None): if nVersion is None: nVersion = bitcoin.params.BASE58_PREFIXES['PUBKEY_ADDR'] elif nVersion != bitcoin.params.BASE58_PREFIXES['PUBKEY_ADDR']: raise ValueError('nVersion incorrect for P2PKH address: got %d; expected %d' % \ (nVersion, bitcoin.params.BASE58_PREFIXES['PUBKEY_ADDR'])) return super(P2PKHBitcoinAddress, cls).from_bytes(data, nVersion) @classmethod def from_pubkey(cls, pubkey, accept_invalid=False): """Create a P2PKH bitcoin address from a pubkey Raises CBitcoinAddressError if pubkey is invalid, unless accept_invalid is True. The pubkey must be a bytes instance; CECKey instances are not accepted. """ if not isinstance(pubkey, bytes): raise TypeError('pubkey must be bytes instance; got %r' % pubkey.__class__) if not accept_invalid: if not isinstance(pubkey, bitcoin.core.key.CPubKey): pubkey = bitcoin.core.key.CPubKey(pubkey) if not pubkey.is_fullyvalid: raise CBitcoinAddressError('invalid pubkey') pubkey_hash = bitcoin.core.Hash160(pubkey) return P2PKHBitcoinAddress.from_bytes(pubkey_hash) @classmethod def from_scriptPubKey(cls, scriptPubKey, accept_non_canonical_pushdata=True, accept_bare_checksig=True): """Convert a scriptPubKey to a P2PKH address Raises CBitcoinAddressError if the scriptPubKey isn't of the correct form. accept_non_canonical_pushdata - Allow non-canonical pushes (default True) accept_bare_checksig - Treat bare-checksig as P2PKH scriptPubKeys (default True) """ if accept_non_canonical_pushdata: # Canonicalize script pushes scriptPubKey = script.CScript(scriptPubKey) # in case it's not a CScript instance yet try: scriptPubKey = script.CScript(tuple(scriptPubKey)) # canonicalize except bitcoin.core.script.CScriptInvalidError: raise CBitcoinAddressError('not a P2PKH scriptPubKey: script is invalid') if scriptPubKey.is_witness_v0_keyhash(): return cls.from_bytes(scriptPubKey[2:22], bitcoin.params.BASE58_PREFIXES['PUBKEY_ADDR']) elif scriptPubKey.is_witness_v0_nested_keyhash(): return cls.from_bytes(scriptPubKey[3:23], bitcoin.params.BASE58_PREFIXES['PUBKEY_ADDR']) elif (len(scriptPubKey) == 25 and scriptPubKey[0] == script.OP_DUP and scriptPubKey[1] == script.OP_HASH160 and scriptPubKey[2] == 0x14 and scriptPubKey[23] == script.OP_EQUALVERIFY and scriptPubKey[24] == script.OP_CHECKSIG): return cls.from_bytes(scriptPubKey[3:23], bitcoin.params.BASE58_PREFIXES['PUBKEY_ADDR']) elif accept_bare_checksig: pubkey = None # We can operate on the raw bytes directly because we've # canonicalized everything above. if (len(scriptPubKey) == 35 # compressed and scriptPubKey[0] == 0x21 and scriptPubKey[34] == script.OP_CHECKSIG): pubkey = scriptPubKey[1:34] elif (len(scriptPubKey) == 67 # uncompressed and scriptPubKey[0] == 0x41 and scriptPubKey[66] == script.OP_CHECKSIG): pubkey = scriptPubKey[1:65] if pubkey is not None: return cls.from_pubkey(pubkey, accept_invalid=True) raise CBitcoinAddressError('not a P2PKH scriptPubKey') def to_scriptPubKey(self, nested=False): """Convert an address to a scriptPubKey""" assert self.nVersion == bitcoin.params.BASE58_PREFIXES['PUBKEY_ADDR'] return script.CScript([script.OP_DUP, script.OP_HASH160, self, script.OP_EQUALVERIFY, script.OP_CHECKSIG]) def to_redeemScript(self): return self.to_scriptPubKey() class P2WSHBitcoinAddress(CBech32BitcoinAddress): @classmethod def from_scriptPubKey(cls, scriptPubKey): """Convert a scriptPubKey to a P2WSH address Raises CBitcoinAddressError if the scriptPubKey isn't of the correct form. """ if scriptPubKey.is_witness_v0_scripthash(): return cls.from_bytes(0, scriptPubKey[2:34]) else: raise CBitcoinAddressError('not a P2WSH scriptPubKey') def to_scriptPubKey(self): """Convert an address to a scriptPubKey""" assert self.witver == 0 return script.CScript([0, self]) def to_redeemScript(self): raise NotImplementedError("Not enough data in p2wsh address to reconstruct redeem script") class P2WPKHBitcoinAddress(CBech32BitcoinAddress): @classmethod def from_scriptPubKey(cls, scriptPubKey): """Convert a scriptPubKey to a P2WPKH address Raises CBitcoinAddressError if the scriptPubKey isn't of the correct form. """ if scriptPubKey.is_witness_v0_keyhash(): return cls.from_bytes(0, scriptPubKey[2:22]) else: raise CBitcoinAddressError('not a P2WPKH scriptPubKey') def to_scriptPubKey(self): """Convert an address to a scriptPubKey""" assert self.witver == 0 return script.CScript([0, self]) def to_redeemScript(self): return script.CScript([script.OP_DUP, script.OP_HASH160, self, script.OP_EQUALVERIFY, script.OP_CHECKSIG]) class CKey(object): """An encapsulated private key Attributes: pub - The corresponding CPubKey for this private key is_compressed - True if compressed """ def __init__(self, secret, compressed=True): self._cec_key = bitcoin.core.key.CECKey() self._cec_key.set_secretbytes(secret) self._cec_key.set_compressed(compressed) self.pub = bitcoin.core.key.CPubKey(self._cec_key.get_pubkey(), self._cec_key) @property def is_compressed(self): return self.pub.is_compressed def sign(self, hash): return self._cec_key.sign(hash) def sign_compact(self, hash): return self._cec_key.sign_compact(hash) class CBitcoinSecretError(bitcoin.base58.Base58Error): pass class CBitcoinSecret(bitcoin.base58.CBase58Data, CKey): """A base58-encoded secret key""" @classmethod def from_secret_bytes(cls, secret, compressed=True): """Create a secret key from a 32-byte secret""" self = cls.from_bytes(secret + (b'\x01' if compressed else b''), bitcoin.params.BASE58_PREFIXES['SECRET_KEY']) self.__init__(None) return self def __init__(self, s): if self.nVersion != bitcoin.params.BASE58_PREFIXES['SECRET_KEY']: raise CBitcoinSecretError('Not a base58-encoded secret key: got nVersion=%d; expected nVersion=%d' % \ (self.nVersion, bitcoin.params.BASE58_PREFIXES['SECRET_KEY'])) CKey.__init__(self, self[0:32], len(self) > 32 and self[32] == 1) __all__ = ( 'CBitcoinAddressError', 'CBitcoinAddress', 'CBase58BitcoinAddress', 'CBech32BitcoinAddress', 'P2SHBitcoinAddress', 'P2PKHBitcoinAddress', 'P2WSHBitcoinAddress', 'P2WPKHBitcoinAddress', 'CKey', 'CBitcoinSecretError', 'CBitcoinSecret', ) python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/000077500000000000000000000000001430270607500216225ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/.gitignore000066400000000000000000000000071430270607500236070ustar00rootroot00000000000000_build python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/Makefile000066400000000000000000000127001430270607500232620ustar00rootroot00000000000000# Makefile for Sphinx documentation # # You can set these variables from the command line. SPHINXOPTS = SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build # Internal variables. PAPEROPT_a4 = -D latex_paper_size=a4 PAPEROPT_letter = -D latex_paper_size=letter ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . # the i18n builder cannot share the environment and doctrees with the others I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) . .PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext help: @echo "Please use \`make ' where is one of" @echo " html to make standalone HTML files" @echo " dirhtml to make HTML files named index.html in directories" @echo " singlehtml to make a single large HTML file" @echo " pickle to make pickle files" @echo " json to make JSON files" @echo " htmlhelp to make HTML files and a HTML help project" @echo " qthelp to make HTML files and a qthelp project" @echo " devhelp to make HTML files and a Devhelp project" @echo " epub to make an epub" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @echo " latexpdf to make LaTeX files and run them through pdflatex" @echo " text to make text files" @echo " man to make manual pages" @echo " texinfo to make Texinfo files" @echo " info to make Texinfo files and run them through makeinfo" @echo " gettext to make PO message catalogs" @echo " changes to make an overview of all changed/added/deprecated items" @echo " linkcheck to check all external links for integrity" @echo " doctest to run all doctests embedded in the documentation (if enabled)" clean: -rm -rf $(BUILDDIR)/* html: $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/html." dirhtml: $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml @echo @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml." singlehtml: $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml @echo @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml." pickle: $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle @echo @echo "Build finished; now you can process the pickle files." json: $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json @echo @echo "Build finished; now you can process the JSON files." htmlhelp: $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp @echo @echo "Build finished; now you can run HTML Help Workshop with the" \ ".hhp project file in $(BUILDDIR)/htmlhelp." qthelp: $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp @echo @echo "Build finished; now you can run "qcollectiongenerator" with the" \ ".qhcp project file in $(BUILDDIR)/qthelp, like this:" @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/bitcoin.qhcp" @echo "To view the help file:" @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/bitcoin.qhc" devhelp: $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp @echo @echo "Build finished." @echo "To view the help file:" @echo "# mkdir -p $$HOME/.local/share/devhelp/bitcoin" @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/bitcoin" @echo "# devhelp" epub: $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub @echo @echo "Build finished. The epub file is in $(BUILDDIR)/epub." latex: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex." @echo "Run \`make' in that directory to run these through (pdf)latex" \ "(use \`make latexpdf' here to do that automatically)." latexpdf: $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex @echo "Running LaTeX files through pdflatex..." $(MAKE) -C $(BUILDDIR)/latex all-pdf @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex." text: $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text @echo @echo "Build finished. The text files are in $(BUILDDIR)/text." man: $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man @echo @echo "Build finished. The manual pages are in $(BUILDDIR)/man." texinfo: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo." @echo "Run \`make' in that directory to run these through makeinfo" \ "(use \`make info' here to do that automatically)." info: $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo @echo "Running Texinfo files through makeinfo..." make -C $(BUILDDIR)/texinfo info @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo." gettext: $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale @echo @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale." changes: $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes @echo @echo "The overview file is in $(BUILDDIR)/changes." linkcheck: $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck @echo @echo "Link check complete; look for any errors in the above output " \ "or in $(BUILDDIR)/linkcheck/output.txt." doctest: $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest @echo "Testing of doctests in the sources finished, look at the " \ "results in $(BUILDDIR)/doctest/output.txt." python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/_static/000077500000000000000000000000001430270607500232505ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/_static/.placeholder000066400000000000000000000000001430270607500255210ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/_templates/000077500000000000000000000000001430270607500237575ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/_templates/.placeholder000066400000000000000000000000001430270607500262300ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/bitcoin.core.rst000066400000000000000000000006461430270607500247400ustar00rootroot00000000000000bitcoin.core ============ Everything consensus critical is found in the core subpackage. :mod:`core` ----------- .. automodule:: bitcoin.core :mod:`key` ---------- .. automodule:: bitcoin.core.key :mod:`script` ------------- .. automodule:: bitcoin.core.script :mod:`scripteval` ----------------- .. automodule:: bitcoin.core.scripteval :mod:`serialize` ---------------- .. automodule:: bitcoin.core.serialize python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/bitcoin.rst000066400000000000000000000010711430270607500240020ustar00rootroot00000000000000bitcoin ======= :mod:`bitcoin` -------------- .. automodule:: bitcoin :mod:`base58` ------------- .. automodule:: bitcoin.base58 :mod:`bloom` ------------ .. automodule:: bitcoin.bloom :mod:`messages` --------------- .. automodule:: bitcoin.messages :mod:`net` ---------- .. automodule:: bitcoin.net :mod:`rpc` ---------- .. automodule:: bitcoin.rpc :mod:`signature` ---------------- .. automodule:: bitcoin.signature :mod:`signmessage` ------------------ .. automodule:: bitcoin.signmessage :mod:`wallet` ------------- .. automodule:: bitcoin.wallet python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/conf.py000066400000000000000000000227401430270607500231260ustar00rootroot00000000000000# -*- coding: utf-8 -*- # # bitcoin documentation build configuration file, created by # sphinx-quickstart on Thu May 28 20:40:55 2015. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All configuration values have a default; values that are commented out # serve to show the default. PROJECT = 'python-bitcoinlib' DESCRIPTION = 'The Swiss Army Knife of the Bitcoin protocol.' AUTHORS = 'The python-bitcoinlib developers' import sphinx import sys import os # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('..')) from bitcoin import __version__ # Prevent loading openssl when generating API docs. Either the whole library or # the necessary elliptic curve might not be available, causing import to fail. try: from unittest.mock import MagicMock except ImportError: from mock import MagicMock sys.modules['ctypes'] = MagicMock() # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. #needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. extensions = [ 'sphinx.ext.autodoc', 'sphinx.ext.viewcode', ] autodoc_default_flags = [ 'members', 'undoc-members', 'show-inheritance', ] # Include __init__ docstring in class level docs autoclass_content = 'both' # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # The suffix of source filenames. source_suffix = '.rst' # The encoding of source files. #source_encoding = 'utf-8-sig' # The master toctree document. master_doc = 'index' # General information about the project. project = PROJECT copyright = '2012-2015, ' + AUTHORS # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. version = __version__ # The full version, including alpha/beta/rc tags. release = __version__ # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. #language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: #today = '' # Else, today_fmt is used as the format for a strftime call. #today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = ['_build'] # The reST default role (used for this markup: `text`) to use for all documents. #default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. #add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). #add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. #show_authors = False # The name of the Pygments (syntax highlighting) style to use. pygments_style = 'sphinx' # A list of ignored prefixes for module index sorting. #modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. if getattr(sphinx, 'version_info', (0, 0)) >= (1, 3): html_theme = 'classic' else: html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. #html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. #html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". #html_title = None # A shorter title for the navigation bar. Default is the same as html_title. #html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. #html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. #html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. #html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. #html_use_smartypants = True # Custom sidebar templates, maps document names to template names. #html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. #html_additional_pages = {} # If false, no module index is generated. #html_domain_indices = True # If false, no index is generated. #html_use_index = True # If true, the index is split into individual pages for each letter. #html_split_index = False # If true, links to the reST sources are added to the pages. #html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. #html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. #html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. #html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). #html_file_suffix = None # Output file base name for HTML help builder. htmlhelp_basename = PROJECT + 'doc' # -- Options for LaTeX output -------------------------------------------------- latex_elements = { # The paper size ('letterpaper' or 'a4paper'). #'papersize': 'letterpaper', # The font size ('10pt', '11pt' or '12pt'). #'pointsize': '10pt', # Additional stuff for the LaTeX preamble. #'preamble': '', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ ('index', PROJECT + '.tex', PROJECT + ' Documentation', AUTHORS, 'manual'), ] # The name of an image file (relative to this directory) to place at the top of # the title page. #latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. #latex_use_parts = False # If true, show page references after internal links. #latex_show_pagerefs = False # If true, show URL addresses after external links. #latex_show_urls = False # Documents to append as an appendix to all manuals. #latex_appendices = [] # If false, no module index is generated. #latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ ('index', PROJECT, PROJECT + ' Documentation', [AUTHORS], 1) ] # If true, show URL addresses after external links. #man_show_urls = False # -- Options for Texinfo output ------------------------------------------------ # Grouping the document tree into Texinfo files. List of tuples # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ ('index', PROJECT, PROJECT + ' Documentation', AUTHORS, PROJECT, DESCRIPTION, 'Miscellaneous'), ] # Documents to append as an appendix to all manuals. #texinfo_appendices = [] # If false, no module index is generated. #texinfo_domain_indices = True # How to display URL addresses: 'footnote', 'no', or 'inline'. #texinfo_show_urls = 'footnote' # -- Options for Epub output --------------------------------------------------- # Bibliographic Dublin Core info. epub_title = PROJECT epub_author = AUTHORS epub_publisher = AUTHORS epub_copyright = copyright # The language of the text. It defaults to the language option # or en if the language is not set. #epub_language = '' # The scheme of the identifier. Typical schemes are ISBN or URL. #epub_scheme = '' # The unique identifier of the text. This can be a ISBN number # or the project homepage. #epub_identifier = '' # A unique identification for the text. #epub_uid = '' # A tuple containing the cover image and cover page html template filenames. #epub_cover = () # HTML files that should be inserted before the pages created by sphinx. # The format is a list of tuples containing the path and title. #epub_pre_files = [] # HTML files shat should be inserted after the pages created by sphinx. # The format is a list of tuples containing the path and title. #epub_post_files = [] # A list of files that should not be packed into the epub file. #epub_exclude_files = [] # The depth of the table of contents in toc.ncx. #epub_tocdepth = 3 # Allow duplicate toc entries. #epub_tocdup = True python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/index.rst000066400000000000000000000010231430270607500234570ustar00rootroot00000000000000.. bitcoin documentation master file, created by sphinx-quickstart on Thu May 28 20:40:55 2015. You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. python-bitcoinlib Documentation =============================== API Reference ------------- This section contains auto-generated API documentation. Contents: .. toctree:: :maxdepth: 2 bitcoin bitcoin.core Indices and tables ================== * :ref:`genindex` * :ref:`modindex` * :ref:`search` python-bitcoinlib-python-bitcoinlib-v0.11.2/doc/make.bat000066400000000000000000000117521430270607500232350ustar00rootroot00000000000000@ECHO OFF REM Command file for Sphinx documentation if "%SPHINXBUILD%" == "" ( set SPHINXBUILD=sphinx-build ) set BUILDDIR=_build set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% . set I18NSPHINXOPTS=%SPHINXOPTS% . if NOT "%PAPER%" == "" ( set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS% set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS% ) if "%1" == "" goto help if "%1" == "help" ( :help echo.Please use `make ^` where ^ is one of echo. html to make standalone HTML files echo. dirhtml to make HTML files named index.html in directories echo. singlehtml to make a single large HTML file echo. pickle to make pickle files echo. json to make JSON files echo. htmlhelp to make HTML files and a HTML help project echo. qthelp to make HTML files and a qthelp project echo. devhelp to make HTML files and a Devhelp project echo. epub to make an epub echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter echo. text to make text files echo. man to make manual pages echo. texinfo to make Texinfo files echo. gettext to make PO message catalogs echo. changes to make an overview over all changed/added/deprecated items echo. linkcheck to check all external links for integrity echo. doctest to run all doctests embedded in the documentation if enabled goto end ) if "%1" == "clean" ( for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i del /q /s %BUILDDIR%\* goto end ) if "%1" == "html" ( %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/html. goto end ) if "%1" == "dirhtml" ( %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml. goto end ) if "%1" == "singlehtml" ( %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml if errorlevel 1 exit /b 1 echo. echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml. goto end ) if "%1" == "pickle" ( %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the pickle files. goto end ) if "%1" == "json" ( %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can process the JSON files. goto end ) if "%1" == "htmlhelp" ( %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run HTML Help Workshop with the ^ .hhp project file in %BUILDDIR%/htmlhelp. goto end ) if "%1" == "qthelp" ( %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp if errorlevel 1 exit /b 1 echo. echo.Build finished; now you can run "qcollectiongenerator" with the ^ .qhcp project file in %BUILDDIR%/qthelp, like this: echo.^> qcollectiongenerator %BUILDDIR%\qthelp\bitcoin.qhcp echo.To view the help file: echo.^> assistant -collectionFile %BUILDDIR%\qthelp\bitcoin.ghc goto end ) if "%1" == "devhelp" ( %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp if errorlevel 1 exit /b 1 echo. echo.Build finished. goto end ) if "%1" == "epub" ( %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub if errorlevel 1 exit /b 1 echo. echo.Build finished. The epub file is in %BUILDDIR%/epub. goto end ) if "%1" == "latex" ( %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex if errorlevel 1 exit /b 1 echo. echo.Build finished; the LaTeX files are in %BUILDDIR%/latex. goto end ) if "%1" == "text" ( %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text if errorlevel 1 exit /b 1 echo. echo.Build finished. The text files are in %BUILDDIR%/text. goto end ) if "%1" == "man" ( %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man if errorlevel 1 exit /b 1 echo. echo.Build finished. The manual pages are in %BUILDDIR%/man. goto end ) if "%1" == "texinfo" ( %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo if errorlevel 1 exit /b 1 echo. echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo. goto end ) if "%1" == "gettext" ( %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale if errorlevel 1 exit /b 1 echo. echo.Build finished. The message catalogs are in %BUILDDIR%/locale. goto end ) if "%1" == "changes" ( %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes if errorlevel 1 exit /b 1 echo. echo.The overview file is in %BUILDDIR%/changes. goto end ) if "%1" == "linkcheck" ( %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck if errorlevel 1 exit /b 1 echo. echo.Link check complete; look for any errors in the above output ^ or in %BUILDDIR%/linkcheck/output.txt. goto end ) if "%1" == "doctest" ( %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest if errorlevel 1 exit /b 1 echo. echo.Testing of doctests in the sources finished, look at the ^ results in %BUILDDIR%/doctest/output.txt. goto end ) :end python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/000077500000000000000000000000001430270607500226735ustar00rootroot00000000000000python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/bip-0070-payment-protocol.py000077500000000000000000000052711430270607500277250ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Bip-0070-related functionality Creates http response objects suitable for use with bitcoin bip 70 using googles protocol buffers. """ import urllib2 # https://github.com/bitcoin/bips/blob/master/bip-0070/paymentrequest.proto import payments_pb2 o = payments_pb2 import bitcoin #bitcoin.SelectParams('testnet') from bitcoin.wallet import CBitcoinAddress from bitcoin.core.script import CScript from bitcoin.rpc import Proxy from time import time def payment_request(): """Generates a http PaymentRequest object""" bc = Proxy() btc = bc.getnewaddress() # Setting the 'amount' field to 0 (zero) should prompt the user to enter # the amount for us but a bug in bitcoin core qt version 0.9.1 (at time of # writing) wrongly informs us that the value is too small and aborts. # https://github.com/bitcoin/bitcoin/issues/3095 # Also there can be no leading 0's (zeros). btc_amount = 100000 serialized_pubkey = btc.to_scriptPubKey() pdo = o.PaymentDetails() #pdo.network = 'test' pdo.outputs.add(amount = btc_amount,script = serialized_pubkey) pdo.time = int(time()) pdo.memo = 'String shown to user before confirming payment' pdo.payment_url = 'http://payment_ack.url' pro = o.PaymentRequest() pro.serialized_payment_details = pdo.SerializeToString() sds_pr = pro.SerializeToString() open('sds_pr_blob', 'wb').write(sds_pr) headers = {'Content-Type': 'application/bitcoin-payment', 'Accept': 'application/bitcoin-paymentrequest'} http_response_object = urllib2.Request('file:sds_pr_blob', None, headers) return http_response_object def payment_ack(serialized_Payment_message): """Generates a PaymentACK object, captures client refund address and returns a message""" pao = o.PaymentACK() pao.payment.ParseFromString(serialized_Payment_message) pao.memo = 'String shown to user after payment confirmation' refund_address = CBitcoinAddress.from_scriptPubKey(CScript(pao.payment.refund_to[0].script)) sds_pa = pao.SerializeToString() open('sds_pa_blob', 'wb').write(sds_pa) headers = {'Content-Type' : 'application/bitcoin-payment', 'Accept' : 'application/bitcoin-paymentack'} http_response_object = urllib2.Request('file:sds_pa_blob', None, headers) return http_response_object python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/make-bootstrap-rpc.py000077500000000000000000000026261430270607500267700ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2013-2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Make a boostrap.dat file by getting the blocks from the RPC interface.""" import bitcoin import bitcoin.rpc import struct import sys import time try: if len(sys.argv) not in (2, 3): raise Exception n = int(sys.argv[1]) if len(sys.argv) == 3: bitcoin.SelectParams(sys.argv[2]) except Exception as ex: print('Usage: %s [network=(mainnet|testnet|regtest|signet)] > bootstrap.dat' % sys.argv[0], file=sys.stderr) sys.exit(1) proxy = bitcoin.rpc.Proxy() total_bytes = 0 start_time = time.time() fd = sys.stdout.buffer for i in range(n + 1): block = proxy.getblock(proxy.getblockhash(i)) block_bytes = block.serialize() total_bytes += len(block_bytes) print('%.2f KB/s, height %d, %d bytes' % ((total_bytes / 1000) / (time.time() - start_time), i, len(block_bytes)), file=sys.stderr) fd.write(bitcoin.params.MESSAGE_START) fd.write(struct.pack('= 1: logging.root.setLevel(logging.DEBUG) elif args.verbosity == -1: logging.root.setLevel(logging.WARNING) elif args.verbosity <= -2: logging.root.setLevel(logging.ERROR) if args.testnet: bitcoin.SelectParams('testnet') elif args.regtest: bitcoin.SelectParams('regtest') proxy = bitcoin.rpc.Proxy() if args.privkey is None: args.privkey = CBitcoinSecret.from_secret_bytes(os.urandom(32)) else: args.privkey = CBitcoinSecret(args.privkey) logging.info('Using keypair %s %s' % (b2x(args.privkey.pub), args.privkey)) # Turn the text file into padded lines if args.fd is sys.stdin: # work around a bug where even though we specified binary encoding we get # the sys.stdin instead. args.fd = sys.stdin.buffer raw_padded_lines = [b'\x00' + line.rstrip().ljust(args.min_len) + b'\x00' for line in args.fd.readlines()] # combine lines if < MAX_SCRIPT_ELEMENT_SIZE padded_lines = [] prev_line = b'\x00' for line in raw_padded_lines: if len(prev_line) + len(line) <= MAX_SCRIPT_ELEMENT_SIZE: prev_line = prev_line + line[1:] else: padded_lines.append(prev_line) prev_line = line if prev_line: padded_lines.append(prev_line) scripts = [] while padded_lines: def make_scripts(lines, n): # The n makes sure every p2sh addr is unique; the pubkey lets us # control the order the vin order vs. just using hashlocks. redeemScript = [] for chunk in reversed(lines): if len(chunk) > MAX_SCRIPT_ELEMENT_SIZE: parser.exit('Lines must be less than %d characters; got %d characters' %\ (MAX_SCRIPT_ELEMENT_SIZE, len(chunk))) redeemScript.extend([OP_HASH160, Hash160(chunk), OP_EQUALVERIFY]) redeemScript = CScript(redeemScript + [args.privkey.pub, OP_CHECKSIGVERIFY, n, OP_DROP, # deduplicate push dropped to meet BIP62 rules OP_DEPTH, 0, OP_EQUAL]) # prevent scriptSig malleability return CScript(lines) + redeemScript, redeemScript scriptSig = redeemScript = None for i in range(len(padded_lines)): next_scriptSig, next_redeemScript = make_scripts(padded_lines[0:i+1], len(scripts)) # FIXME: magic numbers! if len(next_redeemScript) > 520 or len(next_scriptSig) > 1600-100: padded_lines = padded_lines[i:] break else: scriptSig = next_scriptSig redeemScript = next_redeemScript else: padded_lines = [] scripts.append((scriptSig, redeemScript)) # pay to the redeemScripts to make them spendable # the 41 accounts for the size of the CTxIn itself payments = {P2SHBitcoinAddress.from_redeemScript(redeemScript):int(((len(scriptSig)+41)/1000 * args.fee_per_kb)*COIN) for scriptSig, redeemScript in scripts} prevouts_by_scriptPubKey = None if not args.dryrun: txid = proxy.sendmany('', payments, 0) logging.info('Sent pre-pub tx: %s' % b2lx(txid)) tx = proxy.getrawtransaction(txid) prevouts_by_scriptPubKey = {txout.scriptPubKey:COutPoint(txid, i) for i, txout in enumerate(tx.vout)} else: prevouts_by_scriptPubKey = {redeemScript.to_p2sh_scriptPubKey():COutPoint(b'\x00'*32, i) for i, (scriptSig, redeemScript) in enumerate(scripts)} logging.debug('Payments: %r' % payments) logging.info('Total cost: %s BTC' % str_money_value(sum(amount for addr, amount in payments.items()))) # Create unsigned tx for SignatureHash vout = [CTxOut(0, CScript([OP_RETURN]))] unsigned_vin = [] for scriptSig, redeemScript in scripts: scriptPubKey = redeemScript.to_p2sh_scriptPubKey() txin = CTxIn(prevouts_by_scriptPubKey[scriptPubKey]) unsigned_vin.append(txin) unsigned_tx = CTransaction(unsigned_vin, vout) # Sign! signed_vin = [] for i, (scriptSig, redeemScript) in enumerate(scripts): sighash = SignatureHash(redeemScript, unsigned_tx, i, SIGHASH_NONE) sig = args.privkey.sign(sighash) + bytes([SIGHASH_NONE]) signed_scriptSig = CScript([sig] + list(scriptSig)) txin = CTxIn(unsigned_vin[i].prevout, signed_scriptSig) signed_vin.append(txin) signed_tx = CTransaction(signed_vin, vout) if args.dryrun: serialized_tx = signed_tx.serialize() logging.info('tx size: %d bytes' % len(serialized_tx)) logging.debug('hex: %s' % b2x(serialized_tx)) else: # FIXME: the tx could be too long here, but there's no way to get sendmany # to *not* broadcast the transaction first. This is a proof-of-concept, so # punting. logging.debug('Sending publish tx, hex: %s' % b2x(signed_tx.serialize())) txid = proxy.sendrawtransaction(signed_tx) logging.info('Sent publish tx: %s' % b2lx(txid)) python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/send-addrs-msg.py000077500000000000000000000030071430270607500260600ustar00rootroot00000000000000#!/usr/bin/env python3 import socket, time, bitcoin from bitcoin.messages import msg_version, msg_verack, msg_addr from bitcoin.net import CAddress PORT = 18333 bitcoin.SelectParams('testnet') def version_pkt(client_ip, server_ip): msg = msg_version() msg.nVersion = 70002 msg.addrTo.ip = server_ip msg.addrTo.port = PORT msg.addrFrom.ip = client_ip msg.addrFrom.port = PORT return msg def addr_pkt( str_addrs ): msg = msg_addr() addrs = [] for i in str_addrs: addr = CAddress() addr.port = 18333 addr.nTime = int(time.time()) addr.ip = i addrs.append( addr ) msg.addrs = addrs return msg s = socket.socket() server_ip = "192.168.0.149" client_ip = "192.168.0.13" s.connect( (server_ip,PORT) ) # Send Version packet s.send( version_pkt(client_ip, server_ip).to_bytes() ) # Get Version reply print(s.recv(1924)) # Send Verack s.send( msg_verack().to_bytes() ) # Get Verack print(s.recv(1024)) # Send Addrs s.send( addr_pkt(["252.11.1.2", "EEEE:7777:8888:AAAA::1"]).to_bytes() ) time.sleep(1) s.close() # debug log on the server should look like: # accepted connection 192.168.0.13:39979 # send version message: version 70002, blocks=317947, us=****, them=0.0.0.0:0, peer=192.168.0.13:39979 # receive version message: /pythonbitcoin0.0.1/: version 70002, blocks=-1, us=192.168.0.149:18333, them=192.168.0.13:18333, peer=192.168.0.13:39979 # Added 2 addresses from 192.168.0.13: 3 tried, 1706 new # disconnecting node 192.168.0.13:39979 python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/sign-message.py000077500000000000000000000043741430270607500256420ustar00rootroot00000000000000#!/usr/bin/env python3 # # Copyright (C) 2013-2015 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. from __future__ import absolute_import, division, print_function, unicode_literals from bitcoin.wallet import CBitcoinSecret, P2PKHBitcoinAddress from bitcoin.signmessage import BitcoinMessage, VerifyMessage, SignMessage def sign_message(key, msg): secret = CBitcoinSecret(key) message = BitcoinMessage(msg) return SignMessage(secret, message) def print_default(signature, key=None, msg=None): print(signature.decode('ascii')) def print_verbose(signature, key, msg): secret = CBitcoinSecret(key) address = P2PKHBitcoinAddress.from_pubkey(secret.pub) message = BitcoinMessage(msg) print('Address: %s' % address) print('Message: %s' % msg) print('Signature: %s' % signature) print('Verified: %s' % VerifyMessage(address, message, signature)) print('\nTo verify using bitcoin core:') print('\n`bitcoin-cli verifymessage %s \'%s\' \'%s\'`\n' % (address, signature.decode('ascii'), msg)) def parser(): import argparse parser = argparse.ArgumentParser( description='Sign a message with a private key.', epilog='Security warning: arguments may be visible to other users on the same host.') parser.add_argument( '-v', '--verbose', dest='print_result', action='store_const', const=print_verbose, default=print_default, help='verbose output') parser.add_argument( '-k', '--key', required=True, help='private key in base58 encoding') parser.add_argument( '-m', '--msg', required=True, help='message to sign') return parser if __name__ == '__main__': args = parser().parse_args() try: signature = sign_message(args.key, args.msg) except Exception as error: print('%s: %s' % (error.__class__.__name__, str(error))) exit(1) else: args.print_result(signature, args.key, args.msg) python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/spend-p2pkh-txout.py000077500000000000000000000057341430270607500265750ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Low-level example of how to spend a standard pay-to-pubkey-hash (P2PKH) txout""" import hashlib from bitcoin import SelectParams from bitcoin.core import b2x, lx, COIN, COutPoint, CMutableTxOut, CMutableTxIn, CMutableTransaction, Hash160 from bitcoin.core.script import CScript, OP_DUP, OP_HASH160, OP_EQUALVERIFY, OP_CHECKSIG, SignatureHash, SIGHASH_ALL from bitcoin.core.scripteval import VerifyScript, SCRIPT_VERIFY_P2SH from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret SelectParams('mainnet') # Create the (in)famous correct brainwallet secret key. h = hashlib.sha256(b'correct horse battery staple').digest() seckey = CBitcoinSecret.from_secret_bytes(h) # Same as the txid:vout the createrawtransaction RPC call requires # # lx() takes *little-endian* hex and converts it to bytes; in Bitcoin # transaction hashes are shown little-endian rather than the usual big-endian. # There's also a corresponding x() convenience function that takes big-endian # hex and converts it to bytes. txid = lx('7e195aa3de827814f172c362fcf838d92ba10e3f9fdd9c3ecaf79522b311b22d') vout = 0 # Create the txin structure, which includes the outpoint. The scriptSig # defaults to being empty. txin = CMutableTxIn(COutPoint(txid, vout)) # We also need the scriptPubKey of the output we're spending because # SignatureHash() replaces the transaction scriptSig's with it. # # Here we'll create that scriptPubKey from scratch using the pubkey that # corresponds to the secret key we generated above. txin_scriptPubKey = CScript([OP_DUP, OP_HASH160, Hash160(seckey.pub), OP_EQUALVERIFY, OP_CHECKSIG]) # Create the txout. This time we create the scriptPubKey from a Bitcoin # address. txout = CMutableTxOut(0.001*COIN, CBitcoinAddress('1C7zdTfnkzmr13HfA2vNm5SJYRK6nEKyq8').to_scriptPubKey()) # Create the unsigned transaction. tx = CMutableTransaction([txin], [txout]) # Calculate the signature hash for that transaction. sighash = SignatureHash(txin_scriptPubKey, tx, 0, SIGHASH_ALL) # Now sign it. We have to append the type of signature we want to the end, in # this case the usual SIGHASH_ALL. sig = seckey.sign(sighash) + bytes([SIGHASH_ALL]) # Set the scriptSig of our transaction input appropriately. txin.scriptSig = CScript([sig, seckey.pub]) # Verify the signature worked. This calls EvalScript() and actually executes # the opcodes in the scripts to see if everything worked out. If it doesn't an # exception will be raised. VerifyScript(txin.scriptSig, txin_scriptPubKey, tx, 0, (SCRIPT_VERIFY_P2SH,)) # Done! Print the transaction to standard output with the bytes-to-hex # function. print(b2x(tx.serialize())) python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/spend-p2sh-txout.py000077500000000000000000000073321430270607500264210ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Low-level example of how to spend a P2SH/BIP16 txout""" import hashlib from bitcoin import SelectParams from bitcoin.core import b2x, lx, COIN, COutPoint, CMutableTxOut, CMutableTxIn, CMutableTransaction, Hash160 from bitcoin.core.script import CScript, OP_DUP, OP_HASH160, OP_EQUALVERIFY, OP_CHECKSIG, SignatureHash, SIGHASH_ALL from bitcoin.core.scripteval import VerifyScript, SCRIPT_VERIFY_P2SH from bitcoin.wallet import CBitcoinAddress, CBitcoinSecret SelectParams('mainnet') # Create the (in)famous correct brainwallet secret key. h = hashlib.sha256(b'correct horse battery staple').digest() seckey = CBitcoinSecret.from_secret_bytes(h) # Create a redeemScript. Similar to a scriptPubKey the redeemScript must be # satisfied for the funds to be spent. txin_redeemScript = CScript([seckey.pub, OP_CHECKSIG]) print(b2x(txin_redeemScript)) # Create the magic P2SH scriptPubKey format from that redeemScript. You should # look at the CScript.to_p2sh_scriptPubKey() function in bitcoin.core.script to # understand what's happening, as well as read BIP16: # https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki txin_scriptPubKey = txin_redeemScript.to_p2sh_scriptPubKey() # Convert the P2SH scriptPubKey to a base58 Bitcoin address and print it. # You'll need to send some funds to it to create a txout to spend. txin_p2sh_address = CBitcoinAddress.from_scriptPubKey(txin_scriptPubKey) print('Pay to:',str(txin_p2sh_address)) # Same as the txid:vout the createrawtransaction RPC call requires # # lx() takes *little-endian* hex and converts it to bytes; in Bitcoin # transaction hashes are shown little-endian rather than the usual big-endian. # There's also a corresponding x() convenience function that takes big-endian # hex and converts it to bytes. txid = lx('bff785da9f8169f49be92fa95e31f0890c385bfb1bd24d6b94d7900057c617ae') vout = 0 # Create the txin structure, which includes the outpoint. The scriptSig # defaults to being empty. txin = CMutableTxIn(COutPoint(txid, vout)) # Create the txout. This time we create the scriptPubKey from a Bitcoin # address. txout = CMutableTxOut(0.0005*COIN, CBitcoinAddress('323uf9MgLaSn9T7vDaK1cGAZ2qpvYUuqSp').to_scriptPubKey()) # Create the unsigned transaction. tx = CMutableTransaction([txin], [txout]) # Calculate the signature hash for that transaction. Note how the script we use # is the redeemScript, not the scriptPubKey. That's because when the CHECKSIG # operation happens EvalScript() will be evaluating the redeemScript, so the # corresponding SignatureHash() function will use that same script when it # replaces the scriptSig in the transaction being hashed with the script being # executed. sighash = SignatureHash(txin_redeemScript, tx, 0, SIGHASH_ALL) # Now sign it. We have to append the type of signature we want to the end, in # this case the usual SIGHASH_ALL. sig = seckey.sign(sighash) + bytes([SIGHASH_ALL]) # Set the scriptSig of our transaction input appropriately. txin.scriptSig = CScript([sig, txin_redeemScript]) # Verify the signature worked. This calls EvalScript() and actually executes # the opcodes in the scripts to see if everything worked out. If it doesn't an # exception will be raised. VerifyScript(txin.scriptSig, txin_scriptPubKey, tx, 0, (SCRIPT_VERIFY_P2SH,)) # Done! Print the transaction to standard output with the bytes-to-hex # function. print(b2x(tx.serialize())) python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/spend-p2wpkh.py000077500000000000000000000101671430270607500255770ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2020 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Low-level example of how to spend a P2WPKH output.""" import sys import hashlib from bitcoin import SelectParams from bitcoin.core import b2x, b2lx, lx, COIN, COutPoint, CTxOut, CTxIn, CTxInWitness, CTxWitness, CScriptWitness, CMutableTransaction, Hash160 from bitcoin.core.script import CScript, OP_0, SignatureHash, SIGHASH_ALL, SIGVERSION_WITNESS_V0 from bitcoin.wallet import CBitcoinSecret, P2WPKHBitcoinAddress from bitcoin.rpc import Proxy SelectParams("regtest") connection = Proxy() if connection._call("getblockchaininfo")["chain"] != "regtest": sys.stderr.write("This example is intended for regtest only.\n") sys.exit(1) # Create the (in)famous correct brainwallet secret key. h = hashlib.sha256(b'correct horse battery staple').digest() seckey = CBitcoinSecret.from_secret_bytes(h) # Create an address from that private key. public_key = seckey.pub scriptPubKey = CScript([OP_0, Hash160(public_key)]) address = P2WPKHBitcoinAddress.from_scriptPubKey(scriptPubKey) # Give the private key to bitcoind (for ismine, listunspent, etc). connection._call("importprivkey", str(seckey)) # Check if there's any funds available. unspentness = lambda: connection._call("listunspent", 6, 9999, [str(address)], True, {"minimumAmount": 1.0}) unspents = unspentness() while len(unspents) == 0: # mine some funds into the address connection._call("generatetoaddress", 110, str(address)) unspents = unspentness() # Choose the first UTXO, let's spend it! unspent_utxo_details = unspents[0] txid = unspent_utxo_details["txid"] vout = unspent_utxo_details["vout"] amount = int(float(unspent_utxo_details["amount"]) * COIN) # Calculate an amount for the upcoming new UTXO. Set a high fee to bypass # bitcoind minfee setting. amount_less_fee = int(amount - (0.01 * COIN)) # Create a destination to send the coins. destination_address = connection._call("getnewaddress", "python-bitcoinlib-example", "bech32") destination_address = P2WPKHBitcoinAddress(destination_address) target_scriptPubKey = destination_address.to_scriptPubKey() # Create the unsigned transaction. txin = CTxIn(COutPoint(lx(txid), vout)) txout = CTxOut(amount_less_fee, target_scriptPubKey) tx = CMutableTransaction([txin], [txout]) # Specify which transaction input is going to be signed for. txin_index = 0 # When signing a P2WPKH transaction, use an "implicit" script that isn't # specified in the scriptPubKey or the witness. redeem_script = address.to_redeemScript() # Calculate the signature hash for the transaction. This is then signed by the # private key that controls the UTXO being spent here at this txin_index. sighash = SignatureHash(redeem_script, tx, txin_index, SIGHASH_ALL, amount=amount, sigversion=SIGVERSION_WITNESS_V0) signature = seckey.sign(sighash) + bytes([SIGHASH_ALL]) # Construct a witness for this transaction input. The public key is given in # the witness so that the appropriate redeem_script can be calculated by # anyone. The original scriptPubKey had only the Hash160 hash of the public # key, not the public key itself, and the redeem script can be entirely # re-constructed (from implicit template) if given just the public key. So the # public key is added to the witness. This is P2WPKH in bip141. witness = [signature, public_key] # Aggregate all of the witnesses together, and then assign them to the # transaction object. ctxinwitnesses = [CTxInWitness(CScriptWitness(witness))] tx.wit = CTxWitness(ctxinwitnesses) # Broadcast the transaction to the regtest network. spend_txid = connection.sendrawtransaction(tx) # Done! Print the transaction to standard output. Show the transaction # serialization in hex (instead of bytes), and render the txid. print("serialized transaction: {}".format(b2x(tx.serialize()))) print("txid: {}".format(b2lx(spend_txid))) python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/spend-p2wsh-txout.py000077500000000000000000000064711430270607500266130ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Low-level example of how to spend a P2WSH/BIP141 txout""" import hashlib from bitcoin import SelectParams from bitcoin.core import b2x, lx, COIN, COutPoint, CMutableTxOut, CMutableTxIn, CMutableTransaction, CTxInWitness, CTxWitness from bitcoin.core.script import CScript, CScriptWitness, OP_0, OP_CHECKSIG, SignatureHash, SIGHASH_ALL, SIGVERSION_WITNESS_V0 from bitcoin.wallet import CBitcoinSecret, CBitcoinAddress, P2WSHBitcoinAddress SelectParams('testnet') # Create the (in)famous correct brainwallet secret key. h = hashlib.sha256(b'correct horse battery staple').digest() seckey = CBitcoinSecret.from_secret_bytes(h) # Create a witnessScript and corresponding redeemScript. Similar to a scriptPubKey # the redeemScript must be satisfied for the funds to be spent. txin_redeemScript = CScript([seckey.pub, OP_CHECKSIG]) txin_scriptHash = hashlib.sha256(txin_redeemScript).digest() txin_scriptPubKey = CScript([OP_0, txin_scriptHash]) # Convert the P2WSH scriptPubKey to a base58 Bitcoin address and print it. # You'll need to send some funds to it to create a txout to spend. txin_p2wsh_address = P2WSHBitcoinAddress.from_scriptPubKey(txin_scriptPubKey) print('Pay to:', str(txin_p2wsh_address)) # Same as the txid:vout the createrawtransaction RPC call requires # lx() takes *little-endian* hex and converts it to bytes; in Bitcoin # transaction hashes are shown little-endian rather than the usual big-endian. txid = lx('ace9dc7c987a52266e38fe8544c2d12182401341c98d151f4b394cf69aa5c3e5') vout = 0 # Specify the amount send to your P2WSH address. amount = int(0.0001 * COIN) # Calculate an amount for the upcoming new UTXO. Set a high fee (5%) to bypass # bitcoind minfee setting. amount_less_fee = amount * 0.95 # Create the txin structure, which includes the outpoint. The scriptSig # defaults to being empty as is necessary for spending a P2WSH output. txin = CMutableTxIn(COutPoint(txid, vout)) # Specify a destination address and create the txout. destination_address = CBitcoinAddress( '2NGZrVvZG92qGYqzTLjCAewvPZ7JE8S8VxE').to_scriptPubKey() txout = CMutableTxOut(amount_less_fee, destination_address) # Create the unsigned transaction. tx = CMutableTransaction([txin], [txout]) # Calculate the signature hash for that transaction. sighash = SignatureHash(script=txin_redeemScript, txTo=tx, inIdx=0, hashtype=SIGHASH_ALL, amount=amount, sigversion=SIGVERSION_WITNESS_V0) # Now sign it. We have to append the type of signature we want to the end, in # this case the usual SIGHASH_ALL. sig = seckey.sign(sighash) + bytes([SIGHASH_ALL]) # # Construct a witness for this P2WSH transaction and add to tx. witness = CScriptWitness([sig, txin_redeemScript]) tx.wit = CTxWitness([CTxInWitness(witness)]) # TODO: upgrade VerifyScript to support Segregated Witness and place verify the witness program here. # Done! Print the transaction to standard output with the bytes-to-hex # function. print(b2x(tx.serialize())) python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/ssl-rpc-connection.py000077500000000000000000000021601430270607500267670ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. ## Instructions # This sets up SSL on a localhost connection. Not terribly useful but it will be iterated on. # Linux: cd ~/.bitcoin # Mac: cd ~/Library/Application\ Support/Bitcoin/ # openssl genrsa -out server.pem 2048 # openssl req -new -x509 -nodes -sha256 -days 3650 -key server.pem > server.cert # The prompts are optional, you can just hit enter # Verify that your bitcoin.conf exists in the above directory and contains the following lines: # server=1 # rpcssl=1 # rpcuser=CHANGETHIS # rpcpassword=CHANGETHAT # rpcsslciphers=TLSv1_2 # rpcsslprivatekeyfile=server.pem # rpcsslcertificatechainfile=server.cert import bitcoin.rpc proxy_connection = bitcoin.rpc.Proxy() print(proxy_connection.getnewaddress()) python-bitcoinlib-python-bitcoinlib-v0.11.2/examples/timestamp-op-ret.py000077500000000000000000000037551430270607500264710ustar00rootroot00000000000000#!/usr/bin/env python3 # Copyright (C) 2014 The python-bitcoinlib developers # # This file is part of python-bitcoinlib. # # It is subject to the license terms in the LICENSE file found in the top-level # directory of this distribution. # # No part of python-bitcoinlib, including this file, may be copied, modified, # propagated, or distributed except according to the terms contained in the # LICENSE file. """Example of timestamping a file via OP_RETURN""" import bitcoin.rpc import sys from bitcoin import params from bitcoin.core import * from bitcoin.core.script import * proxy = bitcoin.rpc.Proxy() assert len(sys.argv) > 1 digests = [] for f in sys.argv[1:]: try: with open(f, 'rb') as fd: digests.append(Hash(fd.read())) except FileNotFoundError as exp: if len(f)/2 in (20, 32): digests.append(x(f)) else: raise exp except IOError as exp: print(exp, file=sys.stderr) continue for digest in digests: txouts = [] unspent = sorted(proxy.listunspent(0), key=lambda x: hash(x['amount'])) txins = [CTxIn(unspent[-1]['outpoint'])] value_in = unspent[-1]['amount'] change_addr = proxy.getnewaddress() change_pubkey = proxy.validateaddress(change_addr)['pubkey'] change_out = CMutableTxOut(params.MAX_MONEY, CScript([change_pubkey, OP_CHECKSIG])) digest_outs = [CMutableTxOut(0, CScript([OP_RETURN, digest]))] txouts = [change_out] + digest_outs tx = CMutableTransaction(txins, txouts) FEE_PER_BYTE = 0.00025*COIN/1000 while True: tx.vout[0].nValue = int(value_in - max(len(tx.serialize()) * FEE_PER_BYTE, 0.00011*COIN)) r = proxy.signrawtransaction(tx) assert r['complete'] tx = r['tx'] if value_in - tx.vout[0].nValue >= len(tx.serialize()) * FEE_PER_BYTE: print(b2x(tx.serialize())) print(len(tx.serialize()), 'bytes', file=sys.stderr) print(b2lx(proxy.sendrawtransaction(tx))) break python-bitcoinlib-python-bitcoinlib-v0.11.2/release-notes.md000066400000000000000000000162511430270607500241520ustar00rootroot00000000000000# python-bitcoinlib release notes ## v0.11.2 * Fixed one remaining use of OpenSSL for RIPEMD-160 ## v0.11.1 * Pure-python RIPEMD-160, for newer versions of OpenSSL without RIPEMD-160 support. * Signet support ## v0.11.0 * Bech32 implementation * Segwit implementation (for P2WSH and P2WPKH transactions) and examples * Use libsecp256k1 for signing * Implement OP_CHECKSEQUENCEVERIFY New maintainer: Bryan Bishop ## v0.10.2 Note: this will be the last release of python-bitcoinlib with Python 2.7 compatibility. * New RPC `generatetoaddress(self,numblocks,addr)`. * Fixed Python 2.7 incompatibility. * Various OpenSSL fixes, including a memory leak. ## v0.10.1 Identical in every way to v0.10.0, but re-uploaded under a new version to fix a PyPi issue. ## v0.10.0 Minor breaking change: RPC port for regtest updated to the new v0.16.0 default. Other changes: * Now looks for `.cookie` files in the datadir, if specified. * Authentication in a RPC `service_url` is now parsed. * Implemented bip-0037 version message. * `contrib/verify-commits/` removed for now due to breakage. ## v0.9.0 Now supports segwit, which breaks the API in minor ways from v0.8.0. This version introduces lots of new API functionality related to this, such as the new `CScriptWitness`, `CTxInWitness`, `CTxWitness`, new segwit-specific logic in `SignatureHash()` etc. ## v0.8.0 Major breaking API change! While this interim release doesn't by itself include segwit support, it does change the name of the `CTransaction/CMutableTransaction` method `GetHash()` to `GetTxid()` to prepare for a future segwit-enabled release. Incorrect calls to `GetHash()` will now raise a `AttributeError` exception with an explanation. Since this release doesn't yet include segwit support, you will need to set the Bitcoin Core `-rpcserialversion=0` option, either as a command line argument, or in your `bitcoin.conf` file. Otherwise the RPC interface will return segwit-serialized transactions that this release's RPC support doesn't understand. Other changes: * Cookie file RPC authentication is now supported. * `msg_header` now correctly uses `CBlockHeader` rather than `CBlock`. * RPC `getbalance` now supports `include_watchonly` * RPC `unlockwallet` is now supported ## v0.7.0 Breaking API changes: * The 'cooked' CScript iterator now returns `OP_0` for the empty binary string rather than `b''` * The alias `JSONRPCException = JSONRPCError` has been removed. This alias was added for compatibility with v0.4.0 of python-bitcoinlib. * Where appropriate, `RPC_INVALID_ADDRESS_OR_KEY` errors are now caught properly, which means that rather than raising `IndexError`, RPC commands such as `getblock` may raise `JSONRPCError` instead. For instance during initial startup previously python-bitcoinlib would incorrectly raise `IndexError` rather than letting the callee know that RPC was unusable. Along those lines, `JSONRPCError` subclasses have been added for some (but not all!) of the types of RPC errors Bitcoin Core returns. Bugfixes: * Fixed a spurious `AttributeError` when `bitcoin.rpc.Proxy()` fails. ## v0.6.1 New features: * getblockheader RPC call now supports the verbose option; there's no other way to get the block height, among other things, from the RPC interface. * subtoaddress and sendmany RPC calls now support comment and subtractfeefromamount arguments. ## v0.6.0 Breaking API changes: * RPC over SSL support removed to match Bitcoin Core's removal of RPC SSL support in v0.12.0 If you need this, use an alternative such as a stunnel or a SSH tunnel. * Removed SCRIPT_VERIFY constants ``bitcoin.core.script``, leaving just the constants in ``bitcoin.core.scripteval``; being singletons the redundant constants were broken anyway. * SCRIPT_VERIFY_EVEN_S renamed to SCRIPT_VERIFY_LOW_S to match Bitcoin Core's naming * SCRIPT_VERIFY_NOCACHE removed as Bitcoin Core no longer has it (and we never did anything with it anyway) ## v0.5.1 Various small bugfixes; see git history. New features: * New RPC calls: fundrawtransaction, generate, getblockheader * OP_CHECKLOCKTIMEVERIFY opcode constant ## v0.5.0 Major fix: Fixed OpenSSL related crashes on OSX and Arch Linux. Big thanks to everyone who helped fix this! Breaking API changes: * Proxy no longer has ``__getattr__`` to support arbitrary methods. Use RawProxy or Proxy.call instead. This allows new wrappers to be added safely. See docstrings for details. New features: * New RPC calls: getbestblockhash, getblockcount, getmininginfo * Signing and verification of Bitcoin Core compatible messages. (w/ pubkey recovery) * Tox tests * Sphinx docs Notable bugfixes: * getinfo() now works where disablewallet=1 ## v0.4.0 Major fix: OpenSSL 1.0.1k rejects non-canonical DER signatures, which Bitcoin Core does not, so we now canonicalize signatures prior to passing them to OpenSSL. Secondly we now only generate low-S DER signatures as per BIP62. API changes that might break compatibility with existing code: * MAX_MONEY is now a core chain parameter * MainParams now inherits from CoreMainParams rather than CoreChainParams * str() now returns hash:n format; previously was same as repr() * RawProxy() no longer has _connection parameter Notable bugfixes: * MsgSerializable.to_bytes() no longer clobbers testnet params * HTTPS RPC connections now use port 443 as default * No longer assumes bitcoin.conf specifes rpcuser New features: * New RPC calls: dumpprivkey, importaddress * Added P2P support for msg_notfound and msg_reject * Added support for IPv6 addr messages ## v0.3.0 Major change: cleaned up what symbols are exported by modules. \_\_all\_\_ is now used extensively, which may break some applications that were not importing the right modules. Along those lines some implementation details like the ssl attribute of the bitcoin.core.key module, and the entire bitcoin.core.bignum module, are no longer part of the public API. This should not affect too many users, but it will break some code. Other notable changes: * New getreceivedbyaddress RPC call. * Fixed getbalance RPC call when wallet is configured off. * Various code cleanups and minor bug fixes. ## v0.2.1 * Improve bitcoin address handling. P2SH and P2PKH addresses now get their own classes - P2SHBitcoinAddress and P2PKHBitcoinAddress respectively - and P2PKH can now convert scriptPubKeys containing non-canonical pushes as well as bare checksig to addresses. * .deserialize() methods now fail if there is extra data left over. * Various other small bugfixes. * License is now LGPL v3 or later. ## v0.2.0 Major change: CTransaction, CBlock, etc. now come in immutable (default) and mutable forms. In most cases mutable and immutable can be used interchangeably; when that is not possible methods are provided to create new (im)mutable objects from (im)mutable ones efficiently. Other changes: * New BIP70 payment protocol example. (Derren Desouza) * Rework of message serialization. Note that this may not represent the final form of P2P support, which is still in flux. (Florian Schmaus) * Various bugfixes Finally starting this release, git tags will be of the form 'python-bitcoinlib-(version)', replacing the less specific '(version)' form previously used. python-bitcoinlib-python-bitcoinlib-v0.11.2/runtests.sh000077500000000000000000000003141430270607500233010ustar00rootroot00000000000000#!/usr/bin/env sh #-*-mode: sh; encoding: utf-8-*- _MY_DIR="$( cd "$( dirname "${0}" )" && pwd )" set -ex [ -d "${_MY_DIR}" ] [ "${_MY_DIR}/runtests.sh" -ef "${0}" ] cd "${_MY_DIR}" exec tox ${1+"${@}"} python-bitcoinlib-python-bitcoinlib-v0.11.2/setup.py000077500000000000000000000015111430270607500225700ustar00rootroot00000000000000#!/usr/bin/env python3 from setuptools import setup, find_packages import os from bitcoin import __version__ here = os.path.abspath(os.path.dirname(__file__)) with open(os.path.join(here, 'README.md')) as f: README = f.read() requires = [] setup(name='python-bitcoinlib', version=__version__, description='The Swiss Army Knife of the Bitcoin protocol.', long_description=README, long_description_content_type='text/markdown', classifiers=[ "Programming Language :: Python", "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", ], url='https://github.com/petertodd/python-bitcoinlib', keywords='bitcoin', packages=find_packages(), zip_safe=False, install_requires=requires, test_suite="bitcoin.tests" ) python-bitcoinlib-python-bitcoinlib-v0.11.2/tox.ini000066400000000000000000000012541430270607500223720ustar00rootroot00000000000000#-*-mode: ini; encoding: utf-8-*- [tox] #------------------------------------------------------------------- envlist = reset,py34,py35,py36,py37,py38,py39,pypy3,stats skip_missing_interpreters = True [testenv] #--------------------------------------------------------------- commands = coverage run --append --omit='tests/*,*/site-packages/*,*/distutils/*,*/lib_pypy/*' setup.py test -q deps = coverage setenv = PYTHONWARNINGS = all [testenv:reset] #--------------------------------------------------------- commands = coverage erase [testenv:stats] #--------------------------------------------------------- commands = coverage report coverage html