Exemplo n.º 1
0
    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
Exemplo n.º 2
0
    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
Exemplo n.º 3
0
    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
Exemplo n.º 4
0
    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
Exemplo n.º 5
0
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)
Exemplo n.º 6
0
def ecdsa_sign(message, privkey):
    s = _encode_sig(*ecdsa_raw_sign(message, privkey))
    return s
Exemplo n.º 7
0
def ecdsa_sign(message, privkey):
    s = _encode_sig(*ecdsa_raw_sign(message, privkey))
    return s
Exemplo n.º 8
0
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)