Closed mushketyk closed 5 years ago
I'd have to look deeper, but if I have to make a guess, it'd have something to do either with the fields in rawTx
(from
and privateFor
are not taken into account in the Tx
class), or chainId
. Can you try to incrementally go from a rawTx
that outputs the correct hash to the rawTx
you want to pinpoint what's causing the problem?
@s1na Thank you for looking into this. The problem now is that I can't get a rawTx
that would generate a correct hash. I would try to remove the from
and privateFor
and see if this works.
@s1na I've tried removing from
and privateFor
from the rawTx
, but it didn't help.
Here is how I get the chain id:
web3.eth.net.getId()
I think the answer to this is described in this paragraph from the Quorum documentation:
Private Transactions, however, are not executed per standard Ethereum: prior to the sender's Quorum Node propagating the Transaction to the rest of the network, it replaces the original Transaction Payload with a hash of the encrypted Payload that it receives from Constellation/Tessera. Participants that are party to the Transaction will be able to replace the hash with the actual payload via their Constellation/Tessera instance, whilst those Participants that are not party will only see the hash.
So it seems that Quorum replaces the body of the transaction with the hash, and it seems that it hashes the result transaction.
@mushketyk Thanks for clarifying, will close.
I've created an issue in the Quorum repo here: https://github.com/jpmorganchase/quorum/issues/657
I am trying to calculate a hash of a private Quorum transaction locally, without relying on a hash returned by
web3
. I've managed to do this for (locally) signed transactions, but I can't makeTx
class to return correct hash for an unsigned private transaction.Here is the code that I am using:
Where
rawTx
is the following object:I get the following hash for this transaction:
but the actual hash of the transaction returned by web3 is the following:
I've also looked at Quorum source code that calculates transaction hashes (1, 2) but I could not find any discrepancies between how Quorum calculates transaction hash and how
ethereumjs-tx
does it.