{"action":"created","issue":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6474","labels_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6474/labels{/name}","comments_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6474/comments","events_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6474/events","html_url":"https://github.com/bitcoin/bitcoin/issues/6474","id":97208467,"number":6474,"title":"How to extract btcaddress from Txin ?","user":{"login":"mclycan","id":10348222,"avatar_url":"https://avatars.githubusercontent.com/u/10348222?v=3","gravatar_id":"","url":"https://api.github.com/users/mclycan","html_url":"https://github.com/mclycan","followers_url":"https://api.github.com/users/mclycan/followers","following_url":"https://api.github.com/users/mclycan/following{/other_user}","gists_url":"https://api.github.com/users/mclycan/gists{/gist_id}","starred_url":"https://api.github.com/users/mclycan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mclycan/subscriptions","organizations_url":"https://api.github.com/users/mclycan/orgs","repos_url":"https://api.github.com/users/mclycan/repos","events_url":"https://api.github.com/users/mclycan/events{/privacy}","received_events_url":"https://api.github.com/users/mclycan/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-25T08:31:35Z","updated_at":"2015-07-25T09:55:11Z","closed_at":null,"body":"I can use this code to extract btcaddress from Txout, but I don't know how to extract address from Txin:\r\n```    \r\nBOOST_FOREACH(const CTxOut& txout, tx.vout) {\r\n      if(ExtractDestination(txout.scriptPubKey, addressRetout)){\r\n                std::string bitaddrout = CBitcoinAddress(addressRetout).ToString();\r\n       }\r\n}\r\n```\r\nAnd I have try this code to extract address from Txin, but it not work:\r\n```\r\n BOOST_FOREACH(const CTxIn& txin, tx.vin)   \r\n{ \r\n    COutPoint prevout = txin.prevout;\r\n    CCoins prev;\r\n    if(pcoinsTip->GetCoins(prevout.hash, prev))\r\n    {\r\n        if (prevout.n < prev.vout.size()){\r\n            const CTxOut &vout = prev.vout[prevout.n];   \r\n            if (ExtractDestination(vout.scriptPubKey, addressRetin))\r\n            {\r\n                std::string bitaddrin = CBitcoinAddress(addressRetin).ToString();     \r\n             }\r\n         }\r\n    }   \r\n}\r\n```\r\nthe function \"ExtractDestination(vout.scriptPubKey, addressRetin)\" always return 0."},"comment":{"url":"https://api.github.com/repos/bitcoin/bitcoin/issues/comments/124829543","html_url":"https://github.com/bitcoin/bitcoin/issues/6474#issuecomment-124829543","issue_url":"https://api.github.com/repos/bitcoin/bitcoin/issues/6474","id":124829543,"user":{"login":"jonasschnelli","id":178464,"avatar_url":"https://avatars.githubusercontent.com/u/178464?v=3","gravatar_id":"","url":"https://api.github.com/users/jonasschnelli","html_url":"https://github.com/jonasschnelli","followers_url":"https://api.github.com/users/jonasschnelli/followers","following_url":"https://api.github.com/users/jonasschnelli/following{/other_user}","gists_url":"https://api.github.com/users/jonasschnelli/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasschnelli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasschnelli/subscriptions","organizations_url":"https://api.github.com/users/jonasschnelli/orgs","repos_url":"https://api.github.com/users/jonasschnelli/repos","events_url":"https://api.github.com/users/jonasschnelli/events{/privacy}","received_events_url":"https://api.github.com/users/jonasschnelli/received_events","type":"User","site_admin":false},"created_at":"2015-07-25T09:55:11Z","updated_at":"2015-07-25T09:55:11Z","body":"@mclycan: Please mind that this in an issue tracker not a help forum. For individual help please use the appropriate channels.\r\n1) http://bitcoin.stackexchange.com\r\n2) irc.feeenode.com #bitcoin or maybe #bitcoin-dev"}}