Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.
This repository was archived by the owner on Apr 6, 2020. It is now read-only.

tx.hash vs keccak256 #150

@rajeshsubhankar

Description

@rajeshsubhankar
const Transaction = require('ethereumjs-tx');
const keccak256 = require('js-sha3').keccak256;

// RLP encoded hex
const hexData = 'eb8084b2d05e008261a894e36ea790bc9d7ab70c55260c66d52b1eca985f8488016345785d8a0000801c8080';
console.log('tx hash: ', keccak256(hexData)); // 1f0a103ad8cb3df6a28a654b5bf5bbb26f60ec89857cb07118f1915b03aec7cd
const tx = new Transaction(hexData);
console.log('tx hash 2: ', tx.hash(false).toString('hex')); // 1a7390591440368a685688f5e37e23efd66c9c42e53bccb881a7a585de8724d2

I was expecting both the log output to be the same. Am I missing something?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy