def sign( self, holder: int, privKey: PrivateKey ) -> None: self.holder = holder self.signature = privKey.sign(self.signatureSerialize())
def mine( self, privKey: PrivateKey, difficulty: int ) -> None: self.header.proof = -1 while ( (self.header.proof == -1) or ((int.from_bytes(self.header.hash, "big") * difficulty) > int.from_bytes(bytes.fromhex("FF" * 32), "big")) ): self.header.proof += 1 self.header.hash = RandomX(self.header.serializeHash()) self.header.signature = privKey.sign(self.header.hash).serialize() self.header.hash = RandomX(self.header.hash + self.header.signature)