{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/669","repository_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib","labels_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/669/labels{/name}","comments_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/669/comments","events_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/669/events","html_url":"https://github.com/bitcoinjs/bitcoinjs-lib/issues/669","id":183095736,"number":669,"title":"How to decode P2SH input script addresses? ECPair.fromPublicKeyBuffer throws error","user":{"login":"Head","id":51700,"avatar_url":"https://avatars.githubusercontent.com/u/51700?v=3","gravatar_id":"","url":"https://api.github.com/users/Head","html_url":"https://github.com/Head","followers_url":"https://api.github.com/users/Head/followers","following_url":"https://api.github.com/users/Head/following{/other_user}","gists_url":"https://api.github.com/users/Head/gists{/gist_id}","starred_url":"https://api.github.com/users/Head/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Head/subscriptions","organizations_url":"https://api.github.com/users/Head/orgs","repos_url":"https://api.github.com/users/Head/repos","events_url":"https://api.github.com/users/Head/events{/privacy}","received_events_url":"https://api.github.com/users/Head/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":6,"created_at":"2016-10-14T16:36:52Z","updated_at":"2016-10-17T13:19:46Z","closed_at":null,"body":"I try to decode an incoming script to get the address.\r\n\r\nfor the output I use:\r\n`const pubKey = address.fromOutputScript(output.script, bitcoinjs.networks.testnet);`\r\n\r\nThis seems to work, but for the input:\r\n`const chunksIn = bitcoinjs.script.decompile(input.script);`\r\n`input.pubKey = bitcoinjs.ECPair.fromPublicKeyBuffer(chunksIn[1], bitcoinjs.networks.testnet).getAddress();`\r\n\r\nfailes with \r\nAssertionError: Invalid sequence length\r\n    at Function.Point.decodeFrom\r\n    at Function.ECPair.fromPublicKeyBuffer\r\n\r\nwhen the input is a \"pay-to-script-hash\""},"comment":{"url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/comments/254204833","html_url":"https://github.com/bitcoinjs/bitcoinjs-lib/issues/669#issuecomment-254204833","issue_url":"https://api.github.com/repos/bitcoinjs/bitcoinjs-lib/issues/669","id":254204833,"user":{"login":"dcousens","id":413395,"avatar_url":"https://avatars.githubusercontent.com/u/413395?v=3","gravatar_id":"","url":"https://api.github.com/users/dcousens","html_url":"https://github.com/dcousens","followers_url":"https://api.github.com/users/dcousens/followers","following_url":"https://api.github.com/users/dcousens/following{/other_user}","gists_url":"https://api.github.com/users/dcousens/gists{/gist_id}","starred_url":"https://api.github.com/users/dcousens/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dcousens/subscriptions","organizations_url":"https://api.github.com/users/dcousens/orgs","repos_url":"https://api.github.com/users/dcousens/repos","events_url":"https://api.github.com/users/dcousens/events{/privacy}","received_events_url":"https://api.github.com/users/dcousens/received_events","type":"User","site_admin":false},"created_at":"2016-10-17T13:19:46Z","updated_at":"2016-10-17T13:19:46Z","body":"If the input is a pay-to-script-hash,  the address is the `hash160` of the last data chunk.\r\nNothing to do with public keys."}}
{"actor":{"display_login":"dcousens"}}