0

Having transaction sent from Metamask (ropsten network): 0xddd70e7d8dbd3cf5c0618501911b045464ae2087bd537aa538f34b8c9600dcc7

I'm watching transactions in new blocks using golang, and when tx match given criteria (addresses), I need to get tx fee also. For legacy (type 0) everything works correct and GasPrice() is equal with Etherscan. But when I'am sending tx from Metamask (tx type 2), GasPrice is different than on Etherscan.

For this transaction GasPrice returns 5226915100.

I'm working with transactions by looping them inside block

for _, t := range block.Transactions() {
    log.Print(t.GasPrice)
}

Multiplying Etherscan data: GasPrice (4369862964) * GasUsed (21000) leads to correct Etherscan fee data. Multiplying my received data leading to wrong fee. I suggest that problem is in burning fees, but cannot figure out how to calculate correct fee.

1 Answer 1

0

You need to use EffectiveGasPrice from transaction receipt (rpc eth_getTransactionReceipt)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.