{"action":"created","issue":{"url":"https://api.github.com/repos/bitpay/bitcore/issues/1075","labels_url":"https://api.github.com/repos/bitpay/bitcore/issues/1075/labels{/name}","comments_url":"https://api.github.com/repos/bitpay/bitcore/issues/1075/comments","events_url":"https://api.github.com/repos/bitpay/bitcore/issues/1075/events","html_url":"https://github.com/bitpay/bitcore/issues/1075","id":57687882,"number":1075,"title":"Unsigned transaction can't be serialized and deserialized correctly","user":{"login":"dskloet","id":6271274,"avatar_url":"https://avatars.githubusercontent.com/u/6271274?v=3","gravatar_id":"","url":"https://api.github.com/users/dskloet","html_url":"https://github.com/dskloet","followers_url":"https://api.github.com/users/dskloet/followers","following_url":"https://api.github.com/users/dskloet/following{/other_user}","gists_url":"https://api.github.com/users/dskloet/gists{/gist_id}","starred_url":"https://api.github.com/users/dskloet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dskloet/subscriptions","organizations_url":"https://api.github.com/users/dskloet/orgs","repos_url":"https://api.github.com/users/dskloet/repos","events_url":"https://api.github.com/users/dskloet/events{/privacy}","received_events_url":"https://api.github.com/users/dskloet/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":8,"created_at":"2015-02-14T09:43:03Z","updated_at":"2015-02-14T22:39:42Z","closed_at":"2015-02-14T22:38:29Z","body":"I have the following code working:\r\n\r\n```javascript\r\n  var tx = new bitcore.Transaction().\r\n      from(outputs).\r\n      to(address, amount).\r\n      change(change).\r\n      fee(fee);\r\n  tx = tx.sign(privateKey);  // this line\r\n  tx = new bitcore.Transaction(tx.serialize());  // this line\r\n  broadcast(tx);\r\n```\r\n\r\nBut if I swap the two lines marked as `// this line`, I get the following error when broadcasting the transaction:\r\n`Uncaught bitcore.ErrorInvalidState: Invalid state: undefined`"},"comment":{"url":"https://api.github.com/repos/bitpay/bitcore/issues/comments/74395116","html_url":"https://github.com/bitpay/bitcore/issues/1075#issuecomment-74395116","issue_url":"https://api.github.com/repos/bitpay/bitcore/issues/1075","id":74395116,"user":{"login":"eordano","id":42750,"avatar_url":"https://avatars.githubusercontent.com/u/42750?v=3","gravatar_id":"","url":"https://api.github.com/users/eordano","html_url":"https://github.com/eordano","followers_url":"https://api.github.com/users/eordano/followers","following_url":"https://api.github.com/users/eordano/following{/other_user}","gists_url":"https://api.github.com/users/eordano/gists{/gist_id}","starred_url":"https://api.github.com/users/eordano/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eordano/subscriptions","organizations_url":"https://api.github.com/users/eordano/orgs","repos_url":"https://api.github.com/users/eordano/repos","events_url":"https://api.github.com/users/eordano/events{/privacy}","received_events_url":"https://api.github.com/users/eordano/received_events","type":"User","site_admin":false},"created_at":"2015-02-14T22:39:42Z","updated_at":"2015-02-14T22:39:42Z","body":"You can check your bitcore version with `require('bitcore').version`! Let me know if you have any further doubts"}}