Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Transaction Hash collisions when using different From Addresses #547

Closed
eyezick opened this issue Jun 28, 2018 · 4 comments

Comments

@eyezick
Copy link

commented Jun 28, 2018

Expected Behavior

All mined transactions should produce a unique transaction hash that should not repeat in the same blockchain.

Current Behavior

Making simple ETH transfer transactions with the same to address,nonce and value produce the same transaction hashes regardless of what the "from" address is.

Possible Solution

Incorporate the from address to the transaction hashing function.

Steps to Reproduce (for bugs)

  1. ganache-cli -d
  2. Execute two transactions:
web3.eth.sendTransaction({from:'0xd03ea8624c8c5987235048901fb614fdca89b117',to:'0xffcf8fdee72ac11b5c542428b35eef5769c409f0',value:2000}).then(console.log)

web3.eth.sendTransaction({from:'0xffcf8fdee72ac11b5c542428b35eef5769c409f0',to:'0xffcf8fdee72ac11b5c542428b35eef5769c409f0',value:2000}).then(console.log)

Only the from address is changed but both transactions return the same hash 0x2c192f7fa7fd52b38224f1b0e522c6423f52cd29644372f1d51367229481f6be.

Context

For tests, I need to perform the same transaction by different accounts, but the transactions become indistinguishable.

Your Environment

  • Version used: 6.1.4
  • Version of Truffle/Remix/Other tools used: web3js 1.0.0-beta.23
  • NodeJS Version: [ ] 6.x, [ ] 7.x (unsupported), [x] 8.x, [ ] 9.x
  • Operating System and version (include distro if Linux): MacOs High Sierra 10.13.4
@seesemichaelj

This comment has been minimized.

Copy link
Member

commented Aug 27, 2018

Thanks for reporting this! This actually got fixed a couple of versions ago; please update :)

Thanks again!

@dejaner

This comment has been minimized.

Copy link

commented Sep 19, 2018

I am experiencing this issue in the latest ganache version.

Basically what is said in the opening post. The same transaction with different from produces the same tx-hash.

eth_sendTransaction

  Transaction: 0x8ca32104ba304eb5aad97ad9d9f422da715d3196e7f3d4ed8fb8dbd948ab7b4d
  Gas usage: 70159
  Block Number: 24
  Block Time: Wed Sep 19 2018 12:06:01 GMT+0200 (Central European Summer Time)

eth_getTransactionReceipt
eth_sendTransaction

  Transaction: 0x8ca32104ba304eb5aad97ad9d9f422da715d3196e7f3d4ed8fb8dbd948ab7b4d
  Gas usage: 70159
  Block Number: 25
  Block Time: Wed Sep 19 2018 12:06:01 GMT+0200 (Central European Summer Time)

eth_getTransactionReceipt
eth_sendTransaction

  Transaction: 0x8ca32104ba304eb5aad97ad9d9f422da715d3196e7f3d4ed8fb8dbd948ab7b4d
  Gas usage: 70159
  Block Number: 26
  Block Time: Wed Sep 19 2018 12:06:01 GMT+0200 (Central European Summer Time)
@davidmurdoch

This comment has been minimized.

Copy link
Member

commented Sep 19, 2018

@dejaner I'm able to reproduce the issue. Reopening and tagging as high priority.

To reproduce:

Run Ganache v1.2.2 or Ganache CLI v6.1.7 with defaults.

simple reproduction steps (use your own from/to addresses):

const web3 = new Web3();
web3.setProvider(new Web3.providers.HttpProvider("http://127.0.0.1:7545"));
web3.eth.sendTransaction({from:'0x0da6edFBfA49648b50019127A47489D79A271e02',to:'0xC134c43336f09749A5597D5A2537d1FAEB18021e',value:2000}, console.log);
web3.eth.sendTransaction({from:'0x2087f7780a67a8F6d6ECf90e06f9Fd93A78660E6',to:'0xC134c43336f09749A5597D5A2537d1FAEB18021e',value:2000}, console.log);

both console.logs outputs will be the identical.

Additionally, running the above script twice in a row will result in 6 transactions displayed in the Ganache Transactions tab. Running it again will result in 12 transaction, and running it once more will result in 20 transactions and so on. This specific transaction repetition issue does not appear to be an issue in Ganache CLI v6.1.7.

@fergarrui

This comment has been minimized.

Copy link

commented Oct 22, 2018

I can also reproduce the issue with 6.1.7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.