def multisig_script(public_keys, m=None): """Create a multisig redeeming script. Args: public_keys (list): List of hex-encoded public keys. m: Number of required signers. Returns: Hex-encoded redeem script. """ n = len(public_keys) if m is None: m = n s = [] # 0x50 + m s.append("".join(["5", hex(m)[-1]])) for k in public_keys: s.append(op_push(len(k) / 2)) s.append(k) # 0x50 + n s.append("".join(["5", hex(n)[-1]])) s.append("ae") return "".join(s)
def multisig_script(public_keys, m=None): """Create a multisig redeeming script. Args: public_keys (list): List of hex-encoded public keys. m: Number of required signers. Returns: Hex-encoded redeem script. """ n = len(public_keys) if m is None: m = n s = [] # 0x50 + m s.append(''.join(['5', hex(m)[-1]])) for k in public_keys: s.append(op_push(len(k) / 2)) s.append(k) # 0x50 + n s.append(''.join(['5', hex(n)[-1]])) s.append('ae') return ''.join(s)
"""Bitcoin scripting language.""" from util_coin import op_push push_script = lambda x: op_push(len(x) / 2) + x # # Workalike python implementation of Bitcoin's CDataStream class. # import struct import StringIO import mmap import random NO_SIGNATURE = "ff" class SerializationError(Exception): """ Thrown when there's a problem deserializing or serializing """ class BCDataStream(object): def __init__(self): self.input = None self.read_cursor = 0 def clear(self): self.input = None self.read_cursor = 0 def write(self, bytes): # Initialize with string of bytes if self.input is None:
def op_push(i): """Deprecated.""" return util_coin.op_push(i)
"""Bitcoin scripting language.""" from util_coin import op_push push_script = lambda x: op_push(len(x) / 2) + x # # Workalike python implementation of Bitcoin's CDataStream class. # import struct import StringIO import mmap import random NO_SIGNATURE = 'ff' class SerializationError(Exception): """ Thrown when there's a problem deserializing or serializing """ class BCDataStream(object): def __init__(self): self.input = None self.read_cursor = 0 def clear(self): self.input = None self.read_cursor = 0 def write(self, bytes): # Initialize with string of bytes if self.input is None: self.input = bytes