Sign data hash with local private key
(self, data: bytes, v: int = 27)
| 90 | self.address = self.private_key.public_key.to_canonical_address() |
| 91 | |
| 92 | def sign(self, data: bytes, v: int = 27) -> Signature: |
| 93 | """Sign data hash with local private key""" |
| 94 | assert v in (0, 27), "Raiden is only signing messages with v in (0, 27)" |
| 95 | _hash = eth_sign_sha3(data) |
| 96 | signature = self.private_key.sign_msg_hash(message_hash=_hash) |
| 97 | sig_bytes = signature.to_bytes() |
| 98 | # adjust last byte to v |
| 99 | return sig_bytes[:-1] + bytes([sig_bytes[-1] + v]) |