def sign(self, key): """Sign this transaction with a private key. A potentially already existing signature would be overridden. """ rawhash = utils.sha3(rlp.encode(self, UnsignedTransaction)) self.v, self.r, self.s = ecdsa_raw_sign(rawhash, key) self.sender = utils.privtoaddr(key) return self
def sign(self, key): """Sign this transaction with a private key. A potentially already existing signature would be overridden. """ if key in (0, '', '\x00' * 32): raise InvalidTransaction("Zero privkey cannot sign") rawhash = utils.sha3(rlp.encode(self, UnsignedTransaction)) self.v, self.r, self.s = ecdsa_raw_sign(rawhash, key) self.sender = utils.privtoaddr(key) return self
def sign(self, privkey): """Sign this with a private key""" if self.v: raise InvalidSignature("already signed") if privkey in (0, '', '\x00' * 32): raise InvalidSignature("Zero privkey cannot sign") rawhash = sha3(rlp.encode(self, self.__class__.exclude(['v', 'r', 's']))) self.v, self.r, self.s = ecdsa_raw_sign(rawhash, privkey) self._sender = None return self
def make_ticket(privkey, value): value_enc = utils.zpad(utils.encode_int(value), 32) h = utils.sha3(value_enc) v, r, s = ecdsa_raw_sign(h, privkey) return (value, v, r, s)
def ecdsa_sign(message, privkey): s = _encode_sig(*ecdsa_raw_sign(message, privkey)) return s