{"action":"created","issue":{"url":"https://api.github.com/repos/blockchain/api-v1-client-java/issues/12","labels_url":"https://api.github.com/repos/blockchain/api-v1-client-java/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/blockchain/api-v1-client-java/issues/12/comments","events_url":"https://api.github.com/repos/blockchain/api-v1-client-java/issues/12/events","html_url":"https://github.com/blockchain/api-v1-client-java/issues/12","id":110895185,"number":12,"title":"Base58","user":{"login":"mik3hall","id":4488118,"avatar_url":"https://avatars.githubusercontent.com/u/4488118?v=3","gravatar_id":"","url":"https://api.github.com/users/mik3hall","html_url":"https://github.com/mik3hall","followers_url":"https://api.github.com/users/mik3hall/followers","following_url":"https://api.github.com/users/mik3hall/following{/other_user}","gists_url":"https://api.github.com/users/mik3hall/gists{/gist_id}","starred_url":"https://api.github.com/users/mik3hall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mik3hall/subscriptions","organizations_url":"https://api.github.com/users/mik3hall/orgs","repos_url":"https://api.github.com/users/mik3hall/repos","events_url":"https://api.github.com/users/mik3hall/events{/privacy}","received_events_url":"https://api.github.com/users/mik3hall/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-10-12T01:07:28Z","updated_at":"2015-10-16T08:42:00Z","closed_at":null,"body":"To make a valid issue, although I have additional questions. This might be considered a enhancement request to include Base58 conversions as part of the API.\r\n\r\n[end of enhancement request]\r\n_____\r\n\r\n\r\nAdditional questions. (Please feel free to indicate if there is a more appropriate place to ask these or where there is documentation I should refer to before asking).\r\n\r\nI am new to this and just got into where the code I'm working on started looking at real transactions. I am interested in the crypto parts of these. The address and signatures, hashes I am assuming are strictly hex encoded byte arrays.  \r\nRight now I'm having trouble getting pretty much any of my values to match up. Looking at it it seems encoding might part of the difficulty. \r\nDo both addresses and signatures use Base58 encoding, or the bitcoin variant?\r\nI am now assuming at least addresses do. I am looking for now at using the bitcoinj Base58 class although introducing a second api probably with different licensing isn't an ideal situation. I may attempt my own at some point if such a class doesn't seem like a fit to the blockchain.info api's.\r\nTo further make sure I am understanding the api correctly. Given a output script like...\r\n\r\n[java] *** Script ***\r\n     [java] OP_DUP\r\n     [java] OP_HASH160\r\n     [java] 396652927daedcef95e1fb89a09faf09545c3225\r\n     [java] OP_EQUALVERIFY\r\n     [java] OP_CHECKSIG\r\n     [java] ***************\r\n\r\nComing into it I believe signature and public key/address are expected to be on the stack.\r\nFor the api would these come from...\r\n\r\nsignature - input.getScriptSignature(); would that be Base58 or some other encoding?\r\n\r\naddress - Output prior = input.getPreviousOutput();\r\n\t                 System.out.println(\"prior output is \" + prior);\r\n\t                 String addr = prior.getAddress();\r\nThis I'm currently assuming is Base58 and is the pubic key expected to be on the stack\r\n.\r\nWould this be correct api java to get <sig> and <pubkey> on the stack before running the output script?\r\n\r\nThanks\r\n"},"comment":{"url":"https://api.github.com/repos/blockchain/api-v1-client-java/issues/comments/148656310","html_url":"https://github.com/blockchain/api-v1-client-java/issues/12#issuecomment-148656310","issue_url":"https://api.github.com/repos/blockchain/api-v1-client-java/issues/12","id":148656310,"user":{"login":"matsjj","id":4670837,"avatar_url":"https://avatars.githubusercontent.com/u/4670837?v=3","gravatar_id":"","url":"https://api.github.com/users/matsjj","html_url":"https://github.com/matsjj","followers_url":"https://api.github.com/users/matsjj/followers","following_url":"https://api.github.com/users/matsjj/following{/other_user}","gists_url":"https://api.github.com/users/matsjj/gists{/gist_id}","starred_url":"https://api.github.com/users/matsjj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/matsjj/subscriptions","organizations_url":"https://api.github.com/users/matsjj/orgs","repos_url":"https://api.github.com/users/matsjj/repos","events_url":"https://api.github.com/users/matsjj/events{/privacy}","received_events_url":"https://api.github.com/users/matsjj/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T08:42:00Z","updated_at":"2015-10-16T08:42:00Z","body":"> bitcoinj I thought was an apache license but no matter at this point.\r\n\r\nHm might be, but the Base58 file was under MIT at least...\r\n\r\nThat course is very good, good decision to work your way through it! \r\n\r\nThe scripting system is kinda difficult, so another tool would be great to help other people familiarise with it. You want to explore how many wheels you want to redefine though. For example bitcoinj does have a great Script evaluation built in already (see Script.correctlySpends(...) ).\r\n\r\nYou can obtain the output script of a transaction directly via our API (transaction.outputs.0..9.script). It is a byte[], just as it is stored in the blockchain. This means that you don't necessarily need a B58 encoder, as the address is just a representation of a special (or rather common) form of script. \r\n\r\nSo for the transaction\r\nhttps://blockchain.info/tx/6d50161414558cb71ba7886be0c1c300e2b18667509a983ebfac819b0c546d81\r\nfor example, you have two outputs, and the second one is\r\n> 76a914c5b7fd920dce5f61934e792c7e6fcc829aff533d88ac\r\nwhich basically translate into \r\n> 'pay to the pubkeyhash '14c5b7fd920dce5f61934e792c7e6fcc829aff533d88''\r\nwhich we translate to the address \r\n> 1K2SXgApmo9uZoyahvsbSanpVWbzZWVVMF\r\n\r\nYou can check the input for this transaction https://blockchain.info/tx-index/106800549\r\nand also via our API."}}