def header(self):
        """ Computes the full header string of a block after mining (includes the seal).

        Returns:
            str: String representation of the block header.
        """
        return encode_as_str([self.unsealed_header(), self.seal_data], sep='`')
Example #2
0
 def header(self):
     """ Get string encoding of a transaction's header. """
     return encode_as_str([
         ";".join(self.input_refs), ";".join(
             [str(out) for out in self.outputs])
     ],
                          sep="-")
Example #3
0
    def __repr__(self):
        """ Get a full representation of a block as string, for debugging purposes; includes all transactions.

        Returns:
            str: Full and unique representation of a block and its transactions.
        """
        return encode_as_str([self.header(), "!".join([str(tx) for tx in self.transactions])], sep="`")
Example #4
0
    def unsealed_header(self):
        """ Computes the header string of a block (the component that is sealed by mining).

        Returns:
            str: String representation of the block header without the seal.
        """
        return encode_as_str([self.height, self.timestamp, self.target, self.parent_hash, self.is_genesis, self.merkle], sep='`')
Example #5
0
 def __repr__(self):
     """ Get unique string encoding of a transaction, including its hash (ID). """
     return encode_as_str([self.hash, self.header()], sep="-")
Example #6
0
 def __repr__(self):
     """ Gets unique string representation of an output. """
     return encode_as_str([self.sender, self.receiver, self.amount],
                          sep="~")