{"action":"created","issue":{"url":"https://api.github.com/repos/bitpay/bitcore/issues/1183","labels_url":"https://api.github.com/repos/bitpay/bitcore/issues/1183/labels{/name}","comments_url":"https://api.github.com/repos/bitpay/bitcore/issues/1183/comments","events_url":"https://api.github.com/repos/bitpay/bitcore/issues/1183/events","html_url":"https://github.com/bitpay/bitcore/issues/1183","id":67685137,"number":1183,"title":"transaction.to() allows NaN for amount, sending all inputs as mining fee","user":{"login":"karlkeefer","id":305272,"avatar_url":"https://avatars.githubusercontent.com/u/305272?v=3","gravatar_id":"","url":"https://api.github.com/users/karlkeefer","html_url":"https://github.com/karlkeefer","followers_url":"https://api.github.com/users/karlkeefer/followers","following_url":"https://api.github.com/users/karlkeefer/following{/other_user}","gists_url":"https://api.github.com/users/karlkeefer/gists{/gist_id}","starred_url":"https://api.github.com/users/karlkeefer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karlkeefer/subscriptions","organizations_url":"https://api.github.com/users/karlkeefer/orgs","repos_url":"https://api.github.com/users/karlkeefer/repos","events_url":"https://api.github.com/users/karlkeefer/events{/privacy}","received_events_url":"https://api.github.com/users/karlkeefer/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-10T21:15:06Z","updated_at":"2015-04-10T21:20:27Z","closed_at":null,"body":"We managed to create and sign transactions with bitcore that had a NaN output.\r\nBelow is the decoded transaction that was created and broadcast on testnet.\r\n\r\nMaybe there should be some extra input validation, or some other tests to block transactions with outputs of 0, or a check against outrageous fees?\r\n\r\nhttp://tbtc.blockr.io/tx/info/12358fdfc00ad9820ad71e09d5b28ebc33e4f32990c6e6288297fd23624e2e77\r\n````json\r\n{\r\n    \"total\": 0, \r\n    \"double_spend\": false, \r\n    \"received\": \"2015-04-10T21:04:17.065780211Z\", \r\n    \"block_height\": -1, \r\n    \"preference\": \"high\", \r\n    \"inputs\": [\r\n        {\r\n            \"script_type\": \"pay-to-pubkey-hash\", \r\n            \"script\": \"473044022071b83b7f40431b1f66ce1be8be95e9007d492ab23e8ac5df272a04a19667f2a202205006365a2a1d3e98e5e91079a5fd06b94cf753f1948cd618947f3bbad2f4891b01210235776478c45ba4fdb7ff0e25d278d6fb25d2418a4cbcab43d635c22d526a0384\", \r\n            \"output_value\": 5770020, \r\n            \"prev_hash\": \"e050a38bd2ae913cab9828fcaa099bd3452a5b10edacbd1725963268a128cd8a\", \r\n            \"age\": 5, \r\n            \"output_index\": 1, \r\n            \"sequence\": 4294967295, \r\n            \"addresses\": [\r\n                \"mjvYvguEB5K2MicKdxwwgtaBLZ2mfuMtS8\"\r\n            ]\r\n        }\r\n    ], \r\n    \"addresses\": [\r\n        \"mjvYvguEB5K2MicKdxwwgtaBLZ2mfuMtS8\", \r\n        \"mhCXGeqpKwkUNH4B4LuafCU1QzfAuYpE3x\"\r\n    ], \r\n    \"ver\": 1, \r\n    \"lock_time\": 0, \r\n    \"fees\": 5770020, \r\n    \"relayed_by\": \"54.82.229.14\", \r\n    \"vin_sz\": 1, \r\n    \"confirmations\": 0, \r\n    \"outputs\": [\r\n        {\r\n            \"script_type\": \"pay-to-pubkey-hash\", \r\n            \"script\": \"76a9141273e00991886890d60409c468810f73c4425cf288ac\", \r\n            \"value\": 0, \r\n            \"addresses\": [\r\n                \"mhCXGeqpKwkUNH4B4LuafCU1QzfAuYpE3x\"\r\n            ], \r\n            \"spent_by\": \"c6f415181734d96ba8a80a619b1e514e85ef112099eb5d077de7fe6f1d123d27\"\r\n        }\r\n    ], \r\n    \"vout_sz\": 1, \r\n    \"hash\": \"12358fdfc00ad9820ad71e09d5b28ebc33e4f32990c6e6288297fd23624e2e77\"\r\n}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/bitpay/bitcore/issues/comments/91694476","html_url":"https://github.com/bitpay/bitcore/issues/1183#issuecomment-91694476","issue_url":"https://api.github.com/repos/bitpay/bitcore/issues/1183","id":91694476,"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},"created_at":"2015-04-10T21:20:27Z","updated_at":"2015-04-10T21:20:27Z","body":"How was the NaN output produced in bitcore?"}}