{"action":"opened","issue":{"url":"https://api.github.com/repos/bitpay/bitcore-lib/issues/29","labels_url":"https://api.github.com/repos/bitpay/bitcore-lib/issues/29/labels{/name}","comments_url":"https://api.github.com/repos/bitpay/bitcore-lib/issues/29/comments","events_url":"https://api.github.com/repos/bitpay/bitcore-lib/issues/29/events","html_url":"https://github.com/bitpay/bitcore-lib/issues/29","id":120040813,"number":29,"title":"Idea: `transaction.normalizedHash` for transaction malleability ","user":{"login":"braydonf","id":544777,"avatar_url":"https://avatars.githubusercontent.com/u/544777?v=3","gravatar_id":"","url":"https://api.github.com/users/braydonf","html_url":"https://github.com/braydonf","followers_url":"https://api.github.com/users/braydonf/followers","following_url":"https://api.github.com/users/braydonf/following{/other_user}","gists_url":"https://api.github.com/users/braydonf/gists{/gist_id}","starred_url":"https://api.github.com/users/braydonf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/braydonf/subscriptions","organizations_url":"https://api.github.com/users/braydonf/orgs","repos_url":"https://api.github.com/users/braydonf/repos","events_url":"https://api.github.com/users/braydonf/events{/privacy}","received_events_url":"https://api.github.com/users/braydonf/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-12-02T21:34:21Z","updated_at":"2015-12-02T21:34:21Z","closed_at":null,"body":"As mentioned in https://github.com/bitcoin/bips/commit/916142e742b4256686c26b15a0bf943aea3f5ef9 a normalized transaction id could help with transaction malleability.\r\n\r\nFor example, an additional method on Transaction could exist:\r\n```js\r\nif (tx1.normalizedHash() === tx2.normalizedHash()) {\r\n  // the transaction effect \"from -> to\" is equivalent\r\n}\r\n```\r\n\r\nThe hash could be calculated (similar to sighash: https://github.com/bitpay/bitcore-lib/blob/master/lib/transaction/sighash.js):\r\n\r\n1. Sort transaction using https://github.com/bitcoin/bips/blob/master/bip-0069.mediawiki ?\r\n2. Remove all input scripts\r\n3. Clear the sequenceNumber and nLockTime?\r\n4. Serialize transaction and hash\r\n\r\nIt could then be possible to search Insight via a normalized hash, with an additional index added."}}