Exemplo n.º 1
0
 def id(self) -> str:
     """
     The ID will be the hash SHA256 of all the txins and txouts.
     """
     msg = self.serialize().hex().encode()
     tx_id = sha256d(msg)
     return tx_id
Exemplo n.º 2
0
    def id(self) -> str:
        txns_ids = "".join(map(lambda t: t.id, self.txns))

        string_to_hash = (str(self.height) + str(self.miner) +
                          str(self.version) + str(self.prev_block_hash) +
                          str(self.timestamp) + str(self.bits.hex()) +
                          str(self.nonce) + str(txns_ids))

        block_id = sha256d(string_to_hash)
        return block_id
Exemplo n.º 3
0
    def id(self) -> str:
        txns_ids = ""
        for t in self.txns:
            txns_ids = txns_ids + t.id

        string_to_hash = (str(self.version) + str(self.prev_block_hash) +
                          str(self.timestamp) + str(self.bits) +
                          str(self.nonce) + str(txns_ids))

        block_id = sha256d(string_to_hash)
        return block_id
Exemplo n.º 4
0
    def id(self) -> str:
        """
        The ID will be the hash SHA256 of all the txins and txouts.
        """
        msg = ""
        for x in self.txins:
            msg = msg + x.serialize()
        for y in self.txouts:
            msg = msg + y.serialize()

        tx_id = sha256d(msg)
        return tx_id
Exemplo n.º 5
0
def build_message(outpoint, pub_key: str) -> str:
    """
    TODO: https://bitcoin.stackexchange.com/questions/37093/what-goes-in-to-the-message-of-a-transaction-signature
    """
    return sha256d(str(outpoint.txid) + str(outpoint.txout_idx) + pub_key)