Closed allush closed 1 year ago
This code works fine:
func (tx *Transaction) From() common.Address {
return tx.from.Load().(sigCache).from
}
But this is a patch candidate to go-ethereum library
@allush use l2tx, err := zp.GetTransaction(txHash)
instead zp.GetClient().TransactionByHash(txHash)
And you can get
from := l2tx.From
Because when you use TransactionByHash
by default, go-ethereum will replace the sender in there
https://github.com/ethereum/go-ethereum/blob/699243f8ae870fa2ddbc5cb919fda85313e4684a/ethclient/ethclient.go#L238
The actual json.From
is not you when sending this tx from L2 to L1
zp.GetClient() returns instance of ethclient.Client which should be used internally because some of the RPC method are not compatible with zkSync node. That's why it will be removed in future releases because it introduces a lot of confusions among users.
ok, thanks @danijelTxFusion @tiennampham23
There is transaction on ZkSync Era https://explorer.zksync.io/tx/0x197058ca77d906d883f75c1a720b414142092b27862f344044411b7268c7169e
Library returns incorrect sender address for this transaction -
0x120982a08B06f31583c10F0383a2C3aa46f06606
Actual sender address is
0xBB4ddF60b4013B10E7D1709DED7f4B8A81398073
Code for reproduce
How to get actual sender address?