-
Notifications
You must be signed in to change notification settings - Fork 238
tx.hash vs keccak256 #150
Comments
Hey @rajeshsubhankar! There are multiple issues with your code:
I fixed the three issues here: const Transaction = require('ethereumjs-tx');
const keccak256 = require('js-sha3').keccak256;
// RLP encoded hex
const hexData = 'eb8084b2d05e008261a894e36ea790bc9d7ab70c55260c66d52b1eca985f8488016345785d8a0000801c8080';
const data = Buffer.from(hexData, "hex")
console.log('tx hash: ', keccak256(data));
const tx = new Transaction(data);
console.log('tx hash 2: ', tx.hash(true).toString('hex')); I'm closing this issue, but feel free to open a new issue or comment in here. |
Can we eventually transform experiences from this issue into some better overall or code documentation? |
There's not much we can do about (1). (2) will be better once ethereumjs/ethereumjs-util#197 (comment) is merged and available in all the libraries. (3) is more complex. Let me explain why.
A refactor transforming https://github.com/ethereumjs/ethereumjs-tx/issues/140#issuecomment-491079633 has more info about the main issue I see with this library. |
Maybe we should concentrate this discussion in #151 |
I was expecting both the log output to be the same. Am I missing something?
The text was updated successfully, but these errors were encountered: