# tx.py

# An Input
# { prevTransHash: [somehash], index: [someindex] }

# An Output
# { address: [someaddress], amount: [someamount], pubkey: [] }

from coil import chash

def createInput(transaction, index):
    return { 
        "prevTransHash": transaction.hash(),
        "index": index
    }

def createOutput(address, amount):
    return {
        "address": address,
        "amount": amount
    }

class Transaction(object):
    def __init__(self, address, inputs, outputs, publicKey):
        self.address = address
        self.inputs = inputs
        self.outputs = outputs
        self.publicKey = publicKey

    def sign(self, sig):
        self.signature = sig

    def hash(self):
        h = dict(self.__dict__)
        del h["address"]
        # del h["signature"]
        return chash.doubleHashEncodeJSON(self.__dict__)

class Coinbase(Transaction):
    def __init__(self, minerAddress, minerPubKey, amount=50):
        # Base reward for mining a block
        # is 50 coilcoins (no fees)
        inputs = []
        outputs = [createOutput(minerAddress, amount)]

        super(Coinbase, self).__init__(minerAddress, inputs, outputs, minerPubKey)
a6464fce3f8ad7ee67626a790403dbd7c5f92e58
<mask token>


class Coinbase(Transaction):

    def __init__(self, minerAddress, minerPubKey, amount=50):
        inputs = []
        outputs = [createOutput(minerAddress, amount)]
        super(Coinbase, self).__init__(minerAddress, inputs, outputs,
            minerPubKey)

<mask token>


class Transaction(object):
    <mask token>

    def sign(self, sig):
        self.signature = sig

    def hash(self):
        h = dict(self.__dict__)
        del h['address']
        return chash.doubleHashEncodeJSON(self.__dict__)


class Coinbase(Transaction):

    def __init__(self, minerAddress, minerPubKey, amount=50):
        inputs = []
        outputs = [createOutput(minerAddress, amount)]
        super(Coinbase, self).__init__(minerAddress, inputs, outputs,
            minerPubKey)

<mask token>


def createInput(transaction, index):
    return {'prevTransHash': transaction.hash(), 'index': index}


def createOutput(address, amount):
    return {'address': address, 'amount': amount}


class Transaction(object):

    def __init__(self, address, inputs, outputs, publicKey):
        self.address = address
        self.inputs = inputs
        self.outputs = outputs
        self.publicKey = publicKey

    def sign(self, sig):
        self.signature = sig

    def hash(self):
        h = dict(self.__dict__)
        del h['address']
        return chash.doubleHashEncodeJSON(self.__dict__)


class Coinbase(Transaction):

    def __init__(self, minerAddress, minerPubKey, amount=50):
        inputs = []
        outputs = [createOutput(minerAddress, amount)]
        super(Coinbase, self).__init__(minerAddress, inputs, outputs,
            minerPubKey)

from coil import chash


def createInput(transaction, index):
    return {'prevTransHash': transaction.hash(), 'index': index}


def createOutput(address, amount):
    return {'address': address, 'amount': amount}


class Transaction(object):

    def __init__(self, address, inputs, outputs, publicKey):
        self.address = address
        self.inputs = inputs
        self.outputs = outputs
        self.publicKey = publicKey

    def sign(self, sig):
        self.signature = sig

    def hash(self):
        h = dict(self.__dict__)
        del h['address']
        return chash.doubleHashEncodeJSON(self.__dict__)


class Coinbase(Transaction):

    def __init__(self, minerAddress, minerPubKey, amount=50):
        inputs = []
        outputs = [createOutput(minerAddress, amount)]
        super(Coinbase, self).__init__(minerAddress, inputs, outputs,
            minerPubKey)

# tx.py

# An Input
# { prevTransHash: [somehash], index: [someindex] }

# An Output
# { address: [someaddress], amount: [someamount], pubkey: [] }

from coil import chash

def createInput(transaction, index):
    return { 
        "prevTransHash": transaction.hash(),
        "index": index
    }

def createOutput(address, amount):
    return {
        "address": address,
        "amount": amount
    }

class Transaction(object):
    def __init__(self, address, inputs, outputs, publicKey):
        self.address = address
        self.inputs = inputs
        self.outputs = outputs
        self.publicKey = publicKey

    def sign(self, sig):
        self.signature = sig

    def hash(self):
        h = dict(self.__dict__)
        del h["address"]
        # del h["signature"]
        return chash.doubleHashEncodeJSON(self.__dict__)

class Coinbase(Transaction):
    def __init__(self, minerAddress, minerPubKey, amount=50):
        # Base reward for mining a block
        # is 50 coilcoins (no fees)
        inputs = []
        outputs = [createOutput(minerAddress, amount)]

        super(Coinbase, self).__init__(minerAddress, inputs, outputs, minerPubKey)