user31202: I am trying to convert my Bitcoin Address with BitcoinJ in order to look like a normal address such as this:
1J7mdg5rbQyUHENYdx39WVWK7fsLpEoXZy.
I haven't found anything exept for the Base58.encode() which takes the getPubkeyHash() of my ECKey and returns something like this:
5ahorsFsHTcG3f662evowc5c9zf.
Which means that encodes the given bytes in base58,no checksum is appended according to the API.But i want my address to look like the above one.
Is there any algorithm in java  for encoding address_byte_string (consisting of 1-byte_version + hash_or_other_data + 4-byte_check_code)?
according to this:https://en.bitcoin.it/wiki/Base58Check_encoding

user10377: Not Java, but interesting to examine as a reference to explore Java functionality with this fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc  being a secp256k1 elliptic curve private key.

% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx sha256 | bx ripemd160 | bx wrap-encode -v 0 | bx base58-encode
1KNogjhyQ3fSPGpzgAv8gSG5WLVN8L39Ln
% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx sha256 | bx ripemd160 | bx base58check-encode -v 0
1KNogjhyQ3fSPGpzgAv8gSG5WLVN8L39Ln
% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx bitcoin160 | bx base58check-encode -v 0
1KNogjhyQ3fSPGpzgAv8gSG5WLVN8L39Ln
% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx bitcoin160 | bx address-encode -v 0
1KNogjhyQ3fSPGpzgAv8gSG5WLVN8L39Ln
% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public | bx bitcoin160 | bx address-encode -v 0
1FbGdbUU1ibBtanPTLAuMTAJ4Y9HkatkcX
% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public
02cf90dc2b34937fff7cf1eb4b260f1e5610231134b864761e508505938bbef8fc
% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u
04cf90dc2b34937fff7cf1eb4b260f1e5610231134b864761e508505938bbef8fc00aeb265797336b74146e018da7b78070f1f1072540a2c3fe83637ca5d605b3c
% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx bitcoin160
c991f856a2992c877d3923298e67b88fe61e6c76


user2306: Yes.
ECKey key = ...;
String addr = key.toAddress(MainNetParams.get()).toString();

https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/core/ECKey.html#toAddress-org.bitcoinj.core.NetworkParameters-

31202: <p>I am trying to convert my Bitcoin Address with BitcoinJ in order to look like a normal address such as this:
1J7mdg5rbQyUHENYdx39WVWK7fsLpEoXZy.</p>

<p>I haven't found anything exept for the <code>Base58.encode()</code> which takes the <code>getPubkeyHash()</code> of my <code>ECKey</code> and returns something like this:
5ahorsFsHTcG3f662evowc5c9zf.</p>

<p>Which means that encodes the given bytes in base58,no checksum is appended according to the API.But i want my address to look like the above one.</p>

<p>Is there any algorithm in java  for <strong>encoding address_byte_string (consisting of 1-byte_version + hash_or_other_data + 4-byte_check_code)</strong>?</p>

<p>according to this:<a href="https://en.bitcoin.it/wiki/Base58Check_encoding" rel="nofollow">https://en.bitcoin.it/wiki/Base58Check_encoding</a></p>
 10377: <p>Not Java, but interesting to examine as a reference to explore Java functionality with this fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc  being a secp256k1 elliptic curve private key.</p>

<ol>
<li><code>% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx sha256 | bx ripemd160 | bx wrap-encode -v 0 | bx base58-encode</code>
<strong>1KNogjhyQ3fSPGpzgAv8gSG5WLVN8L39Ln</strong></li>
<li><code>% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx sha256 | bx ripemd160 | bx base58check-encode -v 0</code>
<strong>1KNogjhyQ3fSPGpzgAv8gSG5WLVN8L39Ln</strong></li>
<li><code>% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx bitcoin160 | bx base58check-encode -v 0</code>
<strong>1KNogjhyQ3fSPGpzgAv8gSG5WLVN8L39Ln</strong></li>
<li><code>% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx bitcoin160 | bx address-encode -v 0</code>
<strong>1KNogjhyQ3fSPGpzgAv8gSG5WLVN8L39Ln</strong></li>
<li><code>% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public | bx bitcoin160 | bx address-encode -v 0</code>
<strong>1FbGdbUU1ibBtanPTLAuMTAJ4Y9HkatkcX</strong></li>
<li><code>% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public</code>
<strong>02cf90dc2b34937fff7cf1eb4b260f1e5610231134b864761e508505938bbef8fc</strong></li>
<li><code>% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u</code>
<strong>04cf90dc2b34937fff7cf1eb4b260f1e5610231134b864761e508505938bbef8fc00aeb265797336b74146e018da7b78070f1f1072540a2c3fe83637ca5d605b3c</strong></li>
<li><code>% echo fc8fba997174132184998ab82b28e441e80c73236ccaf8b6a1efadc33febecfc | bx ec-to-public -u | bx bitcoin160</code>
<strong>c991f856a2992c877d3923298e67b88fe61e6c76</strong></li>
</ol>
 2306: <p>Yes.</p>

<pre><code>ECKey key = ...;
String addr = key.toAddress(MainNetParams.get()).toString();
</code></pre>

<p><a href="https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/core/ECKey.html#toAddress-org.bitcoinj.core.NetworkParameters-" rel="noreferrer">https://bitcoinj.github.io/javadoc/0.12/org/bitcoinj/core/ECKey.html#toAddress-org.bitcoinj.core.NetworkParameters-</a></p>
