Exemplo n.º 1
0
def signOrder(orderHash, private_key):
    key = normalize_key(private_key.to_hex())
    v, r, s = ecsign(
        sha3("\x19Ethereum Signed Message:\n32".encode('utf-8') + orderHash),
        key)
    return "0x" + v.to_bytes(1, "big").hex() + (
        zpad(bytearray_to_bytestr(int_to_32bytearray(r)), 32) +
        zpad(bytearray_to_bytestr(int_to_32bytearray(s)), 32)).hex() + "03"
Exemplo n.º 2
0
def signHash(hash, private_key):
    key = normalize_key(private_key.to_hex())
    v, r, s = ecsign(sha3("\x19Ethereum Signed Message:\n32".encode('utf-8') + hash), key)
    return zpad(bytearray_to_bytestr(int_to_32bytearray(r)), 32), zpad(bytearray_to_bytestr(int_to_32bytearray(s)), 32), v
Exemplo n.º 3
0
def createOrder(orderHash):
    key = normalize_key('0x0000000000000000000000000000000000000000000000000000000000000001')
    v, r, s = ecsign(sha3("\x19Ethereum Signed Message:\n32".encode('utf-8') + orderHash), key)
    return v, zpad(bytearray_to_bytestr(int_to_32bytearray(r)), 32), zpad(bytearray_to_bytestr(int_to_32bytearray(s)), 32)