I'm trying to retrieve the ethereum address from the transaction signature. I have got the following transaction:
{
blockHash: "0x82388a80a654586ec646115ae63a664e594e0e34dd6fb20dcf078d9495788578",
blockNumber: 4311,
from: "0x6825487b18c45c507d06b44ec2ba5b5bf3925f23",
gas: 4712388,
gasPrice: 100000000000,
hash: "0x0fe0a5142f41e516f55017c03c173ea59382f7554a4d3e9efabd12b35734da32",
input: "0xfdacd5760000000000000000000000000000000000000000000000000000000000000002",
nonce: 249,
r: "0x5897c2c7c7412b0a555fb6f053ddb6047c59666bbebc6f5573134e074992d841",
s: "0x1c71d1c62b74caff8695a186e2a24dd701070ba9946748318135e3ac0950b1d4",
to: "0xccfaed4390d5e757476f657bf96146570126188d",
transactionIndex: 0,
v: "0xa96",
value: 0
}
Following Ethereum yellow paper I would have to do the following to retrieve the from address 0x6825487b18c45c507d06b44ec2ba5b5bf3925f23:
S(T) ≡ B 96..255(KEC(ECDSARECOVER(h(T), Tw ,Tr ,Ts))))
Where the values in my case is (Python code):
Tw = long("1c",16)
Tr = long("5897c2c7c7412b0a555fb6f053ddb6047c59666bbebc6f5573134e074992d841",16)
Ts = long("1c71d1c62b74caff8695a186e2a24dd701070ba9946748318135e3ac0950b1d4",16)
Thash = long("0fe0a5142f41e516f55017c03c173ea59382f7554a4d3e9efabd12b35734da32",16)
Then:
x,y=ecdsa_raw_recover(bin(Thash), (v, r, s))
k = sha3.keccak_256()
k.update(str(x)+str(y))
k.hexdigest()
But I'm getting 8485031e62b6cf0ea13a32580e00b8ce77d614443f1a14a1f1495cfc48e985a7 instead of 6825487b18c45c507d06b44ec2ba5b5bf3925f23.
Anyone knows what am I doing wrong? I don't know if I'm missing some convertion or something like that.
Thanks in advance.
Best regards, Albert.